1

I'm trying to modify the fonts in my document so that normal text comes up in Calluna, and maths comes up in Computer Modern Bright.

My preamble goes something like this:

\documentclass{article}

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

\usepackage{ifxetex}

\ifxetex
    \usepackage{fontspec}
    \usepackage{unicode-math}

    \setmainfont{Calluna}
    \setmathfont{Asana Math}  
    %\setmathfont[range=\mathup]{CMU Bright Medium}
    %\setmathfont[range=\mathbfup]{CMU Bright SemiBold}
    %\setmathfont[range=\mathbfit]{CMU Bright SemiBold}
    %\setmathfont[range=\mathit]{CMU Bright Medium Oblique}
\else
    \usepackage[T1]{fontenc}
    \usepackage{cmbright}
\fi

I've gotten to this stage after looking at other examples on this site that appeared to work for other people.

All the \setmathfont commands are commented out because they gave me an error "font-not-found". Currently, Asana Math is working (for some reason). Other fonts like Latin Modern Math do not.

Calluna is one of my system fonts and comes up fine.

How should I proceed in order to set the maths font to CM Bright? Also, what exactly does the package unicode-math do?

2

If you inspect your font files in Windows Explorer, you will indeed see that the fonts are called CMU Bright Medium and CMU Bright Medium Oblique.

enter image description here

Since fontspec can't find those fonts, it means that those names are wrong. If you look at the font name in FontForge, for example, you can see that the actual font name of CMU Bright Medium is CMU Bright Roman.

enter image description here

I don't know why Windows thinks differently. Now, if you use the real font names, fontspec finds them and loads them.

\documentclass{article}
\usepackage{fontspec}
\usepackage{unicode-math}
    \setmainfont{Linux Libertine O}
    \setmathfont[range=\mathup]{CMU Bright Roman}
    \setmathfont[range=\mathbfup]{CMU Bright SemiBold}
    \setmathfont[range=\mathbfit]{CMU Bright SemiBold}
    \setmathfont[range=\mathit]{CMU Bright Oblique}
\begin{document}
1234567890
\end{document}

This solves your problem, which is that fontspec couldn't find the CMU Bright fonts. Now, you will notice if you compile the MWE above that fontspec throws a few warnings at you, of the following kind:

*************************************************
* fontspec warning: "script-not-exist-latn"
* 
* Font 'CMU Bright Roman' does not contain script 'Math'.
* 'Latin' script used instead.
*************************************************

These are warnings, not errors. As I understand it, fontspec is simply telling you that the fonts you're loading aren't set up for math use. So you shouldn't use them for math as you're doing here.

| improve this answer | |
  • I was poking around in the MikTex 2.9 folder on my C: drive (I usw Windows) and the only thing I could find was CMU Bright Medium, etc. Could you list what the files are called on your computer as well so that I can check where they are? I'm sure I'll have this problem again and have to poke around, but having a vague idea of where to go would be nice! – jamesh625 Oct 7 '14 at 4:10
  • Also, your solution didn't work on my system: fontspec warning: "icu-feature-not-exist-in-font" * * OpenType feature 'Style=MathScriptScript' (+ssty) not available for font * 'CMU Bright' with script 'Math' and language 'Default'. – jamesh625 Oct 7 '14 at 4:15
  • @jamesh625 I've updated my answer. The fact that fontspec gives you a warning means that my solution did work on your system. If it didn't you would get an error. – Sverre Oct 7 '14 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.