6

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.

1
  • On/Off-Topic: I don't think that the statement "Capital letters in greek never take accents" is exactly right. Why not? Think, for example, poem titles, where accented capitals could make a nice difference. Dec 2, 2011 at 16:31

3 Answers 3

6
+100

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

2
  • Thank you. I corrected my example and I'll report it to the font authors.
    – pmav99
    May 6, 2011 at 8:51
  • After all, I think that Linux Liberine without O does exist. It is the ttf version. And that's why thw MWE compiled on my pc.
    – pmav99
    May 12, 2011 at 22:03
1

After doing some research, I think that the proper way to do it is to create a Glyph Substitution table (GSUB).

FontForge, is up to the task. I haven't tried it, and I don't know how difficult it can be (propably not much - especially for just a few glyphs). I believe that this is the "correct" way of substituting glyphs in OpenType fonts. More info can be found at the FontForge's documentation. Propably the new tables can be easily incorporated by the font authors (if they approve them).

Another more hackish way is to just erase the accents from the vowels or just copy paste the unaccented versions of the vowels using FontForge. This is very fast and it should work out of the box. This is neither clean nor a general solution for glyph substitution.

1
  • Please note that fontspec supports arbitrary .fea feature files and custom features, e.g. \setmainfont[FeatureFile=greeksmpcp.fea,RawFeature=+gksc;]{Linux Libertine O}. Also, I noticed that version 4.7 was the last release of Linux Libertine to include the “Capitals” variant Linux Libertine O C, which does support Greek small caps, but does not support bold or italic small caps.
    – Crissov
    Feb 12, 2014 at 16:04
1

The solution proposed by @UlrikeFischer is xetex-specific; and the one by @pmav99 requires a change to the font, which is difficult and not generic at all.

Moreover, doing some research on the same issue myself (after encountering the same problem) I found that the situation is very inconsistent among the available fonts: as an extreme example, the new Microsoft fonts (eg. Constantia) changed behaviour between versions: older versions produced the "correct" (desired) output, whereas the version shipped with Windows 8 produces output like the one on the picture in the question. I even found a font that does not map ς (final sigma) to anything and retains it in the small-caps form.

So, my suggestion would be to create a macro much like \MakeUppercase, which does appropriate substitutions (Άνθρωπος -> Ανθρωποσ) and then use the small-caps form of the font.

2
  • That's a great idea! Could you provide a macro definition for something like that? It could even become a package in CTAN.
    – pmav99
    Sep 1, 2012 at 14:00
  • Unfortunately not myself; I do not know almost anything about writing packages. I will probably open a relevant question asking for guidelines...
    – nplatis
    Sep 4, 2012 at 12:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .