[Tex/LaTex] Substitute font’s glyphs with glyphs from the same font

fontsfontspecsubstitutionxetex

Is it possible to substitute certain font's glyphs with other glyphs from the same font? I am using Xelatex and Fontspec.

More specifically, I am using small caps with Linux Libertine O C and the greek letters' vowels are being typeset with accents. This is a problem as Capitals letters in greek never take accents. I could write the source file without accents, but I want a more general and clean solution (correct spellchecking etc).

What I want is to be able to write Κείμενο and have the same output as Κειμενο, this means that in the following mwe, the first line should typeset as the second one.

Is there, any other way to achieve this behavior instead of remapping the glyphs? I didn't find any relevant option in fontspec's documentation.

I want the first line to typeset as the second one.

\documentclass[]{article}
\usepackage{fontspec}

\begin{document}

\fontspec{Linux Libertine O C}
\textsc{Κείμενο}

\fontspec{Linux Libertine O C}
\textsc{Κειμενο}

\end{document}

In case it is relevant, other fonts like the GFS fonts have the desired (correct) behavior, although I am not sure if their small caps are real or just regular capital letters turned into small caps. Kerkis behaves the same way as Linux Liberine O C

enter image description here

UPDATE

I contacted Kerkis author, Mr Tsolomitis, and he made (the obvious) suggestion, that the simpler solution is not to use accents in the first place. Either that or use the optional argument in constructs like \section[Κείμενο]{Κειμενο}

As an alternate way (with XeLaTeX) of changing the (default) behavior of Kerkis he suggested changing the *.pfb file with fontforge by erasing the accents of the vowels. Of course the name of font should be changed also.

I also filled a bug report for 'Linux Libertine' but so far no answer.

Best Answer

Yes, it is possible. You can write a mapping and compile it with teckit-compile to get a .tec file which you can then use with the "Mapping" option of fontspec. (like the "tex-text" which maps -- to an en-dash) http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=TECkitDownloads. You can find example of map-files in your tex installation.

But I would suggest at first to report the problem to the font author. It is certainly better if they decide first if this problem can be solved e.g. by an open type feature.

Btw: You are not really consistent when describing your font. Your example uses Linux Libertine C (which doesn't exist), in the text you are using the names Linux Libertine O C (which you meant) and Linux Libertine O (which is another font).

Related Question