10

I've been trying to get a capital ß out of ConTeXt in contexts where automatic uppercasing is meant to happen, and get strange results. I am very new to ConTeXt. Also, I don't like the oldtsyle numerals with caps or smallcaps and need to automatically switch to some sort of lining figures.

Here's my testbed:

\mainlanguage[de]
\language[de]

\uccode`ß="1E9E    % This gives the capital ß to \uppercase

\definefontfeature[fcalluna][default][] % I tried all the font features built 
                                                % into Calluna, to no avail.

\definefontfamily [myfamily] [serif][Calluna][features=fcalluna]
\definefontfamily [myfamily] [sans] [Linux Biolinum O][features=fcalluna]
\definefontfamily [myfamily] [mono] [TeX Gyre Cursor]

\setupbodyfont [myfamily]
\startTEXpage[offset=10pt]
    \starttabulate[|l|l|l|]
         \NC \it Command \NC \it Calluna \NC \it Linux Biolinum \NC\NR
        \NC\type{\WORD{Gruß134}}:       \NC\WORD{Gruß134}           \NC {\ss\WORD{Gruß134}}         \NC\NR
        \NC\type{\uppercase{Gruß134}}:  \NC\uppercase{Gruß12134}    \NC{\ss\uppercase{Gruß134}}     \NC\NR
        \NC\type{\sc{Gruß134}}:             \NC{\sc Gruß134}            \NC{\ss{\sc Gruß134}}           \NC\NR
        \NC\type{\Cap{Gruß134}:}        \NC\Cap{Gruß134}            \NC{\ss \Cap{Gruß134}}      \NC\NR
        \NC\type{\cap{Gruß134}:}        \NC\cap{Gruß134}            \NC{\ss \cap{Gruß134}}      \NC\NR
        \NC\type{{\sc\lowercase{Gruß134}}:}         \NC{\sc\lowercase{Gruß134}}             \NC{\ss\sc\lowercase{Gruß134}}  \NC\NR
    \stoptabulate
\stopTEXpage

That gives me:

enter image description here

Well, I didn't expect to get the uppercase or small-caps ß "out of the box", but I had expected some consistency. \WORD just substitutes two S-glyphs instead of, e.g., the SS ligature or the capital ß. \uppercase is the one that's influenced by \uccode. \sc and \Cap both don't find Calluna's small-cap ß, which may be in a strange position in the font, but nevertheless exists.

Obviously, my aim is to see the uppercase and the small-caps ß when I let a header or something do something like \uppercase or \sc. I'd like to see the real small caps; not some scaled-down uppercase. And I'd like an automatic switch to lining figures.

Blackface
  • 781
  • I deleted my comments to avoid the distraction. If there is no reply here, you may consider posting this question on the context mailing list. I cannot help because I don't know how fonts work. – Aditya Apr 07 '16 at 17:30
  • On the mailing list I was told that the problem in \WORD will be solved in the next beta. That's only a partial consolation, though. There are other issues like switching from oldstyle to numerals that go with uppercase or small caps. It seems it is really a general question of "How can I customize glyph substitution?". – Blackface Apr 21 '16 at 06:10

1 Answers1

8

You have to fix the font itself to have the correct mapping. By default the ß in Calluna Regular has no substitutions for smallcaps. You have to add the smcp substitution with uni1E9E.smcp as the target glyph (the smcp suffix is crucial, otherwise you obtain the uppercase version).

I edited the font with FontForge.

enter image description here

Afterwards your exact example typesets as

enter image description here


Alternatively, you can edit the font on the fly using the fonts.handlers approach in Lua. I have asked the question How to adjust font features in LuaTeX? about it which is still lacking a canonical answer at the time of writing, but from the examples given one can sometimes construct working solutions.

\mainlanguage[de]
\language[de]

\startluacode
fonts.handlers.otf.addfeature {
    name = "smcp",
    type = "substitution",
    data = {
        ["germandbls"] = "uni1E9E.smcp",
    }
}
\stopluacode

\uccode`ß="1E9E    % This gives the capital ß to \uppercase

\definefontfamily [myfamily] [serif] [Calluna]          [features=default]
\definefontfamily [myfamily] [sans]  [Linux Biolinum O] [features=default]
\definefontfamily [myfamily] [mono]  [TeX Gyre Cursor]

\setupbodyfont [myfamily]

\startTEXpage[offset=10pt]
  \starttabulate[|l|l|l|]
    \NC \it Command \NC \it Calluna \NC \it Linux Biolinum \NC\NR
    \NC\type{\WORD{Gruß134}}:       \NC\WORD{Gruß134}           \NC {\ss\WORD{Gruß134}}         \NC\NR
    \NC\type{\uppercase{Gruß134}}:  \NC\uppercase{Gruß12134}    \NC{\ss\uppercase{Gruß134}}     \NC\NR
    \NC\type{\sc{Gruß134}}:             \NC{\sc Gruß134}            \NC{\ss{\sc Gruß134}}           \NC\NR
    \NC\type{\Cap{Gruß134}:}        \NC\Cap{Gruß134}            \NC{\ss \Cap{Gruß134}}      \NC\NR
    \NC\type{\cap{Gruß134}:}        \NC\cap{Gruß134}            \NC{\ss \cap{Gruß134}}      \NC\NR
    \NC\type{{\sc\lowercase{Gruß134}}:}         \NC{\sc\lowercase{Gruß134}}             \NC{\ss\sc\lowercase{Gruß134}}  \NC\NR
  \stoptabulate
\stopTEXpage

Output is the same as above.

Henri Menke
  • 109,596