Greetings, I have been trying to make font feature sets that allow me to write abbreviations in small caps and corporate entity/product/etc names with small caps replacing regular ones. I have run into an issue where c2sc works as intended on some fonts and not in others. No idea what that's about. MWE: %\definefontfeature [default] [default] [script=latin] \definefontfeature [default] [default] [script=cyrillic] \definefontfeature [capstosc] [c2sc=yes] \definefontfeature [smallcaps] [cpsp=yes, smcp=yes, lowercasing=yes] \setupbodyfont[stix] %\setupbodyfont[newcomputermodern-book] \starttext {\language[ru]Моя любимая {\feature[+][smallcaps]ОС}---{\feature[+][capstosc]Линукс}.}\crlf {\language[en]My favourite {\feature[+][smallcaps]OS} is {\feature[+][capstosc]Linux}.} \stoptext With STIX Two, c2sc (and smcp) works with any language as long as one doesn't select a script in the font features, else it only works with the chosen script. With New Computer Modern, it just doesn't work with any latin text no matter the script chosen. That is, plain small caps work, caps to small caps don't. What could be the reason to it? Is there anything I could do to mitigate it? Kirill
On 6/24/2024 6:03 PM, Kirill Davidov wrote:
Greetings,
I have been trying to make font feature sets that allow me to write abbreviations in small caps and corporate entity/product/etc names with small caps replacing regular ones. I have run into an issue where c2sc works as intended on some fonts and not in others. No idea what that's about. MWE:
%\definefontfeature [default] [default] [script=latin] \definefontfeature [default] [default] [script=cyrillic] \definefontfeature [capstosc] [c2sc=yes] \definefontfeature [smallcaps] [cpsp=yes, smcp=yes, lowercasing=yes]
\setupbodyfont[stix] %\setupbodyfont[newcomputermodern-book]
\starttext
{\language[ru]Моя любимая {\feature[+][smallcaps]ОС}---{\feature[+][capstosc]Линукс}.}\crlf {\language[en]My favourite {\feature[+][smallcaps]OS} is {\feature[+][capstosc]Linux}.}
\stoptext
With STIX Two, c2sc (and smcp) works with any language as long as one doesn't select a script in the font features, else it only works with the chosen script. With New Computer Modern, it just doesn't work with any latin text no matter the script chosen. That is, plain small caps work, caps to small caps don't. What could be the reason to it? Is there anything I could do to mitigate it? you can try
\definefontfeature [capstosc] [c2sc=always] Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On 6/24/24 18:03, Kirill Davidov wrote:
With STIX Two, c2sc (and smcp) works with any language as long as one doesn't select a script in the font features, else it only works with the chosen script.
Hi Kirill, \definefontfeature [default] [default] [script=auto] may help there.
With New Computer Modern, it just doesn't work with any latin text no matter the script chosen. I have tested https://mirrors.ctan.org/fonts/newcomputermodern/otf/NewCM10-Book.otf (released less than 10 days ago) and there is no c2sc for the Latin script.
I have used FontForge and tested metrics (Metrics > New Metrics Window [Ctrl+K on my computer]).
That is, plain small caps work, caps to small caps don't. I’m afraid to say that the c2sc in the font seems to be a mess (to me at least).
What could be the reason to it? Is there anything I could do to mitigate it?
The following sample works for me (excluding Greek glyphs). script=auto, if you need to set the script (automatically). c2sc=always, if you need Greek c2sc. lowercasing=yes, since the smcp feature works for Latin glyphs. In a minimal sample: \definefontfeature [default] [default] [script=auto] \definefontfeature[allsc][c2sc=yes, smcp=yes, lowercasing=yes] \setupbodyfont[stix] \starttext \startbuffer {\language[ru]Моя любимая {\feature[+][allsc]ОС}---{\feature[+][allsc]Линукс}.}\crlf {\language[en]My favourite {\feature[+][allsc]OS} is {\feature[+][allsc]Linux}.} {\feature[+][allsc]Λινυξẞ.} \stopbuffer \getbuffer \setupbodyfont[newcomputermodern-book] \getbuffer \stoptext
Yeah, I too checked it out of curiosity today, and yeah, the c2sc table doesn't have the Latin entries. I suppose I will stick to a different styling or go after the caps manually/with Lua. The "always" and "auto" values help too, so thanks to you both! Kirill
On 6/25/24 19:53, Kirill Davidov wrote:
Yeah, I too checked it out of curiosity today, and yeah, the c2sc table doesn't have the Latin entries. I suppose I will stick to a different styling or go after the caps manually/with Lua. The "always" and "auto" values help too, so thanks to you both!
Hi Kirill, this font feature may work too: \startluacode fonts.handlers.otf.addfeature { name = "addedsc", type = "substitution", data = { A = "A.sc", B = "B.sc", C = "C.sc", D = "D.sc", E = "E.sc", F = "F.sc", G = "G.sc", H = "H.sc", I = "I.sc", J = "J.sc", K = "K.sc", L = "L.sc", M = "M.sc", N = "N.sc", O = "O.sc", P = "P.sc", Q = "Q.sc", R = "R.sc", S = "S.sc", T = "T.sc", U = "U.sc", V = "V.sc", W = "W.sc", X = "X.sc", Y = "Y.sc", Z = "Z.sc", }, } \stopluacode \definefontfeature[allsc][c2sc=yes, smcp=yes, addedsc=yes] But in that case, you may have c2sc and addedsc as mutually exclusive. Just in case it might help, Pablo
participants (3)
-
Hans Hagen
-
Kirill Davidov
-
Pablo Rodriguez