XITS - OpenType MATH enhanced STIX fonts

Khaled Hosny's picture

As you might now, the long awaited, 15+ years, version 1.0.0 of STIX fonts have been finally released. However, the release disappointed many people who want to typeset mathematics with STIX fonts, as they neither released LaTeX support files nor supplemented the fonts with the new OpenType MATH table, ruling out any quality mathematical typesetting engine.

Fortunately, STIX were kind enough to release the fonts under Open Font License, so giving the community the power to scratch their itch and not wait yet another 15 years for next release.

Having experimented with an OpenType MATH version of STIX beta release, it was relatively easy to supplement the final release with MATH layout features, thanks to the powerful FontForge who never let me down, and so XITS was officially born.

Despite being written in all caps, XITS in not an acronym but a funny way to get around the reserved name clause if OFL, which I never liked BTW, it also hints the long term goal to enhance it with right to left mathematical typesetting capabilities.

The font is still beta as regards the OpenType layout, any help or feedback is highly appreciated, especially testing with MS Office 2007 since I no longer have access to Windows machine and thus did all my testing on ConTeXt/LuaTeX.

After the poring introduction, here is the download link:
http://github.com/khaledhosny/xits-math/downloads

And here are some examples:

AttachmentSize
xits-specimen.pdf18.63 KB
philippe_g's picture

My computer came with a version installed and I can still use it, so I tried to reproduce your formulas. The extensible square roots are broken:

