0

Consider two identical tex files file1.tex and file2.tex:

\documentclass[10pt]{article}
\begin{document}
    Hello World
\end{document}

The following two methods can be used to generate a pdf file from these identical tex files

Method 1

pdflatex file1.tex

Method 2

latex file2.tex
dvips file2.dvi
ps2pdf file2.ps

On a machine with TeX Live 2015, these methods generate pdf files with different font encoding, i.e., the outputs of

   pdffonts file1.pdf
   pdffonts file2.pdf

have different 'encoding'. While file1.pdf has Builtin encoding, file2.pdf has WinAnsi encoding. What change in the texfile will force pdflatex to generate pdfs with WinAnsi encoding? Related posts 1, 2, 3, and 4, don't seem to help.

  • 1
    why do you want this? – Ulrike Fischer Nov 23 '20 at 19:32
  • Method 2 gives a slightly bolder/neater font. I want this font for pdflatex because most places that accept tex files run pdflatex. – user21455 Nov 23 '20 at 21:17
  • the main difference is not the encoding but the type: with pdftex the font is type1 and with latex+dvips+ps2pdf type1C. I don't think that you can get the first with pdftex unless you postprocess the pdf with ghostscript. see also tex.stackexchange.com/a/43478/2388 – Ulrike Fischer Nov 23 '20 at 21:43
1

I’m going to do a frame challenge here. You (practically) never want to do that.

Your file in either of those cases is actually going to use a font in the OT1 encoding. There are no fonts that ship with TeX in the Windows-1252 encoding. If your PDF reader thinks the document is using a different encoding than it really is, that’s not good. It might not be that bad (things like copy-and-paste will break, but maybe you can live with that), but it’s not good.

Could you create your own Type-1 font in the Windows-1252 encoding? Technically you could, but it’d be a lot of effort for no benefit. Modern fonts come encoded in Unicode, not a legacy 8-bit code page. Older Windows fonts used Microsoft’s TrueType instead of the Adobe Type-1 format that PDFTeX does. There aren’t any free, Type-1, Windows-1252 fonts that you could legally upload with your document sources. If you tried to use the first 255 characters in a modern font, they would map to the Latin-1 encoding, which is a subset of Windows-1252 but lacks some important characters, such as opening and closing quotes or em and en dashes.

But, if you’re not required to submit sources that compile in PDFTeX, there’s absolutely nothing forcing you to use legacy 8-bit fonts. If you were able to use Windows-1252, you would be able to just use modern fonts with LuaLaTeX and unicode-math.

  • while I'm not sure why the op wants it (and so if it worth the time to investigate), the question why pdflatex and dvips/ghostscript embeds type1 fonts differently is imho a valid question and has nothing to do with lualatex and opentype fonts. – Ulrike Fischer Nov 23 '20 at 20:46
  • @UlrikeFischer That was a really good comment! But I tried to answer the OP’s question, which was about character sets. – Davislor Nov 26 '20 at 0:59

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.