host1 has the desired font details of which are below:
uname -a
Linux host1 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ fc-match
StRydeRegular.ttf: "St Ryde" "Regular"
I need the same default font on host2 however I'm not sure what and where changes need to be done.
Below are the details of host2
# uname -a
Linux host2 3.10.0-957.5.1.el7.x86_64 #1 SMP Fri Feb 1 14:54:57 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
[root@vultr /]# fc-match
DejaVuSans.ttf: "DejaVu Sans" "Book"
Can you please suggest any quick and easy fix to default the font on host2 to be StRydeRegular.ttf: "St Ryde" "Regular ?
As a solution i tried to copy /etc/fonts/fonts.conf from host1 to host2 and reload but it gives syntax error like below:
# sudo fc-cache -fv
[root@vultr /]# fc-match
Fontconfig warning: "/etc/fonts/fonts.conf", line 71: unknown element "blank"
Fontconfig error: "/etc/fonts/fonts.conf", line 141: no element found
Fontconfig error: Cannot load config file from /etc/fonts/fonts.conf
DejaVuSans.ttf: "DejaVu Sans" "Book"
Your error message gave you all the clues you need, right?
Fontconfig warning: "/etc/fonts/fonts.conf", line 71: unknown element "blank"
Fontconfig error: "/etc/fonts/fonts.conf", line 141: no element found
Fontconfig error: Cannot load config file from /etc/fonts/fonts.conf
You should fix those errors first, don't you think?
Line 71 was loading the conf.d directory. Thus i copied over the entire /etc/fonts/conf.d directory from host1 to host2 and the error was gone.
I then got error with a tag / element called as blank. See output below.
[root@vultr fonts]# fc-match
Fontconfig warning: "/etc/fonts/fonts.conf", line 86: unknown element "blank"
DejaVuSans.ttf: "DejaVu Sans" "Book"
I then commented out the "blank" tag from fonts.conf and reloaded the font configuration as below.
[root@vultr fonts]# sudo fc-cache -fv
/usr/share/fonts: caching, new cache contents: 0 fonts, 2 dirs
/usr/share/fonts/dejavu: caching, new cache contents: 9 fonts, 0 dirs
/usr/share/fonts/lyx: caching, new cache contents: 12 fonts, 0 dirs
/usr/share/X11/fonts/Type1: skipping, no such directory
/usr/share/X11/fonts/TTF: skipping, no such directory
/usr/local/share/fonts: skipping, no such directory
/root/.local/share/fonts: skipping, no such directory
/root/.fonts: skipping, no such directory
/usr/share/fonts/dejavu: skipping, looped directory detected
/usr/share/fonts/lyx: skipping, looped directory detected
/var/cache/fontconfig: cleaning cache directory
/root/.cache/fontconfig: not cleaning non-existent cache directory
/root/.fontconfig: not cleaning non-existent cache directory
/usr/bin/fc-cache-64: succeeded
Now the errors are gone but it is still defaulting to a different font than the one i needed. Note: apart from the blank tag / element the fonts.conf and the /etc/fonts/conf.d is the same on host1 and host2.
If I were you, the next step I would take is to search for:
StRydeRegular.ttf
(or something similar)
In the directories indicated in your config output:
[root@vultr fonts]# sudo fc-cache -fv
/usr/share/fonts: caching, new cache contents: 0 fonts, 2 dirs
/usr/share/fonts/dejavu: caching, new cache contents: 9 fonts, 0 dirs
/usr/share/fonts/lyx: caching, new cache contents: 12 fonts, 0 dirs
/usr/share/X11/fonts/Type1: skipping, no such directory
/usr/share/X11/fonts/TTF: skipping, no such directory
/usr/local/share/fonts: skipping, no such directory
/root/.local/share/fonts: skipping, no such directory
/root/.fonts: skipping, no such directory
/usr/share/fonts/dejavu: skipping, looped directory detected
/usr/share/fonts/lyx: skipping, looped directory detected
/var/cache/fontconfig: cleaning cache directory
/root/.cache/fontconfig: not cleaning non-existent cache directory
/root/.fontconfig: not cleaning non-existent cache directory
/usr/bin/fc-cache-64: succeeded
My first guess, at this point, is that you have not installed the desired font family in one of the directories required or included in your config file.
As a side note:
More often-than-not, just coping and pasting files and directories from one platform to another, without understanding how they actually work and all the required files and directories, results in the problems you are seeing.
I definitely have the desired font installed as seen below:
[root@vultr fonts]# fc-list | grep StRydeRegular.ttf
/usr/share/fonts/lyx/StRydeRegular.ttf: St Ryde,St Ryde Regular:style=Regular
[root@vultr fonts]# ls -ltr /usr/share/fonts/lyx/StRydeRegular.ttf
-rw-r--r-- 1 root root 107988 Dec 22 2018 /usr/share/fonts/lyx/StRydeRegular.ttf
Here is the ouput of fonts loaded on host1 where it is good:
sudo fc-cache -fv
/usr/share/fonts: caching, new cache contents: 0 fonts, 1 dirs
/usr/share/fonts/lyx: caching, new cache contents: 12 fonts, 0 dirs
/usr/share/X11/fonts/Type1: skipping, no such directory
/usr/share/X11/fonts/TTF: skipping, no such directory
/usr/local/share/fonts: skipping, no such directory
/root/.local/share/fonts: skipping, no such directory
/root/.fonts: skipping, no such directory
/usr/share/fonts: caching, new cache contents: 0 fonts, 1 dirs
/usr/share/X11/fonts/Type1: skipping, no such directory
/usr/share/X11/fonts/TTF: skipping, no such directory
/usr/local/share/fonts: skipping, no such directory
/root/.local/share/fonts: skipping, no such directory
/root/.fonts: skipping, no such directory
/var/cache/fontconfig: cleaning cache directory
/root/.cache/fontconfig: not cleaning non-existent cache directory
/root/.fontconfig: not cleaning non-existent cache directory
fc-cache: succeeded
Here is the output from host2 where i face the issue.
sudo fc-cache -fv
/usr/share/fonts: caching, new cache contents: 0 fonts, 2 dirs
/usr/share/fonts/dejavu: caching, new cache contents: 9 fonts, 0 dirs
/usr/share/fonts/lyx: caching, new cache contents: 12 fonts, 0 dirs
/usr/share/X11/fonts/Type1: skipping, no such directory
/usr/share/X11/fonts/TTF: skipping, no such directory
/usr/local/share/fonts: skipping, no such directory
/root/.local/share/fonts: skipping, no such directory
/root/.fonts: skipping, no such directory
/usr/share/fonts/dejavu: skipping, looped directory detected
/usr/share/fonts/lyx: skipping, looped directory detected
/var/cache/fontconfig: cleaning cache directory
/root/.cache/fontconfig: not cleaning non-existent cache directory
/root/.fontconfig: not cleaning non-existent cache directory
/usr/bin/fc-cache-64: succeeded
I will anyways continue to troubleshoot in other directories.
Sounds like you may have some issues with symbolic links.
Here is a quote from others with this same problem (which you can easily find if you google your error message :hint: :hint: ):
You should know that when you get error messages, you should read them and take them "seriously". They are your friend.
So is Google. Google is also your friend and you can easily Google error messages. I just did (for you). But you are a smart guy and can easily Google your own error messages.
If you don't know how to look at your filesystem and find your symbolic link errors (self-references, dead references, etc.), then just copy the font file in the problematic directory into a "good" directory (according to your verbose output / status messages).
It it was me, I would go fix your symlink errors.
As I mentioned earlier, when IT people just copy directories and files from one filesystem to another without taking the time to actually understand the directories and files, they are copying, this type of error is common.
[root@vultr lyx]# ls -l /usr/share/fonts/lyx/
total 392
-rw-r--r-- 1 root root 20688 May 28 2017 cmex10.ttf
-rw-r--r-- 1 root root 32036 May 28 2017 cmmi10.ttf
-rw-r--r-- 1 root root 26188 May 28 2017 cmr10.ttf
-rw-r--r-- 1 root root 28476 May 28 2017 cmsy10.ttf
-rw-r--r-- 1 root root 24316 May 28 2017 esint10.ttf
-rw-r--r-- 1 root root 23476 May 28 2017 eufm10.ttf
-rw-r--r-- 1 root root 26620 May 28 2017 msam10.ttf
-rw-r--r-- 1 root root 36460 May 28 2017 msbm10.ttf
-rw------- 1 root root 347 Dec 20 17:58 nohup.out
-rw-r--r-- 1 root root 10924 May 28 2017 rsfs10.ttf
-rw-r--r-- 1 root root 18740 May 28 2017 stmary10.ttf
-rw-r--r-- 1 root root 107988 Dec 22 2018 StRydeRegular.ttf
-rw-r--r-- 1 root root 20876 May 28 2017 wasy10.ttf
[root@vultr lyx]# ls -l /usr/share/fonts/
total 8
drwxr-xr-x 2 root root 4096 Dec 20 18:09 dejavu
drwxr-xr-x 2 root root 4096 Dec 20 17:22 lyx
[root@vultr lyx]# cat /etc/fonts/fonts.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/fonts.conf file to configure system font access -->
<fontconfig>
<!--
DO NOT EDIT THIS FILE.
IT WILL BE REPLACED WHEN FONTCONFIG IS UPDATED.
LOCAL CHANGES BELONG IN 'local.conf'.
The intent of this standard configuration file is to be adequate for
most environments. If you have a reasonably normal environment and
have found problems with this configuration, they are probably
things that others will also want fixed. Please submit any
problems to the fontconfig bugzilla system located at fontconfig.org
Note that the normal 'make install' procedure for fontconfig is to
replace any existing fonts.conf file with the new version. Place
any local customizations in local.conf which this file references.
Keith Packard
-->
<!-- Font directory list -->
<dir>/usr/share/fonts</dir>
<dir>/usr/share/X11/fonts/Type1</dir> <dir>/usr/share/X11/fonts/TTF</dir> <dir>/usr/local/share/fonts</dir>
<dir prefix="xdg">fonts</dir>
<!-- the following element will be removed in the future -->
<dir>~/.fonts</dir>
<!--
Accept deprecated 'mono' alias, replacing it with 'monospace'
-->
<match target="pattern">
<test qual="any" name="family">
<string>mono</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>monospace</string>
</edit>
</match>
<!--
Accept alternate 'sans serif' spelling, replacing it with 'sans-serif'
-->
<match target="pattern">
<test qual="any" name="family">
<string>sans serif</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>sans-serif</string>
</edit>
</match>
<!--
Accept deprecated 'sans' alias, replacing it with 'sans-serif'
-->
<match target="pattern">
<test qual="any" name="family">
<string>sans</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>sans-serif</string>
</edit>
</match>
<!--
Load local system customization file
-->
<include ignore_missing="yes">/etc/fonts/conf.d</include>
<!-- Font cache directory list -->
<cachedir>/var/cache/fontconfig</cachedir>
<cachedir prefix="xdg">fontconfig</cachedir>
<!-- the following element will be removed in the future -->
<cachedir>~/.fontconfig</cachedir>
<config>
<!--
These are the default Unicode chars that are expected to be blank
in fonts. All other blank chars are assumed to be broken and
won't appear in the resulting charsets
-->
<!-- <blank> -->
<int>0x0020</int> <!-- SPACE -->
<int>0x00A0</int> <!-- NO-BREAK SPACE -->
<int>0x00AD</int> <!-- SOFT HYPHEN -->
<int>0x034F</int> <!-- COMBINING GRAPHEME JOINER -->
<int>0x0600</int> <!-- ARABIC NUMBER SIGN -->
<int>0x0601</int> <!-- ARABIC SIGN SANAH -->
<int>0x0602</int> <!-- ARABIC FOOTNOTE MARKER -->
<int>0x0603</int> <!-- ARABIC SIGN SAFHA -->
<int>0x06DD</int> <!-- ARABIC END OF AYAH -->
<int>0x070F</int> <!-- SYRIAC ABBREVIATION MARK -->
<int>0x115F</int> <!-- HANGUL CHOSEONG FILLER -->
<int>0x1160</int> <!-- HANGUL JUNGSEONG FILLER -->
<int>0x1680</int> <!-- OGHAM SPACE MARK -->
<int>0x17B4</int> <!-- KHMER VOWEL INHERENT AQ -->
<int>0x17B5</int> <!-- KHMER VOWEL INHERENT AA -->
<int>0x180E</int> <!-- MONGOLIAN VOWEL SEPARATOR -->
<int>0x2000</int> <!-- EN QUAD -->
<int>0x2001</int> <!-- EM QUAD -->
<int>0x2002</int> <!-- EN SPACE -->
<int>0x2003</int> <!-- EM SPACE -->
<int>0x2004</int> <!-- THREE-PER-EM SPACE -->
<int>0x2005</int> <!-- FOUR-PER-EM SPACE -->
<int>0x2006</int> <!-- SIX-PER-EM SPACE -->
<int>0x2007</int> <!-- FIGURE SPACE -->
<int>0x2008</int> <!-- PUNCTUATION SPACE -->
<int>0x2009</int> <!-- THIN SPACE -->
<int>0x200A</int> <!-- HAIR SPACE -->
<int>0x200B</int> <!-- ZERO WIDTH SPACE -->
<int>0x200C</int> <!-- ZERO WIDTH NON-JOINER -->
<int>0x200D</int> <!-- ZERO WIDTH JOINER -->
<int>0x200E</int> <!-- LEFT-TO-RIGHT MARK -->
<int>0x200F</int> <!-- RIGHT-TO-LEFT MARK -->
<int>0x2028</int> <!-- LINE SEPARATOR -->
<int>0x2029</int> <!-- PARAGRAPH SEPARATOR -->
<int>0x202A</int> <!-- LEFT-TO-RIGHT EMBEDDING -->
<int>0x202B</int> <!-- RIGHT-TO-LEFT EMBEDDING -->
<int>0x202C</int> <!-- POP DIRECTIONAL FORMATTING -->
<int>0x202D</int> <!-- LEFT-TO-RIGHT OVERRIDE -->
<int>0x202E</int> <!-- RIGHT-TO-LEFT OVERRIDE -->
<int>0x202F</int> <!-- NARROW NO-BREAK SPACE -->
<int>0x205F</int> <!-- MEDIUM MATHEMATICAL SPACE -->
<int>0x2060</int> <!-- WORD JOINER -->
<int>0x2061</int> <!-- FUNCTION APPLICATION -->
<int>0x2062</int> <!-- INVISIBLE TIMES -->
<int>0x2063</int> <!-- INVISIBLE SEPARATOR -->
<int>0x206A</int> <!-- INHIBIT SYMMETRIC SWAPPING -->
<int>0x206B</int> <!-- ACTIVATE SYMMETRIC SWAPPING -->
<int>0x206C</int> <!-- INHIBIT ARABIC FORM SHAPING -->
<int>0x206D</int> <!-- ACTIVATE ARABIC FORM SHAPING -->
<int>0x206E</int> <!-- NATIONAL DIGIT SHAPES -->
<int>0x206F</int> <!-- NOMINAL DIGIT SHAPES -->
<int>0x2800</int> <!-- BRAILLE PATTERN BLANK -->
<int>0x3000</int> <!-- IDEOGRAPHIC SPACE -->
<int>0x3164</int> <!-- HANGUL FILLER -->
<int>0xFEFF</int> <!-- ZERO WIDTH NO-BREAK SPACE -->
<int>0xFFA0</int> <!-- HALFWIDTH HANGUL FILLER -->
<int>0xFFF9</int> <!-- INTERLINEAR ANNOTATION ANCHOR -->
<int>0xFFFA</int> <!-- INTERLINEAR ANNOTATION SEPARATOR -->
<int>0xFFFB</int> <!-- INTERLINEAR ANNOTATION TERMINATOR -->
<!-- </blank> -->
<!--
Rescan configuration every 30 seconds when FcFontSetList is called
-->
<rescan>
<int>30</int>
</rescan>
</config>
</fontconfig>
[root@vultr lyx]# ls -l /etc/fonts/conf.d
total 96
-rw-r--r-- 1 root root 1952 Dec 22 04:28 10-scale-bitmap-fonts.conf
-rw-r--r-- 1 root root 1259 Dec 22 04:28 20-unhint-small-vera.conf
-rw-r--r-- 1 root root 1160 Dec 22 04:28 25-no-bitmap-fedora.conf
-rw-r--r-- 1 root root 3256 Dec 22 04:28 25-unhint-nonlatin.conf
-rw-r--r-- 1 root root 5618 Dec 22 04:28 30-metric-aliases.conf
-rw-r--r-- 1 root root 1198 Dec 22 04:28 30-urw-aliases.conf
-rw-r--r-- 1 root root 5182 Dec 22 04:28 40-nonlatin.conf
-rw-r--r-- 1 root root 6261 Dec 22 04:28 45-latin.conf
-rw-r--r-- 1 root root 545 Dec 22 04:28 49-sansserif.conf
-rw-r--r-- 1 root root 673 Dec 22 04:28 50-user.conf
-rw-r--r-- 1 root root 189 Dec 22 04:28 51-local.conf
-rw-r--r-- 1 root root 1701 Dec 22 04:28 60-latin.conf
-rw-r--r-- 1 root root 10118 Dec 22 04:28 65-fonts-persian.conf
-rw-r--r-- 1 root root 7959 Dec 22 04:28 65-nonlatin.conf
-rw-r--r-- 1 root root 672 Dec 22 04:28 69-unifont.conf
-rw-r--r-- 1 root root 422 Dec 22 04:28 80-delicious.conf
-rw-r--r-- 1 root root 1691 Dec 22 04:28 90-synthetic.conf
-rw-r--r-- 1 root root 978 Dec 22 04:28 README
[root@vultr lyx]# ls -l /etc/fonts/conf.avail
ls: cannot access /etc/fonts/conf.avail: No such file or directory
Because "DejaVuSans-Bold.ttf" appears first (your default) when you do fc-cat , you need to change your configuration so "StRydeRegular.ttf" is first (your default).
There are numerous ways to accomplish this.
One quick and easy way would be to move your favorite font to a directory which is processed first (and rebuild your font cache, of course).
@Neo Thank you for the help but the issue persists despite fixing the fc-cat precedence issue.
I created this folder: /usr/share/X11/fonts/TTF and copied the desired font "StRydeRegular.ttf" file and "lyx" folder in it and reloaded the configuration with fc-cache -fv .