In the font menu, XITS Math appears very small (it's also the case for Asana Math, but not for Cambria Math, so there must be a way around it).

In the formula with P(x,y), the P is very close to the parenthesis; I tested with other letters like F and the problem is the same, but doesn't happen with letters like G so it seems the italic correction is not taken into account, as seen on the formula F_1^2:

In the first formula, when I tried to build it up with large delimiters everywhere, a strange result appeared:

Sizes of delimiters are better in Cambria:

or Asana:

Lastly, when I tried to make a PDF with PDFCreator, a PDF was produced, but it only contained, after a first page blank, the following error message:


ERROR: undefinedresource
OFFENDING COMMAND: findresource
STACK:
/ADBCFF+XITSMath
/CIDFont
/ADBCFF+XITSMath
[0 -1000 250 0 ]
2745

PDF production works with both Asana or Cambria, so it must be something in the XITS fonts which causes it.

I hope this helps you. It's good to see people working on math fonts.

Khaled Hosny's picture

The 1st issue is mysterious, I don't know what would be the possible cause of it, it doesn't show in either LuaTeX or XeTeX (both support OpenType MATH), can any one with more knowledge about Office implementation help tracking this down?

The 4th issue is related to this too, there is something wrong with glyph assembly but I cannot identify.

The 2nd issue results from the very large WinAscent/Descent values in the font, which is needed to avoid clipping large glyphs. Though the font have TypoAscent/Descent and fsSelection bit 7 set properly, they are ignored by office for reasons I don't know. Not sure what Cambria does, but it could be because of its embedded bitmaps that don't have any of the large glyphs.

The 3rd issue is due to lack of italic correction for the capitals, I'm already working on it.

The PDF issue is strange, could you try other PDF generators? it is like a bug in PDFCreator that got triggered by XITS.

Jens Kutilek's picture

The 2nd issue results from the very large WinAscent/Descent values in the font, which is needed to avoid clipping large glyphs. Though the font have TypoAscent/Descent and fsSelection bit 7 set properly, they are ignored by office for reasons I don't know.

The fsSelection bit 7 is only defined in OS/2 table version 4, but your xits-math font uses OS/2 table version 2.

Khaled Hosny's picture


The fsSelection bit 7 is only defined in OS/2 table version 4, but your xits-math font uses OS/2 table version 2.

Good catch, thanks. However this don't seem to make any difference, it seems that Office ignores this bit completely.

Now I got access to a machine with Office 2007 again, it seems that the only way to fix this is to bundle the math in regular fonts in a truetype collection file, like Cambria, but since Windows doesn't accept TTC with CFF, this isn't feasible.

ahyangyi's picture

Well, my problem is that XITS simply doesn't work in Word 2010.

Khaled Hosny's picture

Can you elaborate on how exactly it does not work, what you tried and failed etc. I don't have access to Word 2010 (is it even released?) so I never tested it.

ahyangyi's picture

I set the formula to XITS, but the formula remains unchanged in Cambria math. (just as if you change the formula into any other font)

Khaled Hosny's picture

Weird, are you sure you have the math font? the font name should be XITS Math not only XITS (as the later is the text font).

Khaled Hosny's picture

BTW, I uploaded a new release that should fix the aforementioned italic correction issue, available from the same link:
http://github.com/khaledhosny/xits-math/downloads

philippe_g's picture

@ahyangyi

If it’s the same as for Word 2007, once you have changed the math font in the Design Ribbon > Tools > Equation Options, you must open a new formula for the change to be in effect, the old formula stays as it was.

@Khaled Hosny

The italic correction now works.

Concerning the second issue, did you do everything mentioned in Murray Sargent’s High Fonts and Math Fonts post? Because it seems that the lines are too high at the top if I select XITS Math for text (that was with the latest 1.003 version):

Concerning the PDF issue, I've tried in OpenOffice to convert into PDF a blank document with only one letter in XITS Math (used as text font). It worked perfectly with OpenOffice’s integrated PDF capabilities, but gave the same error message as previously (except for the last line) when I tried PDFCreator.

Khaled Hosny's picture

Concerning the second issue, did you do everything mentioned in Murray Sargent’s High Fonts and Math Fonts post?

I did, this post with actually a repose to a question I sent to him. As I said earlier, I have set typoAscent/Descent and line gap to exactly the same values used in the text font, and set the use_typo_metrics bit, but as you see, Office still using the winAscent/Descent. Here, on Linux, the math font gives me proper line spacing with all GUI apps I tested (didn't test OpenOffice because I've old version with no support for CFF fonts), who is in fault here.

I don't know what is wrong with PDFCreator either, but what happens if you use the original STIX fonts?

Khaled Hosny's picture

I managed to fix the wired large composited symbols issue, it turned out that Office expects all vertical components in a composition to be setting on the baseline, however STIX glyphs usually descend below the base line, this results in vertical composites being offset in this strange way. TeX engine are forgiving about this (the glyphs are stacked based on their bounding boxes).

A new release will be uploaded soon.

philippe_g's picture

I’ve tested Cambria Math in OpenOffice 3 under Windows and Linux and it appears correctly in the font menu, but when you use it as a text font, it has the same problem as XITS Math has in Word (too high):

Concerning PDFCreator, using the original STIX fonts do indeed produce the same problem as using XITS or XITS Math.

Khaled Hosny's picture

The handling of font metrics is a complete mess on Windows, as far as my experience goes. On Linux, all applications/gui toolkit respect the typographic metrics, with OOo as the only exception.

ahyangyi's picture

@philippe_g

Thank you. I find it strange that I can't find XTIS and Asana in the default math font list, only Cambria Math and some of my test fonts. But if I change a glyph in a formula to XTIS math, I will be able to change the default to XTIS math. What a mess...

Lee Bruemmer's picture

I'm testing the current beta (1.004) in every bit of software I can, and so far I've only found a few problems.

First, the delimiter issue Philippe mentioned is likely caused by the lack of extendable floor/ceiling brackets—I noticed that, unlike Cambria and Asana, there's no entry for them in the Vertical Construction part of the MATH table, so they max out at the .size4 variant.

In ConTeXt/LuaTeX, using \vec with Greek letters causes the arrow to be offset to the left, possibly because none of the italic Greek math letters have Top Accent values. This isn't an issue in XeLaTeX (using unicode-math) or Word 2007.

There's also a problem with \vec and some Greek and Latin lowercase italic math letters in XeLaTeX (d,f,m,w,κ,μ,π,σ,φ (both forms),χ,ψ and ω; I haven't tested non-italic or uppercase letters yet) where adding an exponent or prime outside the \vec command causes the arrow to both drop closer to the letter and lengthen, colliding with the exponent. This may actually be a unicode-math or XeTeX bug.

Khaled Hosny's picture

The delimiter issue can be easily fixed, I actually didn't get Philippe's issue until just now, for some reason I didn't see the text between the screenshots and though he was talking about something else. This is now fixed in git, no release yet.

