3

Bold/Italic/BoldItalic fonts with \XeLaTeX's \setmainfont does not work correctly. For example (below), the \textbf{English} and \textit{English} looks like normalfont. With \LuaLaTex it is works fine.

\documentclass[twoside]{article}
    \usepackage{fontspec}
    \usepackage{polyglossia}
    \setmainlanguage{english}
    \setmainfont{CMU Serif}                 
    \setsansfont{CMU Sans Serif}            
    \setmonofont{CMU Typewriter Text}

\begin{document}

\noindent
\textbf{English}\\
\texttt{English}\\
\textit{English}\\

\end{document}

With certain other definition

\setmainfont[
  Ligatures=TeX,
  Extension=.otf,
  BoldFont=cmunbx,
  ItalicFont=cmunti,
  BoldItalicFont=cmunbi,
]{cmunrm}

Both, \XeLaTeX and \LuaTeX displays fonts correctly.

I'm using WinXP SP3, Miktex 2.9 (updated)

Some additions

I found temporary solution of the problem. I notice with the \setmainfont{Times New Roman} \XeLaTeX works well. Then I install fonts from \MikTex\fonts\opentype\public\cm-unicode\ to the Windows\Fonts folder.

It turns out that only MiKTeX's xelatex.exe can see fonts from system folder, not from own folder despite the that LaTeX\MikTex\fontconfig\config\*fonts*.conf are included the path to own font folders.

Another additions

As I noticed, the xelatex.exe understand many Human fontfamily names from \MikTex\fonts\opentype\public\cm-unicode\ except only CMU Serif family.

\setmainfont{CMU Bright}    

displays Bold/Italic/BoldItalic fonts.

It seems, the problem localized not in the xelatex.exe but possible in the package fontspec for xelatex, or more probably, in the font files cmun*.otf. May be inside cmun*.otf there are no relations between other files, which is belong to the same family. But it is strange, the LuaLaTeX displays CMU Serif family correct.

sergiokapone
  • 5,578
  • 1
  • 16
  • 39
  • It depends on several factors; if you've made known the fonts to your system, then the first form will work. Otherwise it won't and the second form will be necessary. What operating system are you using and what TeX distribution? – egreg Jan 09 '15 at 20:42
  • @egreg I'm using WinXP SP3, Miktex 2.9 (updated) "if you've made known the fonts to your system" - how can I do this? And possible fonts is known for system because \LuaLaTex works – sergiokapone Jan 09 '15 at 20:44
  • 1
    That's unfortunate, as I know nothing about MiKTeX and Windows. Maybe others will help you in sorting out the issue, that's just as I said: make the fonts known to the system. – egreg Jan 09 '15 at 20:46
  • Maybe this can help: http://tex.stackexchange.com/questions/45478/how-to-make-xelatex-recognize-linked-fonts-with-windows – egreg Jan 09 '15 at 21:13
  • @egreg By the way, I notice the log-file string Font shape EU1/CMUSerif(0)/bx/n' undefined(Font) usingEU1/CMUSerif(0)/m/n' instead – sergiokapone Jan 09 '15 at 21:49
  • That's normal: since CMU Serif isn't known to the system, it can't associate to it the boldface variant. Did you try the method suggested by Leo Liu? – egreg Jan 09 '15 at 21:54
  • @egreg Yes, but it does no effect! – sergiokapone Jan 09 '15 at 21:58
  • I can confirm that there is a problem. miktex/fontspec does find the normal font and the italic font but when looking for the bold font is finds (only) the regular variant: Requested font "CMU Serif/B/OT" at 10.0pt -> ]^^B/MiKTeX2.9/fonts/opentype/public/cm-unicode/cmunrm.otf and then is miffed that it is not a bold font. It is not related to the fonts (the problem persists after I copied the fonts from texlive). I suspect a problem with the binary (the version is slightly different to the one in texlive). – Ulrike Fischer Jan 10 '15 at 12:00
  • I made some additions – sergiokapone Jan 11 '15 at 17:50
  • be careful not to have fonts in two locations. This can lead to faulty glyphs when xelatex finds the one version and xdvipdfmx the other. – Ulrike Fischer Jan 11 '15 at 18:31
  • I made some additions again – sergiokapone Jan 11 '15 at 22:24
  • Last update of MikTeX (dated 1/24/2015) solved this problem. – sergiokapone Jan 25 '15 at 16:59

1 Answers1

2

With -up-to-date TL 2014 and xelatex and lualatex

enter image description here

*File List*
article.cls 2014/09/29 v1.4h Standard LaTeX document class
size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
fontspec.sty 2014/06/21 v2.4a Font selection for XeLaTeX and LuaLaTeX
expl3.sty 2014/11/25 v5471 L3 programming layer (loader)
expl3-code.tex 2014/11/25 v5471 L3 programming layer
etex.sty 1998/03/26 v2.0 eTeX basic definition package (PEB)
l3unicode-data.def 2014/11/23 v5465 L3 Unicode data
l3xdvipdfmx.def
xparse.sty 2014/11/25 v5471 L3 Experimental document command parser
fontspec-patches.sty 2014/06/21 v2.4a Font selection for XeLaTeX and LuaLaTe
X
fontspec-xetex.sty 2014/06/21 v2.4a Font selection for XeLaTeX and LuaLaTeX
fontenc.sty
[ ... ]

You should update your system.