# Polyglossia and fontspec's script feature.

Hi I have a question regarding the combination of polyglossia and fontspec I have written the folllowing:

\documentclass[oneside, 12pt]{book}
\usepackage{fontspec}
\setmainfont[Script=greek, Mapping=tex-text]{Times New Roman}
\setmonofont[Script=greek,Mapping=tex-text]{Courier New}
\usepackage{polyglossia}
\usepackage{xunicode} % Unicode from accented glyphs
\setdefaultlanguage{greek}
\setotherlanguage{english}
%\newfontfamily\greekfont[Mapping=tex-text]{Times New Roman}
%\newfontfamily\greekfonttt[Mapping=tex-text]{Courier New}
\begin{document}
(This is greek:) Αυτό είναι ελληνικά.
(This is mono spaced greek:) \texttt{Αυτό είναι ελληνικά}
\end{document}


If I do this, XeTeX (actually polyglossia) will complain that:

The current roman font does not contain the Greek script!

However, if I uncomment the newfontfamily lines everything works ok. What I do not understand is why I have to include them, since I have explicitly defined what the font family should be when using the greek script, in the \setmainfont[Script=greek, Mapping=tex-text]{Times New Roman}. Otherwise I do not understand the [Script=greek] option in fontspec.

Can anyone shed a light on this?

Thanks very much!

• \textgreek{Καλημέρα!} propably the Times New Roman font that you are using doesn't have a Greek script feature defined. What font type do you use? Opentype (.otf) or Truetype (.ttf). You can check otfinfo, to see the available features. You would need something like otfinfo -s fontaname – pmav99 May 23 '11 at 7:59

The correct name of the option is Greek with an uppercase G. It is an alias for the open type feature grek. And polyglossia is correct: Times doesn't have the open type feature grek (in xelatex, lualatex seems to be able to add it). The main problem is that fontspec doesn't warn you if you make such typos. In the following example the "Greek" gives a warning in the log and on the terminal while the "Unknown" pass through:

\documentclass[oneside, 12pt]{book}
\usepackage{fontspec}
\setmainfont[Script=Greek]{Times New Roman}
\setmonofont[Script=Unknown]{Courier New}

\begin{document}
abc
\end{document}


One could certainly discuss if polyglossia should throw out an error if the script tag is missing as it is not a very reliable test (a lot of fonts do have the glyphs even if the tag is missing).

Btw: With an actual fontspec it is not necessary to load xunicode, fontspec will do it for you.

• Hi, thanks for the answer! I had tried with Script=Greek, but then it complained that fontspec warning: Font 'Courier New' does not contain script 'Greek'. and I thought I had mispelled it. So then the question is why does fontspec complain about the existence of Greek script in courier new, when it actually works when defining it again in polyglossia with newfontfamily? – Nick Papas May 23 '11 at 8:53
• As I wrote: A lot of fonts do have greek glyphs (and so can type greek) but miss the open type feature "grek". Polyglossia checks for the script in the main fonts to prevent you from using the wrong font for your language, but this test is not reliable and in this case gives a "false positive". When you define \greekfont then polyglossia accepts you decision. – Ulrike Fischer May 23 '11 at 9:40
• Aha! this clears things up! thanks very much! – Nick Papas May 23 '11 at 9:54