Old-style (lowercase) numerals

Is it possible to use old-style (i.e. lowercase) numerals in TeXmacs? These should be available in at least the Tex Gyre fonts, but I’m not seeing any way to use them.

Thanks.

PS: Again, sorry for the endless questions. Hopefully this will be useful to someone else too.

Unfortunately, not. We still do not have enough OpenType font handling code to select variants. But I agree this would be a nice feature. There should be some way to manually create a new font where numerals are substituted, but I need to investigate how to do it.
One would have to check where old style figures are placed within the font and then instruct TeXmacs to use this glyphs for numbers.

1 Like

If I recall, LaTeX supports old style numerals without OTF.

This is relatively easy to do with Fontforge, and I’m assuming this new font (e.g. Pagella-onum) can be imported to Texmacs easily. However, I don’t know how to instruct TeXmacs to automatically use it when typing numbers in text, but not anywhere else.

Yes, this is what I meant. I guess if you put the font somewhere where TeXmacs can find it, then you can select it as a regular font.

I guess LaTeX remap the numerals to the correct glyphs (on a font per font basis). This should be possible also in TeXmacs, as I said. Maybe it is enough to define and select an alternative encoding (see $TEXMACS_PATH/fonts/enc).

I’ve spend few minutes to try to undestand how the encondings can be used. It seems to me that they are used in compound_font_rep to remap certain characters to glyphs belonging to different fonts. These compound fonts are defined by rules like those in $TEXMACS_PATH/progs/fonts/fonts-composite.scm. Instantiated via a call to compound_font (in src/Graphics/fonts/compound_font.cpp) from find_font_bis (in src/Graphics/fonts/find_font.cpp) which match the (compound ....) rule declaration. The rule format seems to be

(compound ((enc1 font1) (enc2 font2) ... (any fontDefault)))

where encX is an encoding in $TEXMACS_PATH/fonts/enc and fontX is a font specifier (which maybe should be translated recursively via another rule). fontDefault seems the default font to use. See e.g. $TEXMACS_PATH/progs/fonts/fonts-truetype.scm for the specifiers of truetype/opentype fonts which have tag (unicode ....).

So by putting these building blocks together and hardcoding the position of the old-style glyphs it seems possible to have a package which select old-style glyphs for some of the standard fonts. Would be cool to have it.

1 Like

I’m not sure I completely understand, but I’ll look around the source code to see if it makes more sense.

I’ve tried to do it, but apart from the the encoding mechanism does not work anymore since Joris implemented a new font mechanism. Only way to do it right now is to create a new font with the features selected and then use it for text. One can select a separate font for mathematics so the have regular digits.