0

I wanted to use fancyhdr in a document with the SBL Hebrew font. However, I get warning messages about undefined font shapes. Please see my example below:

\documentclass{minimal}
\usepackage{fontspec,fancyhdr}
\usepackage[nil,bidi=basic]{babel} 
\babelprovide[import]{hebrew}
\setmainfont{SBL Hebrew}[Script=Hebrew] % With other fonts like Arial the warnings disappear

\pagestyle{fancy}
\fancyhead[C]{\thepage} % When removing C the warnings disappear
\setlength\headheight{12pt}
\setlength\footskip{12pt}

\begin{document}    
שלום    
\end{document}

It seems that the error is specific to the SBL Hebrew font and when not all places are used. I guess that there might be some placeholders that are not available in SBL Hebrew. Is there a neat way to do away with these warnings (i.e. not only muting them)?

2

The right part of the header shows by default the section title (in article) in a slanted font.

As your font doesn't have this shape you get warnings. Reset this header, e.g. with \fancyhf{}

| improve this answer | |
2

As Ulrike Fischer correctly answered, the problem is that fancyhdr tells TeX to use the slanted series of the main font, and SBC Hebrew does not come with one. Since you aren’t using the part of the header that takes the slant, her answer is great.

I’d still like to supplement her answer with an alternative solution.

\documentclass{article}
\tracinglostchars=2 % Warn if a glyph gets dropped!
\usepackage{fancyhdr}
\usepackage[nil,bidi=basic]{babel} 
\usepackage{fontspec} % Better to load this after babel?

\babelprovide[import,main,onchar=ids fonts]{hebrew}

\babelfont{rm}
          [Scale=1.0,
           ItalicFont=*,
           ItalicFeatures={FakeSlant=-0.125}, % Italic in a RTL language should slant left.
           Language=Default % Suppress harmless warning.
          ]{SBL_Hbrw.ttf}

\pagestyle{fancy}
\fancyhead[C]{\thepage} % When removing C the warnings disappear
\setlength\headheight{12pt}
\setlength\footskip{12pt}

\begin{document}    
שלום
\textit{חברים}
\end{document}

SBL Hebrew sample

This uses the FakeSlant= feature of fontspec to create a slanted version of the font, with the slant from right to left. (I don’t think there’s a consensus in Israel about how to handle italics, either.) You might or might not like the results. You could also select a matching font as the ItalicFont.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.