# How to create new font encoding in LaTeX?

The technical documentation for the Latin Modern font family lists all available glyphs. There are more glyphs than are gathered in the accompanying encoding tables (CS, T1, L7X, OT1, OT4, QX, T5, LY1, TS1). I need glyphs like h with stroke or vowels with double grave accent. They are not in the encoding tables mentioned above. I cannot use Xe(La)TeX. My question is: How can I create new encoding table with needed glyphs?

-

Building a new font encoding similar to T1, QX or the others you're listing is not a trivial task.

The easiest part is to build the font table; the usual requirement is that printable ASCII character should stay in their place and that lowercase and uppercase versions of the same character are 32 places apart.

Next all non ASCII characters should be named; when applicable, the name is usually \text<AdobeName>, apart for some cases where <AdobeName> is utterly wrong (the infamous guillemot case, for instance). The given name is called the LaTeX Internal Character Representation (LICR).

Let's say your new encoding is LC (L for local and C for Chris). You have to prepare a file called lcenc.def; you can use t1enc.def for an example. Next a file called lcenc.dfu, for supplementing the utf8 option to inputenc with the translations from Unicode point to LICR for the Unicode points not yet covered. Again, t1enc.dfu can be a model.

Now the hard part. You have to build each font you plan to use. There are tools around and also some papers on TUGboat.

A long term project, I'd say.

For limited needs, one can get away in an easier way, via composite glyphs. This has the disadvantage that hyphenation won't work past a composite glyph in a word, but you'll have hyphenation problems anyway if you don't want to also build the hyphenation patterns for the language you're writing in.

For instance, you can get double grave accents and LATIN SMALL LETTER H WITH STROKE with

\documentclass{article}
\usepackage[T3,T1]{fontenc}
\usepackage[utf8]{inputenc}

\DeclareTextAccentDefault{\textdoublegrave}{T3}
\DeclareTextSymbolDefault{\textcrh}{T3}

\DeclareUnicodeCharacter{0127}{\textcrh}
\DeclareUnicodeCharacter{0201}{\textdoublegrave{a}}
% add the other Unicode points for the accented letters you need

\begin{document}
\textdoublegrave{a} \textcrh

ȁ ħ
\end{document}


As you see, the output is identical.

-

I don't know what you need to do to create new fonts. But to get the glyphs you need, you also don't need to. Just use the T3 encoding.

\documentclass{article}
\usepackage[T3]{fontenc}
\begin{document}
\textcrh\ \H*{o}
\end{document}


-