using computer modern type1 fonts with openoffice on linux

by Martin Monperrus
You may want to use "Computer Modern" fonts with on Linux for several reasons:
* to have a latex look'n'feel
* to produce PDF files that only contain Type1 fonts (see

This test document produced with OpenOffice shows how type1 font "CM-super/Computer Modern" looks like.

However this font is "too rich" for OpenOffice, it contains too many different styles (up to 30, cf. below). Actually OpenOffice (at least until 2009-06-25 and v3.0.1) can not handle more than 4 different styles (cf The resulting problems range from random font syles to small caps instead of regular characters!

Since the OpenOffice relies on fontconfig to manage fonts, the solution is to tweak fontconfig.
There are several things to do:
1) install package cm-super ($ sudo apt--get install cm-super)
2) install package cm-super-x11 ($ sudo apt--get install cm-super-x11)
3) edit the file ~/.fonts.conf
4) add to it the following lines:
<?xml version="1.0"?>
<!-- we only accept the fonts that we are interested in -->
    <patelt name="family"><string>Computer Modern</string></patelt>
    <patelt name="style"><string>Roman</string></patelt>
    <patelt name="family"><string>Computer Modern</string></patelt>
    <patelt name="style"><string>Roman Bold</string></patelt>
    <patelt name="family"><string>Computer Modern</string></patelt>
    <patelt name="style"><string>Italic</string></patelt>
<!-- we reject all the others, including Computer Modern Concrete and Computer Modern Bright -->
    <patelt name="family"><string>Computer Modern Bright</string></patelt>
    <patelt name="family"><string>Computer Modern Concrete</string></patelt>
    <patelt name="family"><string>Computer Modern</string></patelt>
5) regenerate the fontconfig cache: $ fc-cache -f

PS: They are several versions of "Computer Modern" (CM-super / Latin Modern (lmodern) / Bluesky). However, the Bluesky version contains only US-ASCII characters and can not be used with fontconfig. For lmodern (font name in OO: LMRoman10), I noticed that some chararacters are not correct in the pdf files produced by openoffice (e.g. ê).

Styles of Computer Modern from cm-super :
# before: 30 styles!
$ fc-list "Computer Modern"
Computer Modern:style=Sans Serif Slanted
Computer Modern:style=Roman
Computer Modern:style=Fibonacci Slanted
Computer Modern:style=Slanted
Computer Modern:style=Sans Serif Bold Extended Slanted
Computer Modern:style=Sans Serif
Computer Modern:style=Sans Serif Bold Extended
Computer Modern:style=Bold Extended Caps and Small Caps
Computer Modern:style=Bold Extended
Computer Modern:style=Classical Serif Italic
Computer Modern:style=Slanted Caps and Small Caps
Computer Modern:style=Italic
Computer Modern:style=Roman Bold Variant
Computer Modern:style=Dunhill Roman
Computer Modern:style=Roman Bold
Computer Modern:style=Typewriter Caps and Small Caps
Computer Modern:style=Bold Extended Slanted Caps and Small Caps
Computer Modern:style=Sans Serif Demi Condensed
Computer Modern:style=Variable Width Typewriter Italic
Computer Modern:style=Typewriter
Computer Modern:style=Typewriter Slanted
Computer Modern:style=Typewriter Italic
Computer Modern:style=Variable Width Typewriter
Computer Modern:style=Caps and Small Caps
Computer Modern:style=Bold Extended Italic
Computer Modern:style=Unslanted Italic
Computer Modern:style=Funny Italic
Computer Modern:style=Bold Extended Slanted
Computer Modern:style=Funny Roman
Computer Modern:style=Fibonacci Medium

# after: 3 styles
$ fc-list "Computer Modern"
Computer Modern:style=Roman
Computer Modern:style=Italic
Computer Modern:style=Roman Bold
Tagged as: