stipub / stixfonts

OpenType Unicode fonts for Scientific, Technical, and Mathematical texts
SIL Open Font License 1.1
706 stars 41 forks source link

Different thickness between STIX2Math and STIX2-Regular fonts. #162

Closed grivasgervilla closed 4 years ago

grivasgervilla commented 4 years ago

Hi, first of all, I want to congratulate you on this fantastic font which I will use in my PhD thesis. I think that it is one of the best options in the LaTeX environment, and I hope that this project continues to evolve :smile:.

I think that I have found something that can be improved in the STIX2Math font, and it is about the thickness of the font.

In LaTeX with a normalsize font the thickness of the STIX2Regular and STIX2Math is the same or unless very similar, as can be seen in the following snapshot (the isolated h is written with STIX2Math, and the rest with STIX2-Regular):

image

However, when we use smaller font size, like in the following subscript, the thickness of STIX2Math font is greater than the thickness of the STIX2-Regular font:

image

In the following snapshot we can see both new $h$ property versions zooming out:

image

I do not know whether this is only a visual effect and it cannot be improved, or not. So I want to apologise in advance for any inconvenience this issue could cause you.

Many thanks for your time. Best regards.

dbenjaminmiller commented 4 years ago

There is a new version of STIX forthcoming which will be a variable font which maybe will fix this issue too. It was supposed to come in Q1 2020 so I guess it's coming soon.

tiroj commented 4 years ago

What appears to be happening in the illustration is that the italic h is being displayed using the ssty variant. The strokes are heavier, the x-height is taller, and the spacing is looser. These are design optimisations to improve the texture and legibility of characters when used at smaller sizes in superscript and subscript positions. The STIX Two Math font contains sets of ssty and ssty2 variants for common characters that appear in superscript and subscript (in the upcoming 2.1.0 release, these sets are greatly extended, based on frequency data from AMS and other STI Pub members).

It looks like what is happening here is that the positioning of the text ‘new ℎ property’ below the double arrow is triggering the ssty layout feature for that character. I am not sure why it isn't also using the ssty variants for the roman letters in ‘new’ and ‘property’. These definitely have ssty variants in the font, so the decision when or when not to apply the ssty variant is something LaTeX is doing.

tiroj commented 4 years ago

@dbenjaminmiller The upcoming variable build of the STIX fonts will only be for the Text family, which will be available in two variable fonts—roman and italic—with a weight axis. The Math font will remain a stand-alone font. At present, the MATH table and math-specific layout are not included in the OpenType variations technology. There has been some talk of using the variations model at the glyph level to enable finer tuning of growing forms and super-/subscript forms, but this has not been formally specified or implemented yet.

davidmjones commented 4 years ago

By default, unicode-math assumes that anything between 7 and 10pt is a math subscript, and applies the MathScript (ssty1) font feature; anything below 7pt is assumed to be a second order script and gets the MathScriptScript (ssty2) feature. Unfortunately, at some font sizes, that means that, for example, \footnotesize triggers the use of the script variants in math mode. You can tweak when the cutover takes place as follows:

    \setmathfont{STIX Two Math}[
        % CharacterVariant=3,
        SizeFeatures={
            {Size=8-},
            {Size=6-8,Font=STIX Two Math,Style=MathScript},
            {Size= -6,Font=STIX Two Math,Style=MathScriptScript}
        }]

Those numbers have worked well for us, but you might need to tweak them further for your purposes.

grivasgervilla commented 4 years ago

@tiroj I think that maybe the use of the \text command for write text-like in math environment is what is causing that the ssty variant is not used in the 'new' and 'property'. I use the command text because I want the text, in this case, to looks like normal text, and not the italic style of the roman STIX2Math alphabet. I am trying to preserve the italic format to math notation, to make it easier to distinguish inline math from the text. This is the LaTeX code that I use for this formula, in case it can help:

$\underset{\text{new } h \text{ property}}{\iff}$

In any case, many thanks for your response (as well as the @dbenjaminmiller response), I am happy to hear that this awesome font project keeps evolving. In case, that the previous code has nothing to do with this issue, feel free for closing the issue. I am looking forwards to see the new STIX2 font version. Regards.

grivasgervilla commented 4 years ago

@davidmjones I will try this and let you know the result. Many thanks.

grivasgervilla commented 4 years ago

@davidmjones I think that this have worked like a charm:

image

These are my numbers to achive this result:

\setmathfont{STIX2Math.otf}[
        SizeFeatures={
            {Size=6-},
            {Size=5-6,Font=STIX2Math.otf,Style=MathScript},
            {Size= -5,Font=STIX2Math.otf,Style=MathScriptScript}
        }]

Many thanks for your help and for this project. I am closing the issue. Regards.