Necoro’s Blog

Blog? Blog? There is no blog…

Matching web-fonts with fontconfig

with 2 comments

I had a small issue today: A font used on a webpage and loaded via CSS was not rendered as it should be. I searched quite some time to find out if it is matched by font-config, and if so, how. So here is the answer: it is matched against the name defined in the CSS prepended by a @font-face:. With this I was able to add stuff like the following to my ~/.fonts.conf:

<match target="font">
  <test name="family">
    <string>@font-face:Thesis</string>
  </test>
  <edit name="hintstyle" mode="assign">
    <const>hintslight</const>
  </edit>
 </match>
Advertisements

Written by Necoro

April 29, 2013 at 22:30

Posted in Howtos

Tagged with , , ,

2 Responses

Subscribe to comments with RSS.

  1. That’s brilliant, I tested and it works :). I never thought of adding the @font-face bit. Now I can cleanly get rid of e.g. the open sans web fonts with:

    @font-face:Open Sans
    DejaVu Sans
    DejaVu Sans

    Thanks.

    Ahmad Samir

    February 19, 2014 at 13:43

    • The fontconfig syntax got mangled in my original comment, trying again:

      @font-face:Open Sans
      DejaVu Sans
      DejaVu Sans

      Ahmad Samir

      February 19, 2014 at 13:45


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: