alerque / libertinus

The Libertinus font family
Other
927 stars 57 forks source link

f and 5 (almost) colliding #535

Open juhaszp95 opened 1 year ago

juhaszp95 commented 1 year ago

The bug The letter 'f' and number '5' almost collide (in Libertinus Serif). (This is problematic when e.g. links have these next to each other.)

Steps to reproduce MWE (in LuaLaTeX):

\documentclass[12pt]{article}
\usepackage{libertinus-otf}

\begin{document}
    f5
\end{document}

Screenshot Output of the MWE: image

hvoss49 commented 1 year ago

That is the correct behaviour. If you do not like it, then change the kerning. For xelatex with a feature file and for lualatex with:

\documentclass{article}
\setlength\parindent{0pt}
\usepackage{fontspec}
\directlua {
    fonts.handlers.otf.addfeature {
        name = "f5kern",
        type = "kern",
        data = {
            ["f"]   = { ["5"] =  100 },
            ["f_f"] = { ["5"] =  100 },
        },
    }
}
\usepackage{libertinus-otf}

\begin{document}\Huge   
f5 ff5

\addfontfeature{RawFeature=+f5kern}f5 ff5
\end{document}
Bildschirmfoto 2023-04-23 um 07 48 30
juhaszp95 commented 1 year ago

Well, I guess that's a matter of taste. This solution almost works for me! But when I'm loading libertinus-otf with the [proportional] option (which I use by default), this stops working - do you have any guess how to make this work for the "proportional 5"? (I've looked at the fontspec documentation, but without any luck.)

georgd commented 1 year ago

The proportional figures are suffixed with .fitted in this font, so the proportional 5 is named five.fitted. The number glyphs in fonts are generally written out so I assume that writing 5 in the addfeature code is a convenience shortcut. It would be interesting if 5.fitted would work, too.

juhaszp95 commented 1 year ago

Many thanks, this solves my problem! five.fitted worked, but 5.fitted didn't, in case anyone's wondering.

pancaek commented 1 year ago

Sorry to pop in with a comment so long after the main convo, but I haven't been successful in doing this adjustment with xelatex. Can you explain how to use these feature files? It's my first time hearing of them, and the fontspec docs didn't really make sense to me for this particular use.