We have moved to a new Sailfish OS Forum. Please start new discussions there.
5

How do I install additional fonts?

asked 2014-02-04 19:32:37 +0200

fc gravatar image

updated 2015-01-21 10:41:38 +0200

eric gravatar image

There's free (as in freedom) fonts available for Linux which govern most languages etc. How do I install some of these on my Jolla?

Wikipedia front page

edit retag flag offensive close delete

Comments

It would be nice to get an answer. Cyrillic font looks wery ugly so far...

Wickedsten ( 2014-02-04 20:36:41 +0200 )edit

2 Answers

Sort by » oldest newest most voted
5

answered 2014-02-05 04:10:19 +0200

peremen gravatar image

updated 2014-02-05 04:10:57 +0200

Create a subdirectory for your font files under /usr/share/fonts and copy your ttf files into there (as root). You also can directly copy your font files at /usr/share/fonts too. Reboot to confirm whether fonts are working.

Using the font as UI default one seems tricky: default native UI font is Sail Sans Pro, Roboto Light and WenQuanYi Zen Hei is used for missing characters. There is a file /etc/fonts/local.conf for this setting:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <alias>
    <family>Sail Sans Pro Light</family>
    <prefer>
      <family>Roboto Light</family>
      <family>WenQuanYi Zen Hei</family>
    </prefer>
    <default><family>Sail Sans Pro Light</family></default>
  </alias>
  <alias>
    <family>Sail Sans Pro ExtraLight</family>
    <prefer>
      <family>Roboto Thin</family>
      <family>WenQuanYi Zen Hei</family>
    </prefer>
    <default><family>Sail Sans Pro ExtraLight</family></default>
  </alias>
</fontconfig>

So, after installing a new font you can edit this file to include your installed font. For example like this:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <alias>
    <family>Sail Sans Pro Light</family>
    <prefer>
      <family>YourNewFont</family> <!-- added -->
      <family>Roboto Light</family>
      <family>WenQuanYi Zen Hei</family>
    </prefer>
    <default><family>Sail Sans Pro Light</family></default>
  </alias>
  <alias>
    <family>Sail Sans Pro ExtraLight</family>
    <prefer>
      <family>YourNewFont</family> <!-- added -->
      <family>Roboto Thin</family>
      <family>WenQuanYi Zen Hei</family>
    </prefer>
    <default><family>Sail Sans Pro ExtraLight</family></default>
  </alias>
</fontconfig>

The order of each family will be used to looking up missing characters. In this case, missing characters of Sail Sans Pro will be looked up in order of YourNewFont, Roboto Thin, WenQuanYi Zen Hei. I liked default latin alphabet font Sail Sans Pro so I didn't tried to change fonts for latin alphabets.

FYI, Sail Sans Pro only contains latin alphabets and some extra characters, Cyrillic characters are probably coming from the Roboto fonts. Android apps seems to use Droid and Roboto series fonts independently from native apps, though. Default web browser seems to have independent font settings for content too. I didn't tried to change them yet.

edit flag offensive delete publish link more

Comments

This really helped me a lot, I even figured out how to change my whole system font: after adding my new font I just had to delete the default Sail Sans folder. Now the only thing left is theming the android fonts, and I have no idea how to do that. EDIT: I got the android fonts themed as well, I had to rename my fonts and replace the roboto fonts in /opt/alien/system/fonts

JakeTheChangeling ( 2015-01-02 23:52:58 +0200 )edit
1

How do Android apps work then? What changes should you make for them?

Kagerou ( 2015-01-15 21:43:12 +0200 )edit

you need a font like raleway that has many diffrent thickness options, then you rename them to Roboto-BoldItalic and all other Roboto fonts, I suggest making a backup of the android font folder before. here's a screenshot to proof it works fine: i.imgur.com/qtkD70t.jpg

JakeTheChangeling ( 2015-02-25 18:44:14 +0200 )edit

I found out how to change the browser fonts as well if anyone is interested: Simply add the font you want in all 5 font sections of /etc/fonts/conf.avail/45-latin.conf and 60-latin.conf and then reboot. Maybe it'd work with only some of the sections and I have no idea what the section "Fantasy faces" is for but I themed my Jolla in Fallout style and applied Monofonto simply everywhere, looks really nice.

JakeTheChangeling ( 2015-04-06 11:56:03 +0200 )edit

@JakeTheChangeling - can fonts me made bigger by this process?, or is that a setting somewhere else?, a small growing number of people would benetit from slightly larger text in many areas of the phone.

Any thoughts on the size aspect of fonts?, any info appreciated.

Spam Hunter ( 2015-12-31 07:19:35 +0200 )edit
0

answered 2014-08-09 19:43:43 +0200

amandalam gravatar image

I don't see any effect, even after I removed the Roboto and WenQuanYi Zen Hei <family> tags, fc-cache -f -v and reboot?</family>

edit flag offensive delete publish link more

Comments

what effects are you trying to achieve?

User ( 2014-08-10 00:27:38 +0200 )edit

I mean, I don't see any changes even I change it to a different font by using the above method.

amandalam ( 2014-08-10 08:53:05 +0200 )edit

You may replace the Sail Sans Pro font, like:

<match target="pattern">  
    <test name="family">  
        <string>Sail Sans Pro</string>  
    </test>  
    <edit binding="strong" name="family" mode="assign">  
        <string>Source Han Sans CN</string>  
    </edit>  
</match>

However another issue is introduced by this: https://together.jolla.com/question/52459/wrong-position-of-underline-with-custom-fonts/

gexc ( 2014-08-10 10:01:29 +0200 )edit
Login/Signup to Answer

Question tools

Follow
1 follower

Stats

Asked: 2014-02-04 19:32:37 +0200

Seen: 2,335 times

Last updated: Aug 09 '14