# Custom font for LaTeX+dvips

\documentclass[twoside, openany]{book}

\usepackage[dvipsnames,svgnames,x11names]{xcolor}
\usepackage[dvips]{graphicx}
\usepackage{lipsum}

\special{papersize=145mm,220mm}
\textwidth=113mm \textheight=180mm
\topmargin=-14mm
\footskip=11mm
\oddsidemargin=-12.6mm
\evensidemargin=-6.4mm

\newfont{\weird}{abcr8r at 14pt}

\begin{document}
{\weird 1234567890 abcd}
\medskip
\lipsum
\end{document}


The Publisher needs the pagestyle with pagenumber and headings with EuropaDemi font (and they have no own stylefile and even almost never work with LaTeX manuscripts!)

I took this font EuropeDemi.otf and after some conversions with creation afm-, tfm-, ttf- and vf- files I have created new TTFONTS folder and added it into config. Thus I have assigned this font as some new fontfamily 'abc'.

In TFM-folder there are 5 files: abcr8r, abcr8t, abcr7t, abcr6a and rabcr6a (though no difference in their usage is detected)

For texifying I need LateX->Dvips (and russian encodings)

But in *.dvi and *.ps these newfont-letters look as rasterized, with bad margins. Though the original EuropeDemi.otf in Microsoft Word, say, looks OK if I increase resolution or increase the lettersize.

1) Does anybody know the reason and ways to fix/avoid? Maybe some 'internal' ways to add this font (like packages, not the creation of these files by myself).

2) What do the numbers 6,7,8 in the tfm-files names (abcr8r, abcr8t, abcr7t, abcr6a and rabcr6a) mean? For pagenumbers I need 14pt, for title even larger

Thanks

• Comments are not for extended discussion; this conversation has been moved to chat. Nov 18, 2016 at 9:51

If XeLaTeX is an option, then you can use the font easily by installing it for your OS and using fontspec. This has the advantage of allowing you to use \specials which you cannot use with pdfLaTeX, because XeLaTeX processes .tex in a multi-stage process, similar to the process of using LaTeX followed by post-compilation conversion to PDF.

I don't have your font, but here's an example with one I do have. Note that we need to specify a non-default driver for geometry in order to allow the \specials. The default is xetex but your comments suggest that this may be less suitable for your code and that you probably want to specify an alternative. I've used geometry because this is recommended over setting layout dimensions manually and will automatically ensure that appropriate options are passed through to the back-end driver.

\documentclass[twoside, openany]{book}
\usepackage[dvipsnames,svgnames,x11names]{xcolor}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{geometry}
\geometry{driver=dvipdfm,,papersize={145mm,220mm},textheight=180mm,footskip=11mm,inner=12.8mm,outer=19mm,verbose}
\usepackage{fontspec}
\newfontfamily\myweirdfont{Neris Light}
\DeclareRobustCommand\weird{\fontsize{14pt}{18pt}\myweirdfont}

\begin{document}
{\weird 1234567890 abcd\par}
\medskip
\lipsum
\end{document}


I don't have any Cyrillic to test, but polyglossia can be used or babel will also work. fontspec can switch to the Cyrillic script when required. See fontspec's manual and, if applicable, polyglossia's.

Note that this solution requires your .tex file to be UTF-8 encoded. If you have any trouble with standard TeX ligatures such as --, --- etc., you may have an older version of fontspec. In that case just add

\defaultfontfeatures{Ligatures=TeX}


which is now default but did not used to be.

1. Dvips cannot handle ttf fonts, only pk and Type1 (pfb) fonts; so, in the absence of a sensible pfb, it falls back to Metafont or, in your case, ttf2pk to produce and include raster fonts.

2. You need to read the fontname documentation which explains the "standard" naming scheme for fonts constrained by the 8.3 format of lore (DOS and VAX, for instance). In this case, 8r is 8bit raw; 8t is 8bit Cork TeX encoding; 7t is 7bit Old TeX encoding; 6a is for the T2A Cyrillic encodings. All fonts for 8bit TeXes need an encoding identifier to use the appropriate alphabets/scripts.

So, if you want to go the old [La]TeX+dvips way, you'll need:

1. sourcefontname.pfb and sourcefontname.afm files. You could get these files by processing your font with, say, FontForge.

2. Make tfm files for your font with the appropriate encodings following the instructions given for LY1 on TUG, for instance:

afm2tfm [sourcefontname] -T T2A.enc -v [targetfontname].vpl >> [targetfontname].map
pltotf [targetfontname].vpl


You should get a targetfontname.tfm and a targetfontname.map files, which you should install; and a temporary targetfontname.vpl which you may discard.

Alternatively, you may use the afm2pl tool.

afm2pl -p T2A.enc [sourcefontname] [targetfontname]
pltotf [targetfontname]

1. Put the pfb file in /fonts/type1/foundry", the tfm file in /fonts/tfm/foundry, and the map in the /fonts/map/dvips directories, and execute updmap --add targetfontname.map on your system.

2. Load the [targetfontname] in your source code and execute LaTeX and dvips as usual. This procedure also sets up your font for pdflatex.

If you decide to go this way, I encourage you to follow the guidelines given in fontname to put names to your fonts. It's just a matter of standardization.

Syntax for the font utilities may vary if you use a non-TeXLive based implementation, like MikTeX's. Check your documentation for details.