4

The following MWE will build correctly with XeLaTeX but not with LuaLaTeX.

\documentclass{article}
\usepackage{unicode-math}
\setmainfont{TimesNewRomanPSMT}
\setmathfont{CambriaMath}
\begin{document}
Test text in Times 

\textbf{Bold in Times}

$\mathrm{And this is in Cambria} i = \sin{\theta}$
\begin{equation}
\gamma = \sqrt{\rho R T}
\end{equation}
\end{document}

The error generated by LuaLaTeX is:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "CambriaMath" cannot be found.
...
l.5 \setmathfont{CambriaMath}

I'm using Ubuntu 12.04 with vanilla TeXLive 2013. I've copied the Times New Roman and Cambria Math fonts from my Windows machine and installed them in /usr/local/share/fonts and run sudo fc-cache -fsv to rebuild the cache. I've read through some of the questions about the font-not-found errors (and there sure are a lot of them!) but I could not find any where XeLaTeX works and LuaLaTeX does not.

Other troubleshooting information:

1) Commenting out the \setmathfont line (so that it builds) results in LuaLaTeX being unable to find the bold font shape for Times New Roman. If TimesNewRomanPSMT is changed to timesnewroman everything works.

2) The output from luaotfload-tool -i --find="Cambria Math" is

luaotfload | resolve : Font "Cambria Math" found!
luaotfload | resolve : Resolved file name "/usr/local/share/fonts/truetype/myfonts/CAMBRIA.TTC", subfont nr. "1"
** 1 Cambria Math **************************************************************

          familyname: Cambria Math
            fontname: CambriaMath
            fullname: Cambria Math
         italicangle: 0
             version: 5.96
              weight: Book

3) luaotfload-names.lua.gz (extracted to luaotfload-names.lua) shows all of the installed Cambria font variants with fullpath entries pointing to the correct directory

4) Everything "just works" on Windows

How can I get LuaLaTeX to find the Cambria Math font?

darthbith
  • 7,384
  • Hmm you do know you're not allowed to install CambriaMath on linux.... – David Carlisle May 13 '14 at 14:00
  • @DavidCarlisle Well, yes, I guess that's what the license says, but I think my use case would fall under fair use - I'm just trying to see if I can get it to work! :-) But, IANAL, so if there are other reasons I'm not allowed to do this, I'd be happy to hear about them – darthbith May 13 '14 at 14:07
  • All I know is that some authors of initial pages that described how to install the fonts on linux when it first came out got very scary letters from people who were lawyers. So while I wouldn't normally comment on licence issues, I think it's important that any answer here does at least warn later readers to be aware. – David Carlisle May 13 '14 at 14:13
  • @DavidCarlisle Well, the issue isn't necessarily related to this font exactly, so I'll see if I can reproduce it with a different font. Thanks for the heads up! – darthbith May 13 '14 at 14:32
  • @DavidCarlisle Even if it was legally possible to restrict the use of a font the way you describe, you don’t actually have to “install” (whatever that means) the font “on Linux”. Just mount a Windows partition and then put a symlink to the file in ~/.fonts and it should be usable directly. – Philipp Gesang May 13 '14 at 22:51
  • @darthbith I’ve tested your Latex code (on a Linux machine but that shouldn’t matter) and it works ok: If Cambria is found by luaotfload-tool --find, then Luaotfload will locate it correctly during a TeX run. Fwiw here’s a minimal test file for Plain: https://gist.github.com/phi-gamma/a112d0487cabb1d0077e -- if that one fails on your setup, then there might be some old luaotfload-names.lua file at a different location interfering. If you’re certain the problem persists, please open an item on the official tracker. – Philipp Gesang May 14 '14 at 04:46
  • 4
    This question appears to be off-topic because it is a bug report. The issue was fixed and an update should reach CTAN in the next couple days. – Philipp Gesang May 18 '14 at 20:07
  • @phg I am still having the same problem, with a font called Beorcana Display Pro. If you suspect it might be a different issue, I can ask a question with further details. As with the OP, XeLaTeX finds it but not LuaLaTeX. – Micah Walter Oct 02 '14 at 02:09
  • 2
    Doing this solved the problem for me in Ubuntu 14.04 (http://tex.stackexchange.com/questions/204145/some-fonts-not-recognized-by-lualatex/204438#204438) (1) cd .texmf-var/luatex-cache/generic/fonts/otf/ (2) rm * (3) cd (4) luaotfload-tool --update (5) sudo texhash – DaniCee Oct 03 '14 at 20:28

0 Answers0