I would like to add the Letters=Uppercase
option to a font which hasn't the needed open type feature built in.
This is (with lualatex) possible like this:
\documentclass{article}
\directlua
{
fonts.handlers.otf.addfeature
{
name = "vircase",
type = "multiple",
data =
{
["a"] = {"A"},
["ü"] = {"Ü"},
["ɒ"] = {"A"}, %test non existing chars (nothing happens)
[0x0065] = {0x0045}, %test unicode-numbers (e/E)
["o"] = {"X"},
["o"]= {"O"}, %test multiple settings (last wins)
["ß"] = {"S","S"}, %special case, should be added manually
},
}
}
\usepackage{fontspec}
\setmainfont{OpenSans-Regular.ttf}%
[
RawFeature=+vircase,
]
\begin{document}
AAAA aaaa ü ß ɒ e o
Hallo Welt!
\end{document}
But I naturally don't want to write all pairs down.
So how could I fill the table with at less fuss as possible? It should be possible to add some pairs manually at the end (for cases like the ß above).
I prefer a solution that uses an existing file in the tex system. I thought about using char-def.lua
from context (with require("char-def.lua")
. But while it can be loaded without problem in texlive, it doesn't exist in miktex, also I'm not sure if the file will stay stable. Another idea is to use somehow luatex-unicode-letters.tex
. But I'm quite open for other ideas.