2

I use ArchLinux and TeXLive 2022, LuaHBTeX 1.15.0, with cambriab.ttf cambriai.ttf cambria.ttc cambriaz.ttf located in /usr/local/share/fonts/c

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Cambria}

\begin{document}
    abcd \textbf{abcd}
\end{document}

This produces:

enter image description here

and a warning

Font shape `TU/Cambria(0)/b/n' undefined
(Font)  using `TU/Cambria(0)/m/n' instead.

PS: I have installed all 5 Cambria (R, B, I, BI, Math) fonts from Windows.

11
  • 1
    I use ArchLinux and TeXLive 2022, LuaHBTeX 1.15.0, with cambriab.ttf cambriai.ttf cambria.ttc cambriaz.ttf located in /usr/local/share/fonts/c Commented Sep 16, 2022 at 6:12
  • 1
    What happens if you change \setmainfont{Cambria} to \setmainfont{Cambria}[BoldFont=CambriaB]?
    – Mico
    Commented Sep 16, 2022 at 6:29
  • 1
    It works! @Mico Commented Sep 16, 2022 at 6:43
  • 1
    Great! In recent years, the utility packages that fontspec relies on to map font descriptors into actual file names on various operating systems have actually become rather good. Nevertheless, as you've discovered, a bit of extra help is still needed from time to time. If you haven't already done so, do take the time to acquaint yourself thoroughly with the user guide of the fontspec package. It'll be time well spent.
    – Mico
    Commented Sep 16, 2022 at 7:03
  • 3
    Note Cambria isn't usually licenced for use on Linux, you could use the Google font Caladea which is metric compatible and probably pre-installed. Commented Sep 16, 2022 at 8:11

1 Answer 1

0

On macOS we have:

H-MacBook:Python voss$ luafindfont Cambria
  No.        Filename Symbolic name                                Path
   1.     Cambria.otf     cambria  /Users/voss/Library/Fonts/Cambria/
   2.    CambriaB.ttf     cambria  /Users/voss/Library/Fonts/Cambria/
   3.    CambriaI.ttf     cambria  /Users/voss/Library/Fonts/Cambria/
   4. CambriaMath.otf cambriamath  /Users/voss/Library/Fonts/Cambria/
   5.    CambriaZ.ttf     cambria  /Users/voss/Library/Fonts/Cambria/

The symbolic names are not correctly set inside the font files: LuaTeX is unable to find italic, bold, ... However, in my installation there is no BoldItalic, the reason why I have to fake it:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Cambria.otf}[
    BoldFont=CambriaB.ttf,
    ItalicFont=CambriaI.ttf,
    BoldItalicFont=CambriaI.ttf,
    BoldItalicFeatures={RawFeature={embolden=5}}
]

\begin{document}
    abcd \textbf{abcd} \textit{abcd}
    \textbf{\textit{abcd}}
\end{document}

enter image description here

5
  • Just curious: Which versions of MacOS and MacTeX do you employ? The reason I ask is that on my system (MacOS 12.6, MacTeX 2022), and with the five cambria files stored in /Library/Fonts/Microsoft/, it suffices to run \setmainfont{Cambria} to access both font weights (medium, bold) and both font shapes (upright, slanted).
    – Mico
    Commented Sep 17, 2022 at 8:30
  • I am curious about that issue too. I had TeXLive installed on Windows from about year back and I could use \setmainfont{Cambria} and get all the variants. I changed my machine and reinstalled TeXLive from scratch, rsync'ing from the main repo. And now I need to specify the fonts for the variants. So something must have changed somewhere.
    – FabPop
    Commented Oct 21, 2022 at 7:24
  • run luafindfont cambria and check if all variants are found. Are you running XeLaTeX or Lualatex?
    – user187802
    Commented Oct 21, 2022 at 11:23
  • Isn’t CambriaZ.ttf the bold italic?
    – Davislor
    Commented Oct 13, 2023 at 21:52
  • yes, that is true. But it is often missing ...
    – user187802
    Commented Oct 14, 2023 at 10:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .