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?
Best Answer
If you inspect your font files in
Windows Explorer
, you will indeed see that the fonts are calledCMU Bright Medium
andCMU Bright Medium Oblique
.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 ofCMU Bright Medium
isCMU Bright Roman
.I don't know why Windows thinks differently. Now, if you use the real font names,
fontspec
finds them and loads them.This solves your problem, which is that
fontspec
couldn't find theCMU Bright
fonts. Now, you will notice if you compile theMWE
above thatfontspec
throws a few warnings at you, of the following kind: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.