[XeTeX] Xetex, fontspec, font and greek

Pierre Dupond 76nemo76 at gmx.ch
Thu May 7 14:48:08 CEST 2020


Hi All,
       I like the font Neo Hellenic which is nice except
for one thing: in italic shape the latin letter a is a greek alpha
(this is a design decision of the creator of the font and will
probably not be changed).

I have then setup the Italic and Bold Italic font to use
an other font. Until that point everything goes as expected.

But If I want to use the modified font to typeset text in greek with the italic shape
I get the message "Please define \greekfont with \newfontfamily command".

This understandable since I have changed the NeoHellenic font to replace the italic
variant by one without greek. But since Neo Hellenic has all what is needed to
typeset greek, it's a little bit frustrating.

I have tried to create the macro "\greekfont" without success.

In the following minimal example, you can easily reproduce the problem
by commenting/uncommentig the two lines replacing the Italic and BoldItalic
shapes with the Latin Modern font.

I have thought to use the NFSSFamily feature of fontspec package, without
finding a way to solve my problem.

Any idea to solve this problem (if it is possible) would be greatly appreciated.

\documentclass{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{greek}

      \setsansfont[% main font
         UprightFont=GFSNeohellenic,%
         ItalicFont=GFSNeohellenicIt,%
         BoldFont=GFSNeohellenicBold,%
         BoldItalicFont=GFSNeohellenicBoldIt,%
         RawFeature=+pnum,% variable width numbers
         WordSpace={0.75,0.75,1},%
         %ItalicFont=lmroman10-italic.otf,%
         %BoldItalicFont=lmroman10-bolditalic.otf,%
         Scale = MatchLowercase,%
      ]{GFSNeohellenic.otf}%

      \newfontfamily\greekfont{GFSNeohellenic}
      [
          Script=Greek,%
          Extension=.otf,%
          UprightFont=*,%
          ItalicFont=*It,%
          BoldFont=*Bold,%
          BoldItalicFont=*BoldIt,%
          Scale = MatchLowercase,%
      ]
\begin{document}
  {\sffamily This is some text in sans font and in \emph{italic}
   and {\bfseries\itshape bold italic}.

   Some greek text: \textgreek{αβγ}
   and some greek text in
   italic and bold-italic {\itshape \textgreek{αβγ}
   \bfseries \textgreek{αβγ}}.
 }
\end{document}

--
Pierre Dupond <76nemo76 at gmx.ch>



More information about the XeTeX mailing list.