Bug 64509

Summary: CONFIGURATION: Enhance Font Substitution Table
Product: LibreOffice Reporter: João Paulo <joaopauloag-freedesktop>
Component: InstallationAssignee: Not Assigned <libreoffice-bugs>
Status: NEW --- QA Contact:
Severity: major    
Priority: medium CC: caolanm, serval2412
Version: 4.0.3.3 release   
Hardware: x86 (IA32)   
OS: All   
See Also: https://bugs.freedesktop.org/show_bug.cgi?id=61134
Whiteboard: BSA
i915 platform: i915 features:

Description João Paulo 2013-05-12 21:10:37 UTC
Problem description: 

There are many fonts in existence, yet one's system doesn't have it all installed.

There are fonts which originated from real world types (digitized fonts), but each type designer or foundry made it differently from each other.

They are the so called fonts variations, as Adobe Caslon (Carol Twombly based on William Caslon's specimens pages), and ITC Founder's Caslon (digitized by Justin Howes, based on  resources of the St. Bride Printing Library).

And there are fonts whose types originated on the virtual world (virtual typefaces), even if the initial drawings were made on paper. These fonts could have been abandoned by their designers or foundries, but adopted by others; they could have been licensed in such a way the name of the font should be changed; or they could have intended variations for each script so to avoid software issues.

The primary examples for the first case are the TeX GYRE Collection of Fonts (Bonum, Chorus, Cursor, Heros, Pagella, Schola, Termes are all based, respectively, on URW Gothic L, URW Bookman L, URW Chancery L Medium Italic, URW Nimbus Mono L - itself based on IBM's Courier, URW Nimbus Sans - itself based on Helvetica, URW Palladio L, URW Century Schoolbook L, Nimbus Roman No9 L - itself based on Times); for the second case we have the BitStream Vera and DejaVu families of fonts; and for the latter we have the DejaVu and DejaVu LGC (which contains only Latin, Greek, and Cyrillic characters, instead of Chinese, Japanese, Korean and Arabic characters).

To ease the life of many users not typographic savvy, LibreOffice should have a preinstalled font substitution table, at the same time it should indicate when the fonts needed to render a file isn't installed on the system (such as a warning when opening it).

Steps to reproduce:

1. Create a document on a machine which has, for example, the Calligraffiti font installed (a calligraphic font available for free at http://www.fontsquirrel.com/fonts/calligraffiti), and format it to use the font.
2. Send it to another user who doesn't have the font (or just uninstall the font from the system).
3. Open the file on a system without the font.

Current behavior:

LibreOffice doesn't show any messages the font specified on the file doesn't exist on the system; worse, it shows the name of the font on the toolbar and presents it as the sans serif font DejaVu Sans.

Expected behavior:

LibreOffice should warn the user that because the Calligraffiti font isn't available on the system it will use <font name> on its place.

And for the well known families of fonts which have been substituted, such as the TeX GYRE Fonts (http://www.gust.org.pl/projects-1/e-foundry/tex-gyre), LibreOffice could have it prepopulated on the font substitution table.
Operating System: All
Version: unspecified
Comment 1 Julien Nabet 2013-05-18 06:46:46 UTC
What's your LO version? on which env are you?
Comment 2 João Paulo 2013-05-19 16:36:37 UTC
(In reply to comment #1)
> What's your LO version? on which env are you?

I am running LibreOffice 4.0.3.3 on Windows XP and Vista, but I found this behavior on every LO release since the fork from OpenOffice.org, and also on every OOo release I used then.
Comment 3 João Paulo 2013-05-19 16:43:32 UTC
Maybe I should create another bug for the lack of warning when the font isn't installed on the user's system? Because I realized I reported two bugs:
- the lack of a prepopulated font substitution table (installation issue);
- the lack of a warning the font isn't installed nor substituted (UI issue).
Comment 4 João Paulo 2013-05-19 16:57:20 UTC
I created a small table for well known fonts (and the Lobster font):

Lobster				Lobster Two

Bitstream Vera Sans		DejaVu Sans
Bitstream Vera Sans Mono	DejaVu Sans Mono
Bitstream Vera Serif		DejaVu Serif

CenturySchL			TeXGyreSchola
NimbusMonL			TeXGyreCursor
NimbusMono			TeXGyreCursor
NimbusRomanNo9			TeXGyreTermes
NimbusRomNo9L			TeXGyreTermes
NimbusSanL			TeXGyreHeros
NimbusSanLCon			TeXGyreHerosCn
URWBookmanL			TeX Gyre Bonum
URWChanceryLMed			TeXGyreChorus
URWGothicL			TeXGyreAdventor
URWGothicLDem			TeXGyreAdventor
URWPalladioL			TeXGyrePagella

And a small table for fonts that always should be substituted, regardless of having the font on the system (the "G" versions have Graphite enabled, so its rendering is better):

Linux Biolinum			Linux Biolinum G
Linux Libertine			Linux Libertine G
Comment 5 Julien Nabet 2013-05-20 17:04:36 UTC
On pc Debian x86-64 with master sources updated today, I reproduced the problem.

Caolán: one for you?
Comment 6 Caolán McNamara 2013-06-05 16:17:20 UTC
re "not reporting the font is not installed and is being substituted"

in 4.1 the font name is italicized in the font selectors if it's not installed, so that's fixed now.

re "having a substitution table", so...

for most Unix platforms e.g Linux we run the font through fontconfig which has a pile of rules and tables to give the best replacement font. So on those platforms this is "taken care of", and on MacOSX there's a similar built-in MacOSX thing I believe.

The remaining issue is Windows, there we use our built-in tables in registry/data/org/openoffice/VCL.xcu (http://opengrok.libreoffice.org/xref/core/officecfg/registry/data/org/openoffice/VCL.xcu) see near the end, the section starting with <node oor:name="FontSubstitutions"> so we should already have the bitstreamverasans replacements for example.

It shouldn't be too hard to add to add extra entries or improve the existing ones. Not something for me though, seeing as it doesn't affect the platform I develop on.

I suggest you have a go at adding what entries are missing there from your own list and submit the result to us. See https://wiki.documentfoundation.org/Development/Patch_Handling_Guidelines for some help.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.