The \vec issue is now fixed too, almost. I added top accent position to Greek, except bold upright, it is a boring job :)

The XeLaTeX issue is known, it has been reported to Jonathan Kew while ago, but I don't think it is going to be fixed any time soon. In my experience, LuaTeX has much better OpenType MATH support, but unicode-math package has incomplete LuaTeX support, so my recommondation for OpenType math in TeX is to use ConTeXt MkIV until LaTeX gets better LuaTeX support.

Khaled Hosny's picture

I just uploaded a new beta (1.005), in the downoad area as usual. This fixes the accents for math serif Greek, adds composed floor and ceiling, plus few other fixes and new glyphs, check FONTLOG file for more details.

This beta is packaged as a ZIP instead of BZIP2 TAR archive as the previous one, since tar and bzip2 aren't available on all systems by default.

philippe_g's picture

Since the last time, I’ve tested a little more the XITS font. The floor and ceil delimiter issue is better than in the previous version but does not seem to have been completely fixed:

Does the same happen when using XITS in ConTeXt? Using LaTeX, I’ve compared to how other fonts behave, and some have the same problems, like txfonts:

and some others don’t, like Computer Modern:

I suppose it’s due to relative heights of math delimiters, which are not always the same as Computer Modern, so the problem might not be fixable without redesigning the large delimiters.

Another problem, which has not changed since version 1.004 is a few italic correction and sub/supscript kerning issues. The main problem is with Blackboard bold symbols, some of which lack italic correction; the A also lacks negative kerning for the exponent:

I’ve marked the L with a “?” because it might not be a good idea for this character to add negative exponent kerning (I know it’s been done with Times 569 4-line Mathematics, but it was for an italic L).

Most of the mathcal letters would also benefit from having italic correction:

Finally, some of the upright capital letters (in all forms: roman/italic, medium/bold, serif/sans, latin/greek/nabla) would benefit from italic correction or exponent kerning:

Finally, I've installed the unicode-math package under MikTeX 2.8 to try XITS Math in XeLaTeX and noticed that many symbols don’t come up correctly:

Do you have any idea where this is coming from? (There’s no problem with Cambria Math or Asana Math.)

Khaled Hosny's picture

The remaining floor and ceiling delimiters issue is a bit trickier, I may try to give it a look later, but it is a low priority now.

Intermingled symbols with XeTeX are likely to be caused by presence of more than on version of the font accessible to XeTeX (e.g. one system wide copy and one installed in TEXMF tree), make sure you have only one version of the font (or identical copies), having different version of same font installed is known to lead to such issue in XeTeX.

The script alphabet is a bit trickier, the glyphs are spaced as italics, so the width of the glyph equals the width of the bounding box, that is why subscripts are so far. Here italic correction will not help, we instead need to use math kerning support in OpenType math, but I'm unlikely to do this for the first "stable" version (no much time for math fonts right now). The need for math kerning is also true for the upright alphabets. The double struck alphabet can benefit from some italic correction too, I think I can do that, but not the finer math kerning.

philippe_g's picture

I’ve managed to solve my XeLaTeX issue. In fact, Windows Vista keeps a copy of the fonts each time you install a new version, and the last one is not necessarily the one with the right name. I had to manually delete each unnecessary copy from a console in administrator mode (after a system restart because some were locked for whatever reasons).

What I was talking about with italic correction of the script alphabet is to change the right sidebearing of the letters in question to be able to use italic correction to position the sub and supscript. I don’t know if this would have any side-effects, but I was suggesting it because that’s the standard practice for the script letters.

Now that I can use XeLaTeX to test to the fonts, I’ve done more tests and noticed a few more glitches: the fraction rule does not seem to be of the appropriate thickness, although it seems to be working in ConTeXt if I judge by your specimen.

The problem happens with all opentype math fonts (Asana, Cambria, XITS) but not with normal math fonts (txfonts, mathdesign, etc.). Is this a known problem in XeTeX?

Another thing which I noticed is that the delimiter | is far too small when used in a formula like $|\{x\in\mathbb{Q}\mid x^2<2\}|$:

The problem does not appear with Cambria or Asana.

