# Replacing a glyph in one font with a glyph from another

I am a newbie with LaTeX when it comes to fonts. I would like to replace the double story "a" in Latin Modern for a single story "a" version (and similarly for the "g"). I just prefer my typeset output to look more in line with my handwritten output, aesthetics be damned. Last year, when I asked this question most people thought I was crazy to mess with the font design, but I want to do it anyway (I am stubborn that way).

To partly alleviate the mixing and matching ugliness of the output (I am not totally deaf to the wise comments of my detractors from yesteryear), I wish to use as a substitute Latin Modern italics, upright version, but only for the characters "a" and "g" (in all available font sizes and weights). I would hope that the clash would be thus minimized, as both fonts are Latin Modern, and so share some familiarity with each other.

First: how do I get access to this hidden font version of Latin Modern? Second: how do I make the change using LaTeX for these two glyphs only? A partial answer was suggested to me last year, using XeTeX (and I need to study it further in order to understand it), but I gather XeTeX is not completely compatible with microtype, and I would rather not learn a new paradigm for my typesetting if I can help it.

UPDATE

Well, here is a partial answer to my question.

I have the following in my document header:

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{cfr-lm}
\DeclareTextFontCommand{\upa}{\fontencoding{T1}\fontfamily{clm2j}\selectfont\textui{a}}
\DeclareTextFontCommand{\upaa}{\fontencoding{T1}\fontfamily{clm2j}\selectfont\textui{á}}
\DeclareTextFontCommand{\upg}{\fontencoding{T1}\fontfamily{clm2j}\selectfont\textui{g}}
\DeclareUnicodeCharacter{0061}{\upa}
\DeclareUnicodeCharacter{00E1}{\upaa}
\DeclareUnicodeCharacter{0067}{\upg}


Now the actual upright italic letters ARE created. But somehow the \DeclareUicodeCharacter commands have no effect whatsoever. Anyone knows why?

-
What do you mean by "italic, upright"? I doubt very much that such a font exists, lm-info.pdf certainly doesn't show it. Beside this: Exchanging glyphs can be done either by editing the pdf and then recreating all the tfm etc, or with virtual fonts. Both would take me more than a day and I'm not a newbie regarding fonts. So how much time or money are you willing to invest? – Ulrike Fischer Jan 4 '14 at 18:41
The package cfr-lm offers access to the upright italic. (Latin Modern does include such a font.) However, replacing glyphs in the regular font with glyphs from this one is a really bad idea. Setting aside issues of font design in terms of the consistent look of different glyphs in a single font, you will lose all kerning involving a and g unless you manually specify kerning to compensate in your font configuration. And as @UlrikeFischer says, setting this up would be a big job even if you already know how to do it. (cfr-lm took a long time, even running tex overnight.) – cfr Jan 4 '14 at 19:58
Have you considered using something like Gentium which does offer such alternate glyphs? – cfr Jan 4 '14 at 20:15
@cfr Does Gentium really provide a "roman" (or "upright") single-story "a"? If so, how do I get access to it from LaTeX? Besides adding \usepackage{gentium} to my header, that is. – ltcomdata Dec 1 '15 at 3:08
Yes. It does. Why don't you look it up? – cfr Dec 1 '15 at 4:08

The code you are using for your declarations is equivalent to

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{cfr-lm}
\newcommand*{\upa}{\textui{a}}
\newcommand*{\upaa}{\textui{á}}
\newcommand*{\upg}{\textui{g}}
\begin{document}
a \upa á \upaa g \upg
\end{document}


There is no need to declare a text font command for a single character and it is not appropriate. Loading lmodern and then loading cfr-lm is pointless because the latter overwrites or duplicates everything from the former. Loading fontenc with option T1 is also pointless because cfr-lm does it anyway.

Note that this approach is going to give you some very bad typographical results.

Text becomes more difficult to read because it becomes less clear where words begin and end, for example. Even without surrounding text, you can appreciate the difficulties:

Note that the kerning issues here. (Admittedly the kerning in the upright italic doesn't help, as can be seen in the ui version of 'gyroscope'.)

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{cfr-lm}
\newcommand*{\upa}{\textui{a}}
\newcommand*{\upaa}{\textui{á}}
\newcommand*{\upg}{\textui{g}}
\begin{document}
Vat

V\upa t

\textui{Vat}

gyroscope buggy

\upg yroscope bu\upg\upg y

\textui{gyroscope buggy}
\end{document}

-
Ah! Thanks. I see now that I do not need to use the very long definition I used for my custom letters. Also, I did not know that cfr-lm was a replacement for lmodern. I thought it was built on top of it. As for ugliness, I guess I don't see how the second versions of your words look too bad. The third version looks horrendous, I agree, which is why I only wanted to replace the "a" and the "g". – ltcomdata Dec 1 '15 at 4:34
cfr-lm is built on top of lmodern. But cfr-lm.sty replaces lmodern.sty. The a is too far from the V in Vat. The g is too far from the y in gyroscope and so on. – cfr Dec 1 '15 at 4:49
+1 for an expert explanation of how to use some of the (many!) features of the cfr-lm package. :-) – Mico Dec 1 '15 at 6:52