1

I guess this was asked already at Can I make a greek letter extra-bold in math mode?, but it didn't get the answer I wanted to read, so I'll try again :)

I'm not interested in bold math here, my situation is this: I like lmtt teletype font, and the only thing I'd like is to make lmtt a bit bolder; I know about [lighttt], but I don't like it so much - and I would not like to change to a different typewriter font just because of this. But this problem could occur in a different context, too, which is why I would like to ask in more generic terms: would it be possible in Latex to "derive" a "bolder" version of a font, by re-"stroking" the letters with a thicker line?

I would guess, out of the box no - but I wanted to confirm that. As far as I can remember, in PDF itself, you declare a font, and a family/size for it, and when you place a text PDF primitive, the letters are simply used to look up the font glyph, which is then placed. As there is no "line width" parameter there (that I can remember) for the font stroke, I doubt Latex could use something like that either.

However, maybe somehow Latex could be used, for each such "artificially" bold letter, to:

  • re-draw the letter with a given stroke
  • convert the stroke to a filled path
  • find the union of the filled path and the path derived from stroke
  • insert this vector as a glyph in a new font table exported in the PDF

Not even sure if Latex does these kinds of operations (though I guess Tikz, or LuaLatex, might) - but I think it would be nice to know what are the possibilities for them.

I also just found this:

Any way to strengthen font weight/darkness/heaviness?

For actual printing, you could set the MF options and generate new bitmaps to use (as a Type 3 bitmap font), but that's an awkward solution.

So apparently, there is a possibility for a bitmap approach with Metafont - but here I'm interested in a vector approach. I'd be OK with using external programs, too, as long as all work can be initiated by Latex (via -shell-escape).

sdaau
  • 17,079
  • 1
    What is the problem with “bitmap” approach? I mean, it might look worse in a pdf viewer, but there is no difference at all in print. – Manuel Jul 19 '14 at 15:41
  • Thanks for the comment, @Manuel - indeed, the looking "worse in a pdf viewer" part is what makes me see the bitmap approach as problematic; though, as I haven't yet seen an example of how this is done in code with the "bitmap" approach either, I'd welcome an answer or a link for that, too... cheers! – sdaau Jul 19 '14 at 15:44

1 Answers1

3

If you have no objections to use xelatex, you can try the FakeBold option of fontspec. See the following example:

enter image description here

% !TEX program=xelatex
\documentclass{article}

\usepackage{fontspec}

\newfontfamily\darktt[AutoFakeBold=2.5]{Latin Modern Mono}
\newfontfamily\blacktt[AutoFakeBold=5]{Latin Modern Mono}

\def\test{abcde ABCDE}
\begin{document}
\begin{tabular}{lr}
{\ttfamily \test}           & default typewriter \\
{\ttfamily\bfseries \test}  & default typewriter bold \\
{\darktt\bfseries \test}    & Latin Modern Mono FakeBold 2.5 \\
{\blacktt\bfseries \test}   & Latin Modern Mono FakeBold 5 \\
\end{tabular}

\end{document}

This example here is only to generate a demo for the FakeBold feature. A real world example would look like this:

% !TEX program=xelatex
\documentclass{article}

\usepackage{fontspec}
\setmonofont[AutoFakeBold=2.5]{Latin Modern Mono}

\begin{document}
\ttfamily Bla blal  bla \textbf{bold Bla} bla.
\end{document}

Note, however, that FakeBold does not work with lualatex and obviously not with pdflatex.

quinmars
  • 5,477