4

I'm currently playing around and try to build a sans serif font in lualatex with combo fonts. For the test I use as base math font TeX Gyre Pagella Math and try to pull in glyphs from other math and text fonts.

It already works for numbers and letters but now I'm stuck at the integral. I can use the textstyle integral from TeX Gyre Dejavu Math, but the displaystyle integral is wrong. Has someone an idea how to correct this?

(This is a test file! So it doesn't try to be beautiful. E.g. the script style font use other weights so that one can better see if the combo works).

%needs lualatex!
\documentclass[parskip=full,fleqn]{scrartcl}

\usepackage[math-style=upright]{unicode-math}
\usepackage{combofont}

\setmainfont{Fira Sans}

\setupcombofont{FiraMath}
 {%
 file:texgyrepagella-math.otf:mode=base;script=math;language=DFLT; at #1pt,
 file:firasans-light.otf at #1pt,
 file:firasans-lightitalic.otf at #1pt,
 file:texgyredejavu-math.otf at #1pt
 }
 {%
 {},
 0x30-0x39,
 0x61-0x7A*0x03B1-0x03C9,
 0x222B
 }

\setupcombofont{FiraMathScript}
 {%
 file:texgyrepagella-math.otf:mode=base;script=math;language=DFLT;+ssty=0 at #1pt,
 file:firasans-regular.otf at #1pt,
 file:firasans-regularitalic.otf at #1pt,
 file:texgyredejavu-math.otf at #1pt
 }
 {%
 {},
 0x30-0x39,
 0x61-0x7A*0x03B1-0x03C9,
 0x222B
 }

\setupcombofont{FiraMathScriptScript}
 {%
 file:texgyrepagella-math.otf:mode=base;script=math;language=DFLT;+ssty=1 at #1pt,
 file:firasans-semibold.otf at #1pt,
 file:firasans-semibolditalic.otf at #1pt,
 file:texgyredejavu-math.otf at #1pt
 }
 {%
 {},
 0x30-0x39,
 0x61-0x7A*0x03B1-0x03C9,
 0x222B
 }

% Mathversion bold need Script and ScriptScript declarations too!
\setupcombofont{FiraMathBold}
 {%
 file:texgyrepagella-math.otf:mode=base;script=math;language=DFLT; at #1pt,
 file:firasans-regular.otf at #1pt,
 file:firasans-regularitalic.otf at #1pt,
 file:texgyredejavu-math.otf at #1pt
 }
 {%
 {},
 0x30-0x39,
 0x61-0x7A*0x03B1-0x03C9,
 0x222B
 }


\DeclareFontFamily{TU}{FiraMath}{}
\DeclareFontShape {TU}{FiraMath}{m}{n}
  {
    <-7> combo*FiraMathScriptScript
   <7-10>combo*FiraMathScript
   <10-> combo*FiraMath
  }{}

\DeclareFontShape {TU}{FiraMath}{bx}{n} {<->combo*FiraMathBold}{}

% better start with a real math font, so that
% unicode-math sets everything up
\setmathfont{TeX Gyre Pagella Math}%

% Perhaps some other symbol fonts will need setup too
\SetSymbolFont{operators}{normal}{TU}{FiraMath}{m}{n}
\SetSymbolFont{operators}{bold}{TU}{FiraMath}{bx}{n}


\begin{document}

\minisec{Test some symbols}

$\int f(x)^2$

\[\int f(x)^2 \]

\end{document}

enter image description here

  • What is wrong with the display style integral? (Just out of couriosity, I have no clue, what you are talking about) – Keks Dose Jul 3 '17 at 16:28
  • @KeksDose it has the circle arrow which should not be there – David Carlisle Jul 3 '17 at 16:33
  • @KeksDose it has a ring in (\oint?) instead of normal integral. – Ulrike Fischer Jul 3 '17 at 16:33
4

If you just use unicode-math with

% better start with a real math font, so that
% unicode-math sets everything up
\setmathfont{TeX Gyre Pagella Math}%

so remove all the combo font stuff, and add \showoutput you see

.....\l_fontspec_font ∫
....\glue(\thinmuskip) 1.82497
....\l_fontspec_font f

for the text style \int f but

.......\l_fontspec_font 󰠜
......\glue(\thinmuskip) 1.82497
......\l_fontspec_font f

for the display style where the first character is

  U+f081c Private Use f081c

So that is where the font tables you have imported have specified that the larger integral glyph is located. I'm not sure if it's best to try to amend the tables or just use the combo font declaration to put a larger integral sign in that slot.

  • It was a good tipp with the glyph number. It actually seems to work, if I simply extend the import range to include a part of the private area (0xF0800-0xF0900). It looks a bit like magic as the integral glyphs have different index positions, but probably the lookup is done by name (integral.v3). Now I need to find out how to get the exact import range -- and check extensible braces ... – Ulrike Fischer Jul 3 '17 at 21:49

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.