8

Computer Modern fonts, when printed from a pdf generated by pdflatex, tend to produce rather thin lines. The way to solve that problem has been described here through the use of the blacker parameter.

MathJax also uses Computer Modern, and makes the fonts thicker by the blacker parameter as shown in this script. MathJax then splits the font into multiple parts, available here in OTF form. These OTF files are created from FontForge scripts generated here.

When dealing with non-English texts, and using Latin Modern, I use luatex and the OTF version of Latin Modern fonts which can be downloaded from this link. I would like to be able to generate thicker versions of the Latin Modern fonts in OTF format, so that I can use them by luatex to generate pdf documents.

There has been discussion on how to compile LM fonts from sources at tex.stackexchange, focusing specifically on how to generate the pfb and tfm files. The creators of Latin Modern provide tips on how they generated the OTF fonts in Sec 4.3 of the paper titled Latin Modern fonts: how less means more. They mention that they used the Adobe Font Development Kit for Open-Type to generate the OTF fonts, also highlighting that FontForge could be another option.

I can see that MathJax is able to create thicker OTF versions of Computer Modern by FontForge (though I don't understand how it is done). How can a similar task be achieved in the case of the Latin Modern fonts? Does anyone have the scripts available to achieve this task? To be more specific, I am looking for an answer as the one in how to compile LM fonts from sources, for the case of OTF font generation from the metatype Latin Modern sources.

Update on Jul 2, 2020

Apoorv Potnis commented and informed me of the following blog post and the associated code that uses FontForge to make Latin Modern slightly thicker.

Update on Jul 4, 2020

Thanks to the answers by Henri Menke, Davislor and user187802 for the different fake bold approaches.

The solution provided in Context is detailed in Chp 11 of On and on document from the Context wiki. The modernlatin font is defined using boldened-xy features which are specified by using the effect feature in LuaTeX. The same approach also seems to work under LuaLaTeX, which additionally has the embolden option that gets used when FakeBold is specified in fontspec. I used the following sample file to see how different options look on screen and on paper when printed. Printed results for fake bold options (FakeBold and effect=...) were different based on which pdf viewer I used (evince vs Acrobat). The modified otf version resulted in similar results for both viewers.

\documentclass[10pt,oneside,letterpaper]{article}

\usepackage{fontspec}
\newfontfeature{boldened-00}{effect={width=0.00,auto=yes}}
\newfontfeature{boldened-05}{effect={width=0.05,auto=yes}}
\newfontfeature{boldened-10}{effect={width=0.10,auto=yes}}
\newfontfeature{boldened-15}{effect={width=0.15,auto=yes}}

\setmainfont{Latin Modern Roman}
\usepackage{blindtext}

\begin{document}
\section*{Default}
\blindtext

\section*{Modified Font File}
% Modified font file, see https://github.com/jagd/fakebold/releases/tag/v1.1
\fontspec{lmroman10-regular.otf}[Path="./"]
\blindtext

\newpage
\section*{FakeBold - 0}
\fontspec{Latin Modern Roman}[FakeBold=1.0]
\blindtext
\section*{Font Feature - 0}
\fontspec{Latin Modern Roman}[boldened-00]
\blindtext

\newpage
\section*{FakeBold - 05}
\fontspec{Latin Modern Roman}[FakeBold=1.05]
\blindtext
\section*{Font Feature - 05}
\fontspec{Latin Modern Roman}[boldened-05]
\blindtext


\newpage
\section*{FakeBold - 10}
\fontspec{Latin Modern Roman}[FakeBold=1.10]
\blindtext
\section*{Font Feature - 10}
\fontspec{Latin Modern Roman}[boldened-10]
\blindtext

\newpage
\section*{FakeBold - 15}
\fontspec{Latin Modern Roman}[FakeBold=1.15]
\blindtext
\section*{Font Feature - 15}
\fontspec{Latin Modern Roman}[boldened-15]
\blindtext
\end{document}
7
  • 1
    would Computer Modern Unicode be of any help to your project?
    – user4686
    Nov 18 '18 at 0:02
  • @jfbu Thank you for informing me about the Computer Modern Unicode package. I looked at their source code but could find the scripts that did the conversion to OTF.
    – Ekin
    Nov 18 '18 at 17:27
  • ... could not ... (sorry for the typo)
    – Ekin
    Nov 18 '18 at 17:36
  • FontForge can change the stem dimension of the glyphs as explained here. One can select all glyphs in the OTF font, then go to Element -> Style -> Change Glyph -> Stems to slightly increase the stem height/width of a specific font. I am not sure whether this is a similar operation to the blacker parameter change in Metatype.
    – Ekin
    Nov 18 '18 at 19:01
  • 1
    Maybe this will help: thedrwu.com/posts/thicker-lm There is a compiled .otf version of thicker Latin Modern fonts and it looks beautiful in my opinion. Jun 18 '20 at 13:35
3

As mentioned in the comments, one can take a look at this blog post by C. Wu. There, the author of the post discusses how to compile a thicker version of the Latin Modern font. One can download a compiled version of the thicker LM fonts and use it with XeLaTeX or LuaLaTeX. Download link from GitHub.

With normal LM:

normal

Thicker LM:

thicker

The screenshots were taken on Okular pdf reader and the document was compiled with XeLaTeX. The thicker one looks much beautiful in my opinion.

Note: I do not own any Apple hardware and do not own any device with macOS or iOS, so I cannot tell for sure. But what I've noticed is that screenshots from Apple devices seem to have thicker (blacker?) glyphs, possibly due to Apple's Font rendering. So, the end result might look different on macOS. Different PDF readers also render a bit differently, e.g. Foxit and Nitro readers have slightly thicker strokes compared to Adobe Acrobat, Okular, Evince, and others.

Edit: Not a part of the answer but just general information. There exists a package NewComputerModern – Computer Modern fonts including matching non-latin alphabets. This is a new font wherein the Book weight is supposed to look a bit thicker compared to Computer Modern. It looks like this:NewCM

1
  • 1
    Re Note: Yes it definitely depends on font rendering of the PDF viewer, which in turn is likely to depend on aspects of the operating system or other libraries. (See for example this answer from 2016 about an issue that is likely no longer relevant.) In a way, by going from METAFONT's raster (bitmap) fonts to “modern” vector fonts (Type1, TTF, OTF, etc), we have gone back to the problem that motivated Knuth to start working on digital typography (loss of control over visual appearance). (I think some DVI viewers used bitmap fonts at the desired size…) Dec 8 '20 at 6:02
5

In LuaLaTeX, with unicode-math, you don’t need to recompile. You can use the FakeBold= option, e.g.:

\setmainfont{Latin Modern Roman}[FakeBold=1.05]
\setsansfont{Latin Modern Sans}[FakeBold=1.05}
\setmonofont{Latin Modern Mono}[FakeBold=1.05]
\setmathfont{Latin Modern Math}[FakeBold=1.05]

Or even

\defaultfontfeatures{ Ligatures=TeX, FakeBold=1.05 }

Update

As of 2021, there is an excellent OpenType version of Computer Modern on CTAN, New Computer Modern. It comes both in the same weight and a thicker book weight, which is the default in newcomputermodern or fontsetup, and has much more extensive coverage than Latin Modern. It also comes with an OpenType math font.

It does not cover all of Knuth’s font families, but it does cover Computer Modern Roman, Sans Serif and Typewriter.

\documentclass[10pt,oneside,letterpaper]{article}
\usepackage{newcomputermodern}

\newfontfamily\lmodern{Latin Modern Roman}[
  Scale = MatchLowercase,
  Ligatures = Common ]

\usepackage{blindtext}

\begin{document}
\section*{Default}
\blindtext

\lmodern
\section*{Latin Modern}
\blindtext

\end{document}
2

ConTeXt provides a blacker version of Latin Modern out-of-the-box. The font is modified on the fly using Lua.

\setupbodyfont[modernlatin]
\starttext
\samplefile{knuth}
\stoptext

enter image description here

For comparison, this is standard Latin Modern:

\setupbodyfont[latinmodern]
\starttext
\samplefile{knuth}
\stoptext

enter image description here

2
\documentclass{scrartcl}
\usepackage{fontspec}
\usepackage{pdfrender}
\usepackage{blindtext}
\begin{document}
\blindtext% default stroke

\pdfrender{TextRenderingMode=FillStroke,LineWidth=0.1}%  darker stroke
\blindtext

\bfseries
\blindtext
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.