Roboto font comes from Android and Google designed it really well. It looks awesome on desktops and laptops. But getting it working as a default system font in Linux is quite a task because the font package of Roboto available has multiple font forms declaring same type of text style.
The standard Roboto package consists of following fonts:
- Roboto-BlackItalic
- Roboto-Black
- Roboto-BoldCondensedItalic
- Roboto-BoldCondensed
- Roboto-BoldItalic
- Roboto-Bold
- Roboto-CondensedItalic
- Roboto-Condensed
- Roboto-Italic
- Roboto-LightItalic
- Roboto-Light
- Roboto-MediumItalic
- Roboto-Medium
- Roboto-Regular
- Roboto-ThinItalic
- Roboto-Thin
Now the problem is, Roboto Black, Roboto Regular and Roboto Medium, are selected as candidates for the standard font. See the output below:
$ fc-query /usr/share/fonts/roboto/Roboto-{Black,Regular,Medium}.ttf
Pattern has 20 elts (size 32)
family: "Roboto"(s) "Roboto Bk"(s)
familylang: "en"(s) "en"(s)
style: "Black"(s) "Bold"(s)
stylelang: "en"(s) "en"(s)
fullname: "Roboto Black"(s)
fullnamelang: "en"(s)
slant: 0(i)(s)
weight: 80(i)(s)
width: 100(i)(s)
foundry: "unknown"(s)
file: "/usr/share/fonts/roboto/Roboto-Black.ttf"(s)
index: 0(i)(s)
outline: FcTrue(s)
scalable: FcTrue(s)
charset:
0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ffffffff ffffffff ffffffff
0001: ffffffff ffffffff ffffffff ffffffff 00040000 00018003 00000000 fc010000
0002: 03000000 00800000 00000000 00000000 00000000 10000000 3f0002c0 00080000
0003: 0000820b 00000008 00000000 00000000 ffffd7f0 fffffffb 00467fff 00000000
0004: ffffffff ffffffff ffffffff ffffffff ffffff7f ffffffff ffffffff ffffffff
0005: 000fffff 00000000 00000000 00000000 00000000 00000000 00000000 00000000
001e: 00000003 c0000000 00000000 00000000 0000003f ffffffff ffffffff 03ffffff
001f: 00000000 00000000 00002000 00000000 00000000 00000000 00000000 00000000
0020: 7fb80fff 160d0067 00000010 80100000 00000000 00001898 00000000 00000000
0021: 00480020 00004044 78000000 00000000 00000000 00000000 00000000 00000000
0022: 44068044 00000800 00000100 00000031 00000000 00000000 00000000 00000000
0025: 00000000 00000000 00000000 00000000 00000000 00000000 00000400 00000000
00f6: 00000000 00000000 00000000 00000000 00000000 00000000 00000008 00000000
00fb: 0000001e 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00fe: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 80000000
00ff: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 30000000
(s)
lang: aa|ab|af|av|ay|ba|be|bg|bi|bin|br|bs|bua|ca|ce|ch|chm|co|cs|cu|cv|cy|da|de|el|en|eo|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl|gn|gv|ho|hr|hu|ia|ig|id|ie|ik|io|is|it|kaa|ki|kk|kl|kum|kv|ky|la|lb|lez|lt|lv|mg|mh|mk|mt|nb|nds|nl|nn|no|nr|nso|ny|oc|om|os|pl|pt|rm|ru|sah|se|sel|sh|sk|sl|sma|smj|smn|so|sq|sr|ss|st|sv|sw|tg|tk|tl|tn|tr|ts|tt|tyv|uk|uz|vo|vot|wa|wen|wo|xh|yap|zu|an|crh|csb|fil|hsb|ht|jv|kj|ku-tr|kwm|lg|li|mn-mn|ms|na|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|ty|za(s)
fontversion: 65536(i)(s)
capability: "otlayout:DFLT"(s)
fontformat: "TrueType"(s)
decorative: FcFalse(s)
Pattern has 20 elts (size 32)
family: "Roboto"(s)
familylang: "en"(s)
style: "Regular"(s)
stylelang: "en"(s)
fullname: "Roboto Regular"(s)
fullnamelang: "en"(s)
slant: 0(i)(s)
weight: 80(i)(s)
width: 100(i)(s)
foundry: "unknown"(s)
file: "/usr/share/fonts/roboto/Roboto-Regular.ttf"(s)
index: 0(i)(s)
outline: FcTrue(s)
scalable: FcTrue(s)
charset:
0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ffffffff ffffffff ffffffff
0001: ffffffff ffffffff ffffffff ffffffff 00040000 00018003 00000000 fc010000
0002: 03000000 00800000 00000000 00000000 00000000 10000000 3f0002c0 00080000
0003: 0000820b 00000008 00000000 00000000 ffffd7f0 fffffffb 00467fff 00000000
0004: ffffffff ffffffff ffffffff ffffffff ffffff7f ffffffff ffffffff ffffffff
0005: 000fffff 00000000 00000000 00000000 00000000 00000000 00000000 00000000
001e: 00000003 c0000000 00000000 00000000 0000003f ffffffff ffffffff 03ffffff
001f: 00000000 00000000 00002000 00000000 00000000 00000000 00000000 00000000
0020: 7fb80fff 160d0067 00000010 80100000 00000000 00001898 00000000 00000000
0021: 00480020 00004044 78000000 00000000 00000000 00000000 00000000 00000000
0022: 44068044 00000800 00000100 00000031 00000000 00000000 00000000 00000000
0025: 00000000 00000000 00000000 00000000 00000000 00000000 00000400 00000000
00f6: 00000000 00000000 00000000 00000000 00000000 00000000 00000008 00000000
00fb: 0000001e 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00fe: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 80000000
00ff: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 30000000
(s)
lang: aa|ab|af|av|ay|ba|be|bg|bi|bin|br|bs|bua|ca|ce|ch|chm|co|cs|cu|cv|cy|da|de|el|en|eo|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl|gn|gv|ho|hr|hu|ia|ig|id|ie|ik|io|is|it|kaa|ki|kk|kl|kum|kv|ky|la|lb|lez|lt|lv|mg|mh|mk|mt|nb|nds|nl|nn|no|nr|nso|ny|oc|om|os|pl|pt|rm|ru|sah|se|sel|sh|sk|sl|sma|smj|smn|so|sq|sr|ss|st|sv|sw|tg|tk|tl|tn|tr|ts|tt|tyv|uk|uz|vo|vot|wa|wen|wo|xh|yap|zu|an|crh|csb|fil|hsb|ht|jv|kj|ku-tr|kwm|lg|li|mn-mn|ms|na|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|ty|za(s)
fontversion: 65536(i)(s)
capability: "otlayout:DFLT"(s)
fontformat: "TrueType"(s)
decorative: FcFalse(s)
Pattern has 20 elts (size 32)
family: "Roboto"(s) "Roboto Lt"(s)
familylang: "en"(s) "en"(s)
style: "Medium"(s) "Regular"(s)
stylelang: "en"(s) "en"(s)
fullname: "Roboto Medium"(s)
fullnamelang: "en"(s)
slant: 0(i)(s)
weight: 100(i)(s)
width: 100(i)(s)
foundry: "unknown"(s)
file: "/usr/share/fonts/roboto/Roboto-Medium.ttf"(s)
index: 0(i)(s)
outline: FcTrue(s)
scalable: FcTrue(s)
charset:
0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ffffffff ffffffff ffffffff
0001: ffffffff ffffffff ffffffff ffffffff 00040000 00018003 00000000 fc010000
0002: 03000000 00800000 00000000 00000000 00000000 10000000 3f0002c0 00080000
0003: 0000820b 00000008 00000000 00000000 ffffd7f0 fffffffb 00467fff 00000000
0004: ffffffff ffffffff ffffffff ffffffff ffffff7f ffffffff ffffffff ffffffff
0005: 000fffff 00000000 00000000 00000000 00000000 00000000 00000000 00000000
001e: 00000003 c0000000 00000000 00000000 0000003f ffffffff ffffffff 03ffffff
001f: 00000000 00000000 00002000 00000000 00000000 00000000 00000000 00000000
0020: 7fb80fff 160d0067 00000010 80100000 00000000 00001898 00000000 00000000
0021: 00480020 00004044 78000000 00000000 00000000 00000000 00000000 00000000
0022: 44068044 00000800 00000100 00000031 00000000 00000000 00000000 00000000
0025: 00000000 00000000 00000000 00000000 00000000 00000000 00000400 00000000
00f6: 00000000 00000000 00000000 00000000 00000000 00000000 00000008 00000000
00fb: 0000001e 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00fe: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 80000000
00ff: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 30000000
(s)
lang: aa|ab|af|av|ay|ba|be|bg|bi|bin|br|bs|bua|ca|ce|ch|chm|co|cs|cu|cv|cy|da|de|el|en|eo|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl|gn|gv|ho|hr|hu|ia|ig|id|ie|ik|io|is|it|kaa|ki|kk|kl|kum|kv|ky|la|lb|lez|lt|lv|mg|mh|mk|mt|nb|nds|nl|nn|no|nr|nso|ny|oc|om|os|pl|pt|rm|ru|sah|se|sel|sh|sk|sl|sma|smj|smn|so|sq|sr|ss|st|sv|sw|tg|tk|tl|tn|tr|ts|tt|tyv|uk|uz|vo|vot|wa|wen|wo|xh|yap|zu|an|crh|csb|fil|hsb|ht|jv|kj|ku-tr|kwm|lg|li|mn-mn|ms|na|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|ty|za(s)
fontversion: 65536(i)(s)
capability: "otlayout:DFLT"(s)
fontformat: "TrueType"(s)
decorative: FcFalse(s)
Read the style field of each font in the above output, you’ll see “Regular” in the field for Roboto-Regular.ttf and Roboto-Medium.ttf. But note another parameter, the weight of font. Robot-Black and Regular declare it as 80 while Medium declares it as 100.
Font selection happens in the alphabetical order first matching weight and then style. The weight for “Regular” size is 80. So the first font selected would be Roboto-Black, since it declares weight as 80 and appears before Roboto-Regular and Roboto-Medium in alphabetical order.
If you delete Roboto-Black, it will match Roboto-Medium which declares a weight of 100, but has “Regular” in the style specification.
The problem is, both these fonts Black and Medium are just too bold for daily use. You just can’t distinguish between bold and normal text and this causes ridiculous amount of confusion in applications like Thunderbird which use bold text to mark unread message and normal text otherwise.
To deal with this, a slight modification is needed in your font configuration file as follows –
<selectfont>
<rejectfont>
<pattern>
<patelt name="family"><string>Roboto Lt</string></patelt>
<patelt name="weight"><int>100</int></patelt>
</pattern>
<pattern>
<patelt name="family"><string>Roboto Bk</string></patelt>
</pattern>
</rejectfont>
</selectfont>
If you add the above configuration to your fontconfig, it will blacklist Roboto Lt font with weight 100 (which is Medium) and Roboto Bk font which is Roboto Black. See the earlier fc-query output if you’re interested in how I got these values.
And here’s my /etc/fonts/local.conf:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="font">
<edit mode="assign" name="hinting">
<bool>true</bool>
</edit>
</match>
<match target="font">
<edit mode="assign" name="hintstyle">
<const>hintslight</const>
</edit>
</match>
<match target="font">
<edit mode="assign" name="antialias">
<bool>true</bool>
</edit>
</match>
<!--match target="font">
<test qual="any" name="size" compare="less">
<double>9.0</double>
</test>
<edit name="size" mode="assign">
<double>9.0</double>
</edit>
</match-->
<match target="font">
<test qual="any" name="size" compare="less">
<double>10.0</double>
</test>
<test qual="any" name="family">
<string>Monaco</string>
</test>
<edit name="size" mode="assign">
<double>10.0</double>
</edit>
</match>
<alias>
<family>serif</family>
<default>
<family>Roboto</family>
</default>
</alias>
<alias>
<family>sans-serif</family>
<default>
<family>Roboto</family>
</default>
</alias>
<alias>
<family>monospace</family>
<default>
<family>Monaco</family>
</default>
</alias>
<selectfont>
<rejectfont>
<pattern>
<patelt name="family"><string>Roboto Lt</string></patelt>
<patelt name="weight"><int>100</int></patelt>
</pattern>
<pattern>
<patelt name="family"><string>Roboto Bk</string></patelt>
</pattern>
</rejectfont>
</selectfont>
</fontconfig>
Just ensure that this configuration is not overridden in any file /etc/fonts/conf.d. A simple way would be to clean up /etc/fonts/conf.d and keep the bare minimum you need.
Some screenshots for Roboto font as requested by Zachary Potter:
Leave a comment