# Times New Roman PS font not rightfully rendered by ConTeXT

I downloaded the Times New Roman PS font for using by ConTeXT (luatex). Running mtxrun --script font --list --all pattern=timesnewroman* gives me the following result:

timesnewromanbold             timesnewroman       timesnewromanpsboldmt         /Users/javier/.fonts/TimesNewRomanPSMT/TimesNewRomanPS-BoldMT - Times New Roman - Bold.ttf
timesnewromanbolditalic       timesnewroman       timesnewromanpsbolditalicmt   /Users/javier/.fonts/TimesNewRomanPSMT/TimesNewRomanPS-BoldItalicMT - Times New Roman - Bold Italic.ttf
timesnewromanitalic           timesnewroman       timesnewromanpsitalicmt       /Users/javier/.fonts/TimesNewRomanPSMT/TimesNewRomanPS-ItalicMT - Times New Roman - Italic.ttf
timesnewromannormal           timesnewroman       timesnewromanpsitalicmt       /Users/javier/.fonts/TimesNewRomanPSMT/TimesNewRomanPS-ItalicMT - Times New Roman - Italic.ttf
timesnewromanpsbolditalicmt   timesnewroman       timesnewromanpsbolditalicmt   /Users/javier/.fonts/TimesNewRomanPSMT/TimesNewRomanPS-BoldItalicMT - Times New Roman - Bold Italic.ttf
timesnewromanpsboldmt         timesnewroman       timesnewromanpsboldmt         /Users/javier/.fonts/TimesNewRomanPSMT/TimesNewRomanPS-BoldMT - Times New Roman - Bold.ttf
timesnewromanpsitalicmt       timesnewroman       timesnewromanpsitalicmt       /Users/javier/.fonts/TimesNewRomanPSMT/TimesNewRomanPS-ItalicMT - Times New Roman - Italic.ttf
timesnewromanpsmt             timesnewromanpsmt   timesnewromanpsmt             /Users/javier/.fonts/TimesNewRomanPSMT/TimesNewRomanPSMT.ttf
timesnewromanpsmtnormal       timesnewromanpsmt   timesnewromanpsmt             /Users/javier/.fonts/TimesNewRomanPSMT/TimesNewRomanPSMT.ttf
timesnewromanpsmtregular      timesnewromanpsmt   timesnewromanpsmt             /Users/javier/.fonts/TimesNewRomanPSMT/TimesNewRomanPSMT.ttf


My settings are these ones:

% Enable Unicode fonts
\enableregime[utf]

% Enable Capital Letter use
\setupcapitals[sc=yes]

\starttypescript [serif] [timesnewromanps]
\definefontsynonym [Serif] [name:timesnewromanpsmtregular]
\definefontsynonym [SerifBold] [name:timesnewromanpsboldmt]
\definefontsynonym [SerifBoldItalic] [name:timesnewromanpsbolditalicmt]
\definefontsynonym [SerifItalic] [name:timesnewromanpsitalicmt]
\definefontsynonym [SerifCaps] [name:timesnewromanpsmtregular]
\stoptypescript

\definetypeface [timesnewromanps] [rm] [serif] [timesnewromanps] [default] [encoding=default]

\definebodyfont [default] [rm]
[tf=Serif sa 1,
bf=SerifBold sa 1,
it=SerifItalic sa 1,
bi=SerifBoldItalic sa 1,
sc=SerifCaps sa 1]

\usetypescript[serif][timesnewromanps]
\setupbodyfont[timesnewromanps,rm,12pt]
\definefont[TitleFont][Serif at 24pt]
\setupoutput[pdftex]
\setupcaptions[
location=top,
width=fit,
minwidth=fit,
number=no,
align=middle,
style=\it,
]


ConTeXt recognizes that font and prints the documents with it, but it doesn't show italics, bold, or font types for titles, sections, and so on.

No doubt, I have some misconfiguration. I'd appreciate your help.

Thank you very much.

• Hi, and welcome to the site. I think your question would be easier to read if you edit it, and mark the content that is code and hit the {} button. This will show it as code. Also, it might be good to point helpers to where you downloaded the fonts in case they want to try your code out. Again, welcome! May 16 '19 at 14:42
• From your code it looks like you are using mkii (pdftex). Do you mind having a solution for mkiv (luatex)? How old is your installation? May 16 '19 at 15:26

In your question you state “using by ConTeXT (luatex)”, from which I infer that you are using ConTeXt MkIV. Yet you are confusing concepts from MkII and MkIV. First of all, the statements

