On Sunday, 9 March 2025 10:51:41 GMT Nikita Ivanov wrote:
> Hello!
> 
> I've been playing around with groff recently and once again discovered
> that there is a lot of friction involved if you want to use groff with
> Cyrillic characters (and probably other kinds of non-latin characters
> too).
> 
> Usually I have to install a new font to use for the documents, because
> otherwise I get errors like this:
> 
>     troff:example.ms:85: warning: special character 'u044A' not defined
> 
> But today I've discovered that groff does not have its own fonts, it
> uses fonts provided by ghostscript, it seems. I might be wrong about
> some details here, please enlighten me! But the point is that such fonts
> are likely to already include Cyrillic characters.
> 
> So I ran a little experiment by changing TR font description file in
> font/devpdf and adding metrics for Cyrillic characters from the other
> font I've used. And it worked! I got Cyrillic characters to render
> properly without any warnings.
> 
> Which raises a question: what prevents groff to include other common
> characters (like Cyrillic) in its font description files out of the box?

Hi Nikita,

Groff does supply fonts which contain cyrillic glyphs, they should be in the 
fonts/devpdf directory and called U-*. In order to use them simply use .fam U-
T instead of .fam T, or \f[U-TR] instead of \f(TR, etc..

All the groff URW pdf fonts should have a U- version which contain more glyphs 
(including cyrillic) than the standard postscript version.

The reason for having separate "foundries" like this is because the U- fonts 
also have substantially more kerning pairs than their original postscript 
counterpart, so in order to maintain compatibility with the postscript device 
driver the same groff fonts are used for pdfs. Otherwise a pdf produced via 
grops -> ps2pdf would look different from the same document run with -Tpdf.

There is a shortcut which will cause groff to use the extended fonts (for one 
family only). If you include "-fU-T" in the groff command then groff will 
replace the whole Times-Roman family with its U- version (until the next .fam 
request). I have wished groff had a flag which let you pick the U- foundry for 
all fonts, for many years, but alas!

Cheers 

Deri



Reply via email to