2

When I enter Garamond as a Font in Libreoffice, I get a nice font which is not listed in the installed fonts. Actually, as Garamond is a paid font, the one displayed on screen is a fallback font. I would like to know how to determine which font is used as a fallback by Ubuntu/Libreoffice. I would also like to find the .ttf file of this font

I would like to know by the way what are the fonts that support natively all Unicodes from Latin Extended Characters.

system used:

  • Ubuntu 18.04
  • Libreoffice 6.0.7.3

On the image bellow, you can see that Garamond is recognised, and displayed in the first paragraph. But it is actually a fallback font.

garamond problem font comparison LibreOffice

remarks - what I have already tried

This question has already been asked a number of times but all the answers are general and don't provide a satisfying answer.

  • archlinux wiki - The "Garamond No. 8" is not the one I can see.
  • Libre Writer recognises 'Garamond' font... - I have tested EB-Garamont and FreeSerif as proposed but it's still not the font I'm looking for. And I don't want to set up a fallback font on Tools > Options > Fonts.
  • OpenOffice (not LibreOffice) font fallback I tried what is written with no success.
  • I have actually to look at the .ttf file directly on linux. I tried with fc-list, fc-list | grep "garamond" and by direct explorations of the directories and config files such as cat fonts.alias | grep "mo", cd /usr/share/fonts with no success. This is comprehensible since I'm not actually looking for the true garamond.ttf file but for its fallback font.
  • I have been searching for fallback font config files. I couldn't find a VCL.xcu file (which is for OpenOffice, not LibreOffice). The fonts.alias doesn't provide the info I'm looking for.
  • How to locate font on Ubuntu Was helpful but the fonts.conf file doesn't provides the info I want.
  • Libre Office shows Garamond but font manager doesn't A very similar question but the 2 answers are not relevant to my problem.

edit 1

Here is what is proposed by @Rinzwind :

 ❮ onyr ★  kenzae❯ ❮ aedoras❯❯ unzip -p garamond_pure.odt styles.xml | xmllint --format - | grep "font-face style:name" | sort -u
I/O error : Permission denied
I/O error : Permission denied
    <style:font-face style:name="Garamond" svg:font-family="Garamond" style:font-family-generic="roman"/>
    <style:font-face style:name="Liberation Sans" svg:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/>
    <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/>
    <style:font-face style:name="Lohit Devanagari1" svg:font-family="'Lohit Devanagari'"/>
    <style:font-face style:name="Lohit Devanagari" svg:font-family="'Lohit Devanagari'" style:font-family-generic="system" style:font-pitch="variable"/>
    <style:font-face style:name="Noto Sans CJK SC" svg:font-family="'Noto Sans CJK SC'" style:font-family-generic="system" style:font-pitch="variable"/>

It gives back a list of fonts used in the .odt document. However the font I want it still written "Garamond" even if what I want is its fallback. I'm going to try the other part of the answer.

For the second method :

Definition of the font default table for your language requires the modification of the file officecfg/registry/data/org/openoffice/VCL.xcu in the source code. The individual VCL.xcu file cannot be found in the installed product. Its contents are merged into /share/registry/main.xcd (where is the directory in which LibreOffice is installed).

I don't know what to do with officecfg. I can't find the /registry directory where my LibreOffice is installed. What should I do ?

 ❮ onyr ★  kenzae❯ ❮ share❯❯ ls -alt
total 12
drwxr-xr-x 6 root root 4096 sept. 28  2019 ..
drwxr-xr-x 2 root root 4096 sept. 28  2019 config
drwxr-xr-x 3 root root 4096 juil. 25  2018 .

2 Answers 2

3

You can use fc-match to get the name of the fallback font. Run the command in a terminal with the name of a font you want to use. If the font does not exist, it will return the name of the fallback font. For example:

$ fc-match Garamond
NotoSerif-osf.ttf: "Noto Serif" "Regular"
1
  • Thank you so much. I got : ``` ❮ onyr ★ kenzae❯ ❮ ~❯❯ fc-match Garamond DejaVuSerif.ttf: "DejaVu Serif" "Book" ```. I is the font I was looking for !
    – Onyr
    Jul 12, 2020 at 18:09
1

Regarding your document specifically:

Your document is a ZIP file you can unzip and the fonts used are in styles.xml.

unzip -p {file} styles.xml | xmllint --format - | grep "font-face style:name" | sort -u

will list the fonts used. For direct formatting you can also use content.xml instead of styles.xml.

Regarding the generic method ...

Libreoffice also uses VCL.xcu. From their wiki:

Define the default fonts for the locale

LibreOffice allows defining what fonts should be used by default for each locale. Here we can define, for example, which font will be used by LibreOffice Writer as default when you use your own language or script, or which font will be used by the user interface for your localized version of LibreOffice.

Definition of the font default table for your language requires the modification of the file officecfg/registry/data/org/openoffice/VCL.xcu in the source code. The individual VCL.xcu file cannot be found in the installed product. Its contents are merged into <LibODir>/share/registry/main.xcd (where <LibODir> is the directory in which LibreOffice is installed).

VCL.xcu is divided into blocks (called nodes), one for each language. The first line of the node for a language includes the standard ISO code for the language. There are two different cases you have to consider here.

...

The font fallback table that establishes the relationships between the fonts is defined in the <node oor:name="FontSubstitutions"> of the file officecfg/registry/data/org/openoffice/VCL.xcu.

7
  • Thanks for the answer. "Your document is a ZIP file", do you mean a .odt is actually a zip file ?
    – Onyr
    Jul 8, 2020 at 14:15
  • 1
    yes you can unzip it and see the actual content Same goes for ods (calc), and also applies to docx, and xlsx (MS Word and MS Excel)
    – Rinzwind
    Jul 8, 2020 at 14:18
  • I test that. I also can't find the /officecfg directory. Any idea where I could find it ? I tried /usr/share
    – Onyr
    Jul 8, 2020 at 14:23
  • I tried your first command which worked but doesn't provide the info I want. I'm trying the second one with "configmgr", but I don't know much about that...
    – Onyr
    Jul 8, 2020 at 14:43
  • Sorry to bother you again but could you explain a bit how I "use configmgr" ? I have no idea of what to do.
    – Onyr
    Jul 8, 2020 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.