\enableregime[utf]
\setupoutput[pdftex]


just do nothing in MkIV, because the default encoding is already UTF-8 and output will always be PDF.

Next, you define a serif typeface for timesnewromanps but no sans, mono, or math. This is what bites you when you try to typeset section headings in sans. Since no sans font is loaded, ConTeXt will just use the last loaded font which is the serif font at 12pt. To fix this you have to load these additional fonts. Here I just use the modern typescript which loads the Latin Modern fonts.

I have also applied some little optimizations.

• Adding \setups[font:fallback:serif] to the serif typescript allows ConTeXt to load missing characters from the default font (if they are defined there).

• All \definetypeface statements are packed into a typescript which ends in \quittypescriptscanning. That tells ConTeXt that at this point all fonts are loaded and it can quit early.

• Instead of saying \ss\tfa you can also use the shorthand \ssa.

\starttypescript [serif] [timesnewromanps]
\setups[font:fallback:serif]
\definefontsynonym [Serif]           [name:timesnewromanpsmt]
\definefontsynonym [SerifBold]       [name:timesnewromanpsboldmt]
\definefontsynonym [SerifBoldItalic] [name:timesnewromanpsbolditalicmt]
\definefontsynonym [SerifItalic]     [name:timesnewromanpsitalicmt]
\definefontsynonym [SerifCaps]       [name:timesnewromanpsmtregular]
\stoptypescript

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

\setupbodyfont [timesnewromanps,rm,12pt]

\definefont [TitleFont] [Serif at 24pt]
[title,chapter,section,subsection,subsubsection]
[align={flushleft, nothyphenated, verytolerant}]
\setuphead [section]       [number=no, style=\ssc]
\setuphead [subsection]    [number=no, style=\ssb]
\setuphead [subsubsection] [number=no, style=\ssa]

\setupcaptions
[location=top,
width=fit,
minwidth=fit,
number=no,
align=middle,
style=\it]

\starttext

\starttitle[title={Test}]

\startsection[title={Knuth}]

\samplefile{knuth}

\stopsection

\stoptitle

\stoptext


• Fine, very fine. Accurate and right. Thanks a lot. I'm not a computer scientist and I was having a hard time getting the settings right. Greetings. May 18 '19 at 7:54

The image in Henri's answer seems to be missing fi and fl ligatures, so here's a minor supplement to his answer, shamelessly plagiarized from what Hans Hagen wrote for the mailing list. I'm assuming that Times New Roman doesn't have any other ligatures.

Put the following before the first \starttypescript (be aware that it uses string.utf8character() for ascii-safe representation of ﬁ and ﬂ):

\startluacode
name = "liga",
type = "ligature",
data = {
[string.utfcharacter(0xFB01)] = { "f", "i" },
[string.utfcharacter(0xFB02)] = { "f", "l" },
}
}
\stopluacode
\definefontfeature [timesnewromanps-preset] [
mode=node,kern=yes,protrusion=quality,expansion=quality,
script=latn,language=dflt,
trep=yes,tlig=yes,liga=yes]

%% In case you want to turn off ligatures: {\feature[+][f:nolig]fi fl}
\definefontfeature [f:nolig] [liga=no]


Now add a [features=timesnewromanps-preset] to the end of each \definefontsynonym line, which makes that part of Henri's answer look like this:

\starttypescript [serif] [timesnewromanps]
\setups[font:fallback:serif]
\definefontsynonym [Serif]           [name:timesnewromanpsmt] [features=timesnewromanps-preset]
\definefontsynonym [SerifBold]       [name:timesnewromanpsboldmt] [features=timesnewromanps-preset]
\definefontsynonym [SerifBoldItalic] [name:timesnewromanpsbolditalicmt] [features=timesnewromanps-preset]
\definefontsynonym [SerifItalic]     [name:timesnewromanpsitalicmt] [features=timesnewromanps-preset]
\definefontsynonym [SerifCaps]       [name:timesnewromanpsmtregular] [features=timesnewromanps-preset]
\stoptypescript

• Thank you. I don't see any difference. But I don't care about that. May 18 '19 at 8:25
• Take a look at the “ﬁ” in “significantly” and the “ﬂ” in “influenced”. High quality typography ligates them. TeX usually does this by itself, but Times New Roman needed some help.
– user31316
May 18 '19 at 13:28
• Yes, but I don't see any difference after including your setting. I'm sorry. May 18 '19 at 17:38
• utf.byte is shorter than string.utfcharacter ;) May 23 '19 at 23:45