When documents are sent from one computer to the next or opened on the same computer in a different operating system, these documents may not look the same unless all the fonts used in the document are available on the other computer or operating system. For this reason, exporting documents as a PDFs is so popular as it renders the document exactly like how it would be printed without any reliance on fonts. This proposal attempts to provide users with a user friendly way in dealing with missing fonts.
The first step to fixing this issue is to notify users when they open a document that contains missing fonts and are being substituted. This can be achieved with LibreOffice’s existing infobar implementation, which is also used to notify a user that they are opening a read-only document. In order to limit the occurrence of this infobar to only when it is really needed, the infobar won’t appear when only metrically compatible fonts are being substituted, which LibreOffice bundles.
Figure 1: Example on how the infobar could look in case of missing fonts.
The user has the option to dismiss the notice or click on the ‘View Font List’ button which opens the document properties dialog (or alternatively a completely new one). The dialog will lists all the fonts used in the document (both in styles and applied through direct formatting), as well as indicate which ones are missing and the font that it is being substituted with.
Font Installation and Substitution
The fonts used in a document can be considered general document information and therefore perfectly suited for the document properties dialog (File > Properties…). The dialog has a Font tab that only has the option to embed fonts into a document, so it can be enhanced by listing the fonts and their font substitutes. We made two mockups on how it can be presented, shown in figure 2.
Figure 2: Two dialog variants of font substitution.
Both mockups display a font grid that lists all fonts in the document and gives an overview of which one are installed, which are being simulated due to a missing style of an installed font, or which font is being used as a substitute.
In the left mockup, the font list identifies fonts that are not installed by having their names in italic. When a row is selected, an inline dropdown list appears in the substitution column and is populated with all installed fonts to provide a means to define another font to be used as a replacement. The sort order may be adjusted to what is going to be substituted. If the user wants to install an alternative font, they can click the ‘Install font’ button which opens a dialog that an access the extension site filtered for fonts (a proposal for a generic approach has been made and is in preparation for a blog post). Searching this list should be easy, here exemplified with “Comic”, and installing allows subsequently to select this font in the substitution table. (Not all fonts need to be hosted on the extensions site; links are sufficient to forward to the right place.)
In the right mockup, the font list has an ‘Installed’ column to identify if a font is installed. When a row has been selected, a user can click the “Install” group button which opens a menu of items to install the missing font or an open source alternative. Linux users will also be able to install the original or alternative fonts through their package manager. The “Install All” menu item will iterate through the font list and install any missing fonts from their original sources. Additionally they can apply a different substitute font to the currently selected font grid row by clicking the ‘Apply substitute’ entry in the “Substitute” group button or replace all occurrences of a font with another font within the document with the “Replace font” entry.
Behind the scenes
In order to provide the necessary functionality to install a font and its alternative, as proposed in the right mockup, this functionality needs to reply on a configuration file. This configuration file will be XML based and will catalog fonts, their open source alternatives, and their download urls. The XML structure will possibly look like so.
Presently, the only visual indication in the font name combobox that a font is being substituted is that the font name is italic. There is another visual indicator in the form of additional text appearing in the tooltip, but this is easily ignored as the tooltip only appears for a second before the control is clicked.
In order to better indicate the substitution of the font, we have to make a bigger change to the displayed text, like changing it to red (tdf#96872), and also indicate the font that is being used for the substitution, both in the font name and the tooltip (tdf#61134).
Figure 3: Fonts being substituted may get indicated better in future by either a highlight color or using an icon. Or both.
Similar to the toolbar, the Font tab found in the character and style dialogs also need improvements. The text labels ‘This font style will be simulated or the closest matching style will be used.’ and ‘This font has not been installed. The closest available font will be used.’ that appear under the font family drop down listboxes in the dialogs need clearer indication than simply being in the same simple style as when it says ‘The same font will be used on both your printer and your screen’. Either the text style needs to be changed (italics, bold, or red) or a warning icon would appear at its start.
The styling of text with the use of fonts has been around since the invention of the Graphical User Interface (GUI) and thanks to the availability of the internet, documents with styled text are being seen and shared on an ever growing daily basis, so we need to make it easy for users to see the documents they open in the same format that the author created them in.