#Choosing a text.lang results in incorrect glyphs being picked for an OT font

44 messages · Page 1 of 1 (latest)

quasi ridge
#

Pardon the terrible title — suggestions welcome.

I have the following code:

#{
    set text(font: "Equity OT B")
    smallcaps[kiść]
    linebreak()
    set text(lang: "pl", font: "Equity OT B")
    smallcaps[kiść]
}

As you can see, I am writing the Polish word "kiść" twice. Once with text.lang unset, then set to "pl".

The problem is that it results in different outputs:

#

I am using Matthew Butterick's Equity, which does support c2sc OT feature. It also comes with a TTF file for Equity B Caps. When using it, it produces the correct result (even with lang: "pl").

I can't share the font file due to its license, but I would love to test other fonts with c2sc support to check whether that's a font or a Typst problem. Unfortunately, searching for a font based on its OT features is proving to be quite challenging.

I have workarounds (e.g., using a different font file), but I'd love to delve deeper into this issue and discover the root of the problem, which I could later use as a suggestion to improve either Typst or the font

radiant chasm
#

tried with:
adobe clean, jenson pro, arno, ysabea, besley etc.

can't replicate your error

#

might be specific to your font

tulip flame
#

Did you try the same font in other apps @quasi ridge ?

#

My guess would be a font issue

#

I seem to recall the font author using typst, so I would ask him

quasi ridge
quasi ridge
tulip flame
quasi ridge
tulip flame
quasi ridge
tulip flame
#

I'm fairly sure lualatex with fontspec should support that feature, but you said you didn't want to use tex

quasi ridge
#

The problem with TeX is that I wouldn't be too sure how I can replicate Typst's version as identically as possible

radiant chasm
#

The key thing I can establish that this isn't Typst issue, as I've tested with both paid and free fonts with c2sc baked into the GSUB table, that they all work

#

so then the problem must lie in the font being used

#

i.e. contact MB

#

you're a paying customer, so it's not unreasonable to request such bug fixes

tulip flame
radiant chasm
#

which we can't surmise

#

if multiple other fonts with c2sc works as expected on typst but not for this one, then is it still typst issue or is it the font's issue

#

what we can't test however is the font of interest, obviously

#

no diagnostic information from fontforge was provided either so we can only make wild guesses

quasi ridge
#

The error doesn't seem to manifest with LuaLaTeX

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,polish]{babel}
\usepackage{fontspec} 
\setmainfont{EquityOTB-Regular.otf}

\begin{document}

\selectlanguage{english}

KIŚĆ \textsc{kiść} KIŚĆ\\
\selectlanguage{polish}
KIŚĆ \textsc{kiść} KIŚĆ

\end{document}
#

@tulip flame @radiant chasm is there a chance you would have more suggestions concerning how could I test it further to pinpoint the issue?

tulip flame
tulip flame
#

To answer your question, I don't really know enough. I would've asked the font author a long time ago...

quasi ridge
#

I see, most likely this will be the way to go.

Is there any other typesetting environment that uses OT features for smallcaps with which I can test it? Because if it turns out that it works for it + TeX, and doesn't for Typst, this will suggest the latter being the culprit

#

(I don't believe MS Word uses OT feature for smallcaps, so I am not counting it)

quasi ridge
#

All right, I think I found something.

I recalled that I have first installed the "regular" fonts, and only afterwards I have installed the OT ones. Seems like this confused Typst while under particular configuration. I removed all my fonts from MB and installed just the OT ones — everything seems to work fine now.

I don't suppose this should be considered a bug, right? Too minor, I believe. Nonetheless, I did specify the OT family every time.

||However, MB, in his readme, states that:

You can install the OT family alongside the ordinary families. They won’t conflict with each other and show up separately in your Font menu.
which, apparently, seems to be sometimes incorrect||

radiant chasm
quasi ridge
#

I have no clue how come it's still happening, but the problem returned (somehow)...

I have contacted Matthew Butterick (font author) about this. Will post updates if there will be any

quasi ridge
#

All right, this is going to be fun. It is moments like this when I regret I don't have a blog.

The problem was multi-dimensional. First of all, I noticed that when using smallcaps in Typst, Polish letters with kreska (e.g.,ó, ś, ć) are inappropriately rendered / synthesized / had incorrect glyph mapping.

They just looked scaled-down in a very peculiar way.

The strangest thing was that it didn't look as bad when I was not using lang: "pl". It seemed like choosing to use Polish settings caused the very Polish words to be rendered weirdly.

I checked against TeX (LuaLaTeX) with the same font (MB Type fonts library) and it didn't look bad. At first, it looked correct.

But it wasn't.

Turns out Polish kreska is not the same as acute accent. It has different typographical guidelines. I did not know that, despite being a native Polish speaker for almost three decades.

MB Type wanted to accommodate those typographical guidelines. It had rules for Polish glyphs. But it had a bug where they would render incorrectly.

Not being aware of the difference in rendering between kreska and acute, I assumed that the consistent output of TeX meant it was a Typst problem. It turns out that is not the case. Typst does the correct thing. TeX does not. TeX, even with \usepackage[english,polish]{babel} and \selectlanguage{polish}, does not use the (now fixed) correct glyphs.

I contacted Matthew Butterick (author of MB Type library) and after getting to the root cause, he updated his entire library, which now behaves correctly with Typst.

But it does not behave correctly with TeX.

I wonder if I am using it incorrectly, or is Typst simply superior in this regard.

Below I attach two screenshots. Pay attention to the accent above Ś and Ć in the first row compared to the rest of them. I also attach TeX and Typst code:

#
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,polish]{babel}
\usepackage{fontspec} 
\usepackage{amsmath}
\setmainfont{EquityOTB-Regular.otf}

\begin{document}

\LaTeX

\medskip

\selectlanguage{polish}

\textsc{kiść} KIŚĆ

\selectlanguage{english}
 
\textsc{kiść} KIŚĆ

\selectlanguage{german}

\textsc{kiść} KIŚĆ

\selectlanguage{spanish}
 
\textsc{kiść} KIŚĆ

\end{document}
#
#set text(size: 48pt, font: "Equity OT B")

Typst

#set text(lang: "pl")
#smallcaps[kiść] KIŚĆ
#linebreak()
#set text(lang: "en")
#smallcaps[kiść] KIŚĆ
#linebreak()
#set text(lang: "de")
#smallcaps[kiść] KIŚĆ
#linebreak()
#set text(lang: "sp")
#smallcaps[kiść] KIŚĆ
#

TL;DR: Font had a bug, learnt something new about proper typographical guidelines about my language, Typst seem to support broader range of language-level customization (or I don't know how to properly enable it in TeX)

gleaming maple
#

I'm relieved Typst does it right :D
sounds like a super interesting rabbit hole you stumbled into; hope it wasn't too annoying though 😖

quasi ridge
#

Nah, it was quite fun :>

gleaming maple
#

glad to hear that! excited

#

and glad you have this working now :)

quasi ridge
#

Yup yup, It's actually a second thing that I have learnt about my language thanks to Typst or Typst-relatek work