denis.maier@unibe.ch schrieb am 23.06.2021 um 11:05:
Hi,
Am 23.06.2021 um 08:43 schrieb Henning Hraban Ramm
: Am 23.06.2021 um 00:17 schrieb denis.maier@unibe.ch:
Hi In my current project I need to use different variants if the Noto Serif font (Regular, Medium, Semi Condensed Bold, Regular ExtraBold.) Is my understanding of typescripts correct that I cannot have bold and extrabold in the same typescript? And that I need a typescript for regular and one for the semicondensed variants? You can combine whatever you like in one typescript, but you’re restricted to six styles (regular, italic, slanted, bold, bold italic, bold slanted). You can just “abuse” the italic or slanted styles for your other weights.
... or use roman styles, if you don’t need roman. Thanks for your help. After playing a bit more with the different variants for loading fonts it looks like I don't even need to use typescripts. \definefontfamily works just as good:
\definefontfamily[mainface][rm][Noto Serif] \definefontfamily[mainface-semicond][rm][Noto Serif] [tf=file:NotoSerif-SemiCondensed.ttf, it=file:NotoSerif-SemiCondensedItalic.ttf, bf=file:NotoSerif-SemiCondensedBold.ttf, bi=file:NotoSerif-SemiCondensedBoldItalic.ttf]
But, do typescripts have any advantages over that approach?
Even when you use \definefontfamily the internal font handling relies on the typescripts. The advantage of hand written (or generated) typescripts is better reliability, most of the time you pass just a name to \definefontfamily and some font is chosen for each style but this can fail because all depends on the information in the font files. When you use a typescript each alternative is associated with a certain font file and almost no guess work is required.
Then, for fonts used only in specific contexts, you can also do something like
\definefont [TitleFont] [notoserifsemicondensedextrabold] and use that with \TitleFont But you will then also need \TitleMonoFont etc, whereas it seems easier to keep things consistent with \definefontfamily...
One thing I'm wondering about: Would it be possible to add a easy mechanism to switch to different variants of a font, say, to use the SemiCondensed variant or the ExtraCondensed or so? (Or does that already exist?) And, what about adding more styles so that you could have Light, Medium, SemiBold, Bold, ExtraBold, Black etc. all defined in a single fontfamily? If that was available each font family would then define all the styles for one variant (SemiCondensed, ExtraCondensed, Condensed, each with 18 styles!)
You can add more alternatives (\it, \bf ...) to the font mechanism but this requires additional settings (\definebodyfont ...) to get it working. A limiting factor is that you have to stick to two-letter names for each alternative and the easier solution is to create additional typefaces. Wolfgang