ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Inconsistencies with fonts/c2sc feature
@ 2024-06-24 16:03 Kirill Davidov
  2024-06-25  9:11 ` [NTG-context] " Hans Hagen via ntg-context
  2024-06-25 15:35 ` Pablo Rodriguez via ntg-context
  0 siblings, 2 replies; 5+ messages in thread
From: Kirill Davidov @ 2024-06-24 16:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [NTG-context] Re: Inconsistencies with fonts/c2sc feature
  2024-06-24 16:03 [NTG-context] Inconsistencies with fonts/c2sc feature Kirill Davidov
@ 2024-06-25  9:11 ` Hans Hagen via ntg-context
  2024-06-25 15:35 ` Pablo Rodriguez via ntg-context
  1 sibling, 0 replies; 5+ messages in thread
From: Hans Hagen via ntg-context @ 2024-06-25  9:11 UTC (permalink / raw)
  To: ntg-context; +Cc: Hans Hagen

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
-----------------------------------------------------------------

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [NTG-context] Re: Inconsistencies with fonts/c2sc feature
  2024-06-24 16:03 [NTG-context] Inconsistencies with fonts/c2sc feature Kirill Davidov
  2024-06-25  9:11 ` [NTG-context] " Hans Hagen via ntg-context
@ 2024-06-25 15:35 ` Pablo Rodriguez via ntg-context
  2024-06-25 17:53   ` Kirill Davidov
  1 sibling, 1 reply; 5+ messages in thread
From: Pablo Rodriguez via ntg-context @ 2024-06-25 15:35 UTC (permalink / raw)
  To: ntg-context; +Cc: Pablo Rodriguez

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


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [NTG-context] Re: Inconsistencies with fonts/c2sc feature
  2024-06-25 15:35 ` Pablo Rodriguez via ntg-context
@ 2024-06-25 17:53   ` Kirill Davidov
  2024-06-25 19:27     ` Pablo Rodriguez via ntg-context
  0 siblings, 1 reply; 5+ messages in thread
From: Kirill Davidov @ 2024-06-25 17:53 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [NTG-context] Re: Inconsistencies with fonts/c2sc feature
  2024-06-25 17:53   ` Kirill Davidov
@ 2024-06-25 19:27     ` Pablo Rodriguez via ntg-context
  0 siblings, 0 replies; 5+ messages in thread
From: Pablo Rodriguez via ntg-context @ 2024-06-25 19:27 UTC (permalink / raw)
  To: ntg-context; +Cc: Pablo Rodriguez

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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-06-25 19:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-24 16:03 [NTG-context] Inconsistencies with fonts/c2sc feature Kirill Davidov
2024-06-25  9:11 ` [NTG-context] " Hans Hagen via ntg-context
2024-06-25 15:35 ` Pablo Rodriguez via ntg-context
2024-06-25 17:53   ` Kirill Davidov
2024-06-25 19:27     ` Pablo Rodriguez via ntg-context

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).