Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying using ~/.fonts.conf to replace Helvetica with Droid Sans, here's the content of the file:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match target="pattern">
    <test qual="any" name="family"><string>Helvetica</string></test>
    <edit name="family" mode="assign"><string>Droid Sans</string></edit>
  </match>
</fontconfig>

but no matter what, nothing seems to happen. I tried running fc-cache, I have checked in /etc/fonts/conf.d and I found 50-user.conf which seems to explicitly call user specific configurations.

What am I missing?

Thanks

EDIT: after investigation I found out that other rules in /etc/fonts/conf.d overwrite user configuration, so linking user.conf to 00-user.conf helped. Still it's just a partial success, since I can specify which fonts should be substituted, but the substitute of my choice is ignored: in other words, I can make Helvetica invalid and the system falls back to the next font (i.e. in the browser, it takes the next font specified in the style sheet, if none is present it displays standard sans-serif).

share|improve this question
    
I came here because I'd about to accomplish something similar. Hopefully someone has an answer... –  Ludwig Weinzierl Mar 6 '10 at 17:12
    
still looking for an answer. –  barraponto Mar 11 '10 at 13:11

3 Answers 3

up vote 7 down vote accepted

I think the binding attribute was missing in your configuration. (see also fonts-conf). Depending on your other configuration, a binding of "same" or "strong" might probably work, while "weak" might not give you what you want.

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match target="pattern">
    <test qual="any" name="family"><string>Helvetica</string></test>
    <edit name="family" mode="assign" binding="same"><string>Droid Sans</string></edit>
  </match>
</fontconfig>
share|improve this answer
    
Worked for me. Seems like adding the binding attribute made the difference. I am using fontconfig-2.8.0. –  MaoPU Sep 20 '10 at 13:55
    
This worked for me –  miloshadzic Jan 8 '11 at 13:10

Does "fc-list" actually show "Helvetica"? What does fc-match say ? On my box (F-12) I get:

 >fc-match Helvetica
n019003l.pfb: "Nimbus Sans L" "Regular"

Maybe you have to add the aliased font to your substitution as well.

share|improve this answer

I'd think the alias mechanism would work for this:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <alias>
    <family>Helvetica</family>
    <prefer>Droid Sans</prefer>
  </alias>
</fontconfig>
share|improve this answer
    
Is <alias> not just for substituting not installed fonts? –  MaoPU Sep 20 '10 at 13:54
    
@MaoPU: I thought the same thing, but after reading the documentation, it led me to believe that that behavior is configured. <accept> takes precedence when font is not installed, <prefer> takes precedence regardless if font is installed. –  TechZilla Mar 3 '13 at 15:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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