Unicode-Math Bold Math Font Not Correct

boldboldmathfontsunicode-math

I am wondering what I am doing wrong. I am using LuaLaTeX and trying to load the kpfonts. I understand the math version of this font supports bold math. But when I use symbf I don't get the expected result. A comparison of the bold versus regular math versions is shown below. The bold looks upright/regular. I don't know why, it doesn't quite look right. Or is my intuition wrong here? Am I specifying bold incorrectly?

Note when I compile this I do get the warning Some font shapes were not available, defaults substituted. Might this mean the bold math is actually missing and some type of upright substitute gets put in its place?

bold-comp

Here is the code.

\documentclass[11pt,letterpaper]{article}

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

\setmainfont[Path=fonts/serif/]{KpRoman}[
    Extension = .otf,
    UprightFont = *-Regular,
    BoldFont = *-Bold,
    ItalicFont = *-Italic,
    BoldItalicFont = *-BoldItalic
]
\setsansfont[Path=fonts/sans_serif/]{KpSans}[
    Extension = .otf,
    UprightFont = *-Regular,
    BoldFont = *-Bold,
    ItalicFont = *-Italic,
    BoldItalicFont = *-BoldItalic
]

\setmathfont[Path=fonts/math/]{KpMath-Regular}[
    Extension = .otf,
    BoldFont = KpMath-Bold,
]

\begin{document}

\[
    \phi = \int f(x) x dx
\]

\[
    \symbf{\phi = \int f(x) x dx}
\]

\end{document}

Best Answer

enter image description here

\symbf is upright bold, you can use \symbfit for bold math italic, but both use characters from the Unicode math alphabets in the regular font.

As with classic latex, to access the bold math font use \boldmath before the equation. It appears the bold font is not a full math font and misses the bold math characters.

I removed the [Path=f options as they stop the example working if the fonts are installed in the usual texlive locations.

\documentclass[11pt,letterpaper]{article}

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

\setmainfont{KpRoman}[
    Extension = .otf,
    UprightFont = *-Regular,
    BoldFont = *-Bold,
    ItalicFont = *-Italic,
    BoldItalicFont = *-BoldItalic
]
\setsansfont{KpSans}[
    Extension = .otf,
    UprightFont = *-Regular,
    BoldFont = *-Bold,
    ItalicFont = *-Italic,
    BoldItalicFont = *-BoldItalic
]

\setmathfont{KpMath-Regular}[
    Extension = .otf,
    BoldFont = KpMath-Bold,
]

\begin{document}

\[
    \phi = \int f(x) x\, dx
\]

\[
    \symbfit{\phi} = \int \symbfit{f}(\symbfit{x}) \symbfit{x}\, \symbfit{d}\symbfit{x}
\]

\boldmath

\[
    \phi = \int f(x) x\, dx
\]

\[
    \symbfit{\phi} = \int \symbfit{f}(\symbfit{x}) \symbfit{x}\, \symbfit{d}\symbfit{x}
\]

\end{document}