0

I watched a video interview in which Donald Knuth complained about the changes made to Computer Modern in the Latin Modern font. ConTeXt appears to use Latin Modern instead of Computer Modern, as the default font. How can I set ConTeXt to use Donald Knuth's official version of this font?

  • Can you provide a link? Using Knuth's official version means (1) losing pre-composed accented characters, which will look worse and break searches in compiled documents, as well as copy-paste; (2) using fonts which do not scale and display extremely poorly in certain PDF viewers (though not all viewers - Adobe's is the one I know of), and will look bad zoomed in in most viewers (printing hard copy should work fine). There are postscript and opentype versions of CM, including ones which support accented characters etc. But I think Latin Modern is generally considered superior to the unicode CM. – cfr Jun 13 '17 at 22:34
  • It was in one of the videos here webofstories.com/story/search?q=knuth. – Village Jun 13 '17 at 22:36
  • 3
    using a font with only 127 characters would seem odd in a natively unicode system. – David Carlisle Jun 13 '17 at 22:37
  • 3
    Computer Modern fonts are nice and very well crafted, but they're not the “ultimate font”. – egreg Jun 13 '17 at 22:41
  • 1
    @Village I have seen that series of videos completely, in fact some parts multiple times. It is also identically available on Youtube at youtube.com/playlist?list=PLVV0r6CmEsFzeNLngr1JqyQki3wdoGrCn and there's a transcript at github.com/kragen/knuth-interview-2006 -- nowhere in them does Knuth refer to Latin Modern, let alone complain about the changes made in them. – ShreevatsaR Jun 14 '17 at 2:57
2

Such old-style postscript fonts are not really recommended for use with a full Unicode engine such as LuaTeX because you essentially lose all the nice features such as accented characters, UTF-8 input, scalable fonts, etc. The most crucial problem is math because ConTeXt MKIV is set up for Unicode math fonts which requires you to compose a virtual font which maps to the old-style glyphs.

Below I composed a minimal typescript which gives you Computer Modern at a fixed size of 10pt (no design sizes) and without math. I typeset the German aesop-de.tex as an example where you find that all umlauts are missing. I don't really know why, but I also do not feel like fixing it. This answer merely serves as a starting point for you to implement a complete typescript which supports all bells and whistles of Computer Modern, but I am quite sure that you will be scared away by the huge boilerplate which is necessary to get this poorly working example to at least include Computer Modern.

If you are really keen on using old-style fonts in ConTeXt, better use MKII.

\starttypescript [serif] [cmr]

  \definefontsynonym [Serif]           [file:cmr10.afm]
  \definefontsynonym [SerifItalic]     [file:cmti10.afm]
  \definefontsynonym [SerifBold]       [file:cmbx10.afm]
  \definefontsynonym [SerifBoldItalic] [file:cmbxti10.afm]

\stoptypescript

\starttypescript [sans] [cmr]

  \definefontsynonym [Sans]       [file:cmss10.afm]
  \definefontsynonym [SansItalic] [file:cmssti10.afm]
  \definefontsynonym [SansBold]   [file:cmssbx10.afm]

\stoptypescript

\starttypescript [mono] [cmr]

  \definefontsynonym [Mono]       [file:cmtt10.afm]
  \definefontsynonym [MonoItalic] [file:cmitt10.afm]

\stoptypescript

\starttypescript [cmr]
  \definetypeface [\typescriptone] [rm] [serif] [cmr] [default]
  \definetypeface [\typescriptone] [ss] [sans]  [cmr] [default]
  \definetypeface [\typescriptone] [tt] [mono]  [cmr] [default]
  \definetypeface [\typescriptone] [mm] [math]  [modern] [default]
  \quittypescriptscanning
\stoptypescript

\setupbodyfont[cmr]

\starttext

\input aesop-de.tex

\stoptext

Proof that Computer Modern is used:

$ pdffonts test.pdf 
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
YSHCPX+CMR10                         CID Type 0C       Identity-H       yes yes yes     10  0

enter image description here

  • 1
    I agree with the sentiment, but the boilerplate is not significantly more than that for many TTF/OTF fonts (see, type-imp-*.mkiv files). Regarding missing umlauts, do you get them if you add \definefontfeature [default] [default] [compose=yes] before defining the typescript? (Sorry, I cannot test as I don't have the cm afm files on my computer). – Aditya Jun 14 '17 at 0:10
  • @Aditya No, it doesn't work and honestly I don't think it should. Old-style fonts do not know anything about "font features" as OpenType fonts do. But thanks for the suggestion :) – Henri Menke Jun 14 '17 at 0:12
  • 1
    Are you sure you mean 'postscript' fonts here? Maybe those are substituted, but Knuth's originals are not postscript, surely. – cfr Jun 14 '17 at 0:12
  • @cfr My method is loading .pfb files which stands for "Printer Font Binary" and is the binary Postscript font format by Adobe. I'm not too font savvy to know 100% what I'm talking about. I could be wrong. – Henri Menke Jun 14 '17 at 0:15
  • That's what I mean by 'substituted'. If we are talking Knuth's originals, we are talking .mf and not .pfb but many installations substitute type1 postscript automatically. (Certainly, if T1 is used, they do for (pdf)LaTeX, as they have to.) Presumably, you're getting something like cm-super? – cfr Jun 14 '17 at 0:17

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.