Also, the italic correction you added to the P does not seem to work with XeLaTeX:

Khaled Hosny's picture


I’ve managed to solve my XeLaTeX issue. In fact, Windows Vista keeps a copy of the fonts each time you install a new version, and the last one is not necessarily the one with the right name. I had to manually delete each unnecessary copy from a console in administrator mode (after a system restart because some were locked for whatever reasons).

On Windows (I had only access to XP machines) I always delete the old version before installing the new one, else I always get the old version.


What I was talking about with italic correction of the script alphabet is to change the right sidebearing of the letters in question to be able to use italic correction to position the sub and supscript. I don’t know if this would have any side-effects, but I was suggesting it because that’s the standard practice for the script letters.

I thought about this too, but I tend not to change STIX glyph metrics unless there is a good reason, and here I'm not sure what the implications of changing the advance width on spacing and it would need more extensive testing. Math kerning can solve the sub/superscript issue without the need to change the advance width, and we need it anyway to fine tone the positioning of many base/*script combinations, but it has to wait.


Now that I can use XeLaTeX to test to the fonts, I’ve done more tests and noticed a few more glitches: the fraction rule does not seem to be of the appropriate thickness, although it seems to be working in ConTeXt if I judge by your specimen.

The problem happens with all opentype math fonts (Asana, Cambria, XITS) but not with normal math fonts (txfonts, mathdesign, etc.). Is this a known problem in XeTeX?

I didn't know about it before, but seems that XeTeX ignores FractionRuleThickness math constant, LuaTeX (either with LaTeX+unicode-math or ConTeXt works fine).


Another thing which I noticed is that the delimiter | is far too small when used in a formula like $|\{x\in\mathbb{Q}\mid x^2<2\}|$:

The problem does not appear with Cambria or Asana.

This is because, unlike Cambria and Asana, the default bar glyph is short (it doesn't descend below base line the same degree as the curly brackets. Adding explicit \left and \right will give the proper sizes (it is good idea to always do this anyway), $\left|\{x\in\mathbb{Q}\mid x^2<2\}\right|$.


Also, the italic correction you added to the P does not seem to work with XeLaTeX:

Looks like a XeTeX issue too, fine with LuaTeX.

philippe_g's picture

On Windows (I had only access to XP machines) I always delete the old version before installing the new one, else I always get the old version.

Thanks, I’ll try to do that the in the future.

This is because, unlike Cambria and Asana, the default bar glyph is short (it doesn't descend below base line the same degree as the curly brackets. Adding explicit \left and \right will give the proper sizes (it is good idea to always do this anyway), $\left|\{x\in\mathbb{Q}\mid x^2<2\}\right|$.

When doing inline math, you often don’t want to use \left and \right as they often produce delimiters which are too high:


These too high delimiters are not very pretty and they may also disrupt inter-line spacing (it’s not the case here). Of course, you can always \smash the ^2, but it’s a bit tedious. And you still have the problem when you use the vertical bar to denote a restriction:

I suppose something can be done at macro level (I'll have to look up the code of unicode-math), but if in the future you decide to change some glyphs in XITS, this one would be a good candidate.

Khaled Hosny's picture

I generally agree with you, it looks odd in general, I usually assume STIX project took maximum care in designing each glyph, but the more I work on it the more I feel it might not be always the case, so I'm adding this to the list of to be considered glyphs.

Khaled Hosny's picture

I uploaded 1.006 which should fix the bar issue and the sscripts with double struck letters, more final sscript tuning in the future. I'm going to upload it to CTAN, so it goes to TeXLive 2010 before it is frozen. Let me know if there are any other issues.

Khaled Hosny's picture

I finally managed to fix the PDFCreater issue, it was caused by erroneous OS/2 code pages being set in the original STIX fonts (code pages for which the fonts include no characters), thanks to this STIX bug report. The files on git now print OK with PDFCreater and should be available in 1.009 (next) release.

Motfis's picture

Hi, I have a problem with XITS font. I use Microsoft word (both 2007 and 2010), and when I tried to export to pdf using its built-in add-ins, some characters in the equation are missing, such as integral, rackets, etc. The problem does not appear with Cambria or Asana font.

Syndicate content Syndicate content