fontspec
fontspec copied to clipboard
'case' feature hooked into \MakeUppercase
When you typeset text in capitals, brackets and hyphens should be slightly raised. OpenType has a feature for that called case. It should be activated by default [1]. However, it isn't and in XeLaTeX you can't even activate it by hand. In LuaLaTeX uncommenting the 5th line deactivates case. See minimal example:
\documentclass[paper=7cm:3cm,pagesize]{scrartcl}
\usepackage{fontspec}
\newICUfeature{Case}{On}{case}
\setmainfont[Case=On]{Linux Libertine G}
%\setmainfont{Linux Libertine G}%if uncommented, case does not work
\begin{document}
\MakeUppercase{[ca-pi-tals]} [CAPITALS]
\end{document}
[1]http://www.microsoft.com/typography/otspec/features_ae.htm#case
“Linux Libertine G” is not even an OpenType font, try with “Linux Libertine O”.
\documentclass[paper=7cm:3cm,pagesize]{scrartcl}
\usepackage{fontspec}
\newICUfeature{Case}{On}{+case}
\setmainfont[Case=On]{Linux Libertine O}
\begin{document}
\MakeUppercase{[ca-pi-tals]} [CAPITALS]
\end{document}
This works here but it will enable the feature globally. What you want (enabling it only for capitals) can’t be implemented by fontspec since it requires text analysis which has to be done by the engines, but I doubt that either of the engines will ever do this. Just use {\addfontfeatures{Case=On} [CAPITALS]} or something like that.
Am 27.01.2014 20:56, schrieb Khaled Hosny:
This works here but it will enable the feature globally.
You are right. But in a first step even the global enabling for the mayor engines would be an advantage.
What you want (enabling it only for capitals) can’t be implemented by |fontspec| since it requires text analysis which has to be done by the engines, but I doubt that either of the engines will ever do this.
So everything all right then? Why the different behaviour of the engines? I am not a programmer, but it does not sound convincing to me that it is impossible to implement specially in the first case (with \MakeUppercase). You get different brackets automatically in smallcaps too.
Just use |{\addfontfeatures{Case=One} [CAPITALS]}| or something like that.
Raising the brackets and hyphens is not something the normal user wants to care about manually. It is easy to oversee if you forget it somewhere.{\addfontfeatures{Case=On}\MakeUppercase{[Ca-pitals]}} does not sound user friendly to me.
Why the different behaviour of the engines?
luaotfload package has relaxed rules for parsing features, so case is parsed as +case, but XeTeX only accepts the later.
{\addfontfeatures{Case=On}\MakeUppercase{[Ca-pitals]}}does not sound user friendly to me.
You can always define your own macros.
{\addfontfeatures{Case=On}\MakeUppercase{[Ca-pitals]}}does not sound user friendly to me.You can always define your own macros.
I'd never considered this as an extension for fontspec. I generally like it, but I'm not sure if the place of fontspec to redefine such an internal command. (There are a few that we do, so it's not without precedent.)
I'm playing around with a couple of ideas at the moment—I may well implement an improved \MakeUppercase for the next release.
For my own notes: this needs a way of activating font features "silently", so if the feature is missing there's no warning. Easily done, just not tonight :)
Can this issue from 2014 be closed?
@rriemann How do you mean? It hasn't been implemented yet. Are you saying it's no longer needed or that I should get a move on? :) FWIW I think it's still a valid suggestion.