3

I am running Kubuntu 20.04. I have a problem where certain fonts (Courier and Century Schoolbook L) are broken in applications like Inkscape (where they are invisible) or font-manager where they show like this: Font-manager with broken fonts

They also don't show up in Libre office (Don't really care about this as I rarely touch word-processors).

All broken fonts are .pfb fonts installed through TeX-live or ghostscript. As the font is already installed I am not able to install TTFs of the font I need. Obviously I do not want to uninstall ghostscript or tex-live as I use them regularly.

I have tried running

sudo fc-cache -f -v

to no avail. The font show up find in KFontView: enter image description here

The bug is particularly frustrating as I have existing artwork in inskcape which used courier and Century Schoolbook L.

Is there a way to fix this?

Zanna
  • 70,465
  • 1
    Well, I don't have a working solution. What is the error message you get when trying to install .ttf alternatives? Not sure if changing their filename or internal name will work? One approach that can work too (but advanced, currently I am not good at freedesktop font-config) , it is using different folder for .ttf files line like font folder at home, then configure font-config to use them depending on application. ref: https://www.freedesktop.org/software/fontconfig/fontconfig-user.html – user.dz Oct 23 '20 at 10:48
  • @xiota I'm not sure if we talking on same thing. fontconfig (& freetype) still support pfb files. fontconfig works fine with same font with different format. I expect on GUI installation issue that verify font internal name, in the end you can just copy the files directly to fonts folder. For fontconfig, you already make an example in you question, It seems not perfect yet as drop that font format for all apps while upstream texlive doc saying: fontconfig (needed by XeTeX and LuaTeX). So there is a need for an exception that texlive can use those fonts and that what the OP is asking for. – user.dz Oct 25 '20 at 10:25
  • @xiota No problem. I agree about apps support. Btw, Your answer could be enough solution for OP. We don't know the OP workflow and which tools in Texlive he is using. I will wait the OP feedback, I'm here to learn..not kind of expert :). Thank you. – user.dz Oct 25 '20 at 13:43

2 Answers2

3

Many programs have explicitly dropped support for Type 1 fonts, years ago. While fontconfig and FreeType do support Type 1 fonts, many other libraries and programs don't. In most cases, fontconfig just passes font locations to the program, which can either use another library or render them itself. That's why the fonts render inconsistently across programs.

Cross-platform applications, such as LibreOffice, Inkscape, and Firefox, in particular are likely to have dropped Type 1 support because they are working with the least common denominator. According to Wikipedia, "[Type 1 fonts] are not supported in the Windows GDI+, WPF or DirectWrite APIs." Other issues with Type 1 fonts are limited character set and absent unicode support.

Going forward, the trend is to see less and less Type 1 use. Ultimately, the only programs that will support it are the ones that have to, namely PDF/PS viewers and font editors. Once this happens, there's no easy way to recover Type 1 support except to go back to using software from five or more years ago, when Type 1 support was more prevalent.


To avoid seeing "broken" Type 1 fonts, you can configure fontconfig to hide them. This is basically jumping forward to where Type 1 support is heading.

Create the file /etc/fonts/conf.d/00-reject-type1.conf with the following contents:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "/etc/fonts/conf.d/fonts.dtd">
<fontconfig>

<selectfont> <rejectfont> <pattern><patelt name="fontformat"> <string>Type 1</string> </patelt></pattern> </rejectfont> </selectfont>

</fontconfig>

Then refresh the font cache with sudo fc-cache -r.

Font viewers and editors should continue to work as expected, as long as they access the font files directly.

PDFs with embedded fonts should display correctly. When external fonts are referenced, they should use the OpenType or TrueType font that fontconfig specifies. (I use Okular. Other Poppler based viewers should behave similarly.)


TrueType and OpenType versions of most Type 1 fonts are available. Many converted fonts have been extended with unicode support. Here are a few packages:

  • fonts-urw-base35
  • fonts-texgyre
  • fonts-lmodern

Some typefaces will have different names. If the fonts are installed via the package manager, fontconfig should be configured to substitute the correct fonts. If you install fonts by copying font files, you'll have to configure font substitution yourself or manually change font names in documents.

  • Avant Garde Gothic ~ TeX Gyre Adventor ~ URW Gothic
  • Bookman ~ TeX Gyre Bonum
  • Century Schoolbook ~ TeX Gyre Schola ~ C059
  • Chancery ~ TeX Gyre Chorus ~ Z003
  • Courier ~ TeX Gyre Cursor ~ Nimbus Mono
  • Dingbats ~ D050000L
  • Helvetica ~ TeX Gyre Heros ~ Nimbus Sans
  • Palatino ~ Palladio ~ TeX Gyre Pagella ~ P052
  • Times ~ TeX Gyre Termes ~ Nimus Roman

The behavior of TeX Live with Type 1 fonts hidden in fontconfig is as follows...

  • latex + dvipdf embeds Type 1C fonts.
  • pdflatex embeds Type 1 fonts.
  • xelatex and luatex embed Type 1C and CID Type 0C fonts.
    • TrueType and OpenType fonts can also be specified and embedded.

This is the test document I used:

\documentclass{article}

\usepackage[utf8]{inputenc} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb}

\usepackage{lipsum} %%\usepackage{fontspec} %\usepackage{mathspec}

%\setmainfont{Noto Serif} %\setmonofont[Scale=0.8]{Noto Sans Mono}

%\setmathsfont(Digits,Latin,Greek){Noto Serif} %\setmathrm{Noto Serif}

\begin{document}

\lipsum[1]

[ \int_0^\infty \frac{1}{x} ;\mathrm{d}x ]

\raggedright \tt{\lipsum[2]}

\end{document}

xiota
  • 4,849
  • Similar problem as OP in gimp and gnome-terminal (e.g. Courier shows boxes with numbers in place of glyphs) Creating 00-reject-type1.conf did remove the broken fonts from the font browsers, but some clarification is needed (e.g. apt install xyz) to install the replacement fonts. Courier is just really critical. – erco Sep 21 '21 at 00:43
  • Clarification: You need to install replacement fonts to use them. – xiota Sep 21 '21 at 01:21
1

In a lot of places in the 20.04 release support for Type1/.pfb fonts has been dropped. An .otf version of Century Schoolbook is available under the name C059. URW's version of Courier is available as Nimbus Mono PS.

Also, you can convert Type1 fonts to .ttf with fontforge.

Siep
  • 121
  • Converting the TeX-live fonts manually is not really an acceptable solution. The fact that the offical PPA for major packages loads in broken fonts is problematic – Julian Stirling Oct 18 '20 at 21:24
  • Within Ubuntu TeX Live, Type1 fonts are supported as of old. – Siep Oct 20 '20 at 13:08