fontspec icon indicating copy to clipboard operation
fontspec copied to clipboard

Wishlist item: provide a way to fake small caps

Open callegar opened this issue 6 years ago • 2 comments

Description

In regular latex, the virtual font mechanism enables provision of small caps even with fonts missing such a feature (e.g., the ptm font, that is URW++ Nimbus roman No 9 L). I wonder if using fontspec a similar result can be obtained using font substitution rules. I have not found anything similar in the fonts-in-luatex discussion.

Being able to fake small caps would be useful when transitioning from latex/pdflatex to lualatex with fontspec.

Such a transition is appealing since it makes it possible to use unicode in text including (for instance) Greek letters without resorting to ugly hacks such as switching fonts with textgreek, or - even worse - switching to math mode to get Greek symbols. However, it is hard to switch to it if you cannot maintain some required visual appearance for your document.

As an example, suppose that you had a pdflatex document using ptm (Nimbus Roman). What you would like to do is to move to lualatex and fontspec, using Nimbus Roman No 9 L as the main font. However this does not provide small caps. Unfortunately:

  • Switching to the Microsoft "Times New Roman" from the semi-free msttcorefonts is not an option, because it also misses small caps;

  • Switching to TeX Gyre Termes is also not an option because the small caps are too visually different from what pdflatex and ptm provide for small caps (the "small" capitals are very short). Furthermore, TeX Gyre Termes has Greek capital letters that look not very well matched to each other (e.g., with respect to the Microsoft "Times New Roman").

  • Switching to Stix Two Text, provides small caps that are more visually consistent to those provided by pdflatex and ptm, but the metrics of Stix Two Text are not compatible with those of Nimbus Roman and Times New Roman (in fact rather different).

In other words, having a way to do what pdflatex used to do with the Nimbus Roman Font with respect to small caps (i.e., virtualize it) would be the ideal solution until some free Times New Roman substitute appears with proper small caps support (e.g. when TeX Gyre Termes matures a bit more).

Check/indicate

  • [ ] Relevant for XeTeX
  • [X] Relevant for LuaTeX
  • [X] Issue tracker has been searched for similar issues?
  • [ ] Links to <tex.stackexchange.com> discussion if appropriate

callegar avatar Aug 10 '19 23:08 callegar

Just in case anyone else is reading — note this should be possible in LuaTeX but not in XeTeX. I’m not sure if this should be part of fontspec directly or perhaps a companion package that also provides high level interfaces to adjust kerning between glyphs, more control of ligatures, and so on. Unfortunately it’s not something I have bandwidth for right now.

wspr avatar Aug 12 '19 02:08 wspr

Initially, I got the impression that something like this could have been achievable with combo fonts, by mixing a font with a version of itself with glyphs pulled to different positions and scaled (i.e. scaled down capital letters in place of small letters), because the combofont package documentation explicitly mentions "Pulling glyphs in other positions" as something to investigate at the end of its manual. Unfortunately, asking for clarification on this aspect this does not seem to be currently possible, nor to attract any interest as a wish list item for that package (https://github.com/u-fischer/combofont/issues/1).

Thus, I'd like to inquire on whether:

  • there are ways in fontspec to replace an unicode character with a command (in the lines of \DeclareUnicodeCharacter) at the font encoding level (i.e., similarly to what is being done in Part V of the manual). This could work to fake small caps (but would likely loose all kerning information, I believe).

  • there is some concept of "virtual font" in fontspec (as this could also be functional to providing small caps) or this is something to be handled at a lower level.

As a motivation for faking SC, I'd like to mention the fact that most "modern" non commercial fonts still lack SC, so one perceives a regression when moving to use them via fontspec wrt to using them in the traditional way (e.g., in pdflatex I can get SC with Nimbus Roman). Furthermore, even when they offer SC, it is anyway often a fake one (e.g., TeX Gyre provide "mechanical" SC obtained by automatically scaling capital letters and fitting them in the appropriate font slots).

Is it appropriate to ask here? Should I move the inquires about faking SC with fontspec elsewhere?

callegar avatar Aug 12 '19 14:08 callegar