4

This is, surprisingly, not one of the questions that has already been asked:

In contrast, I would like to turn font hinting off, but leave anti-aliasing on.

Is this possible?

1 Answer 1

2

One way that works for me is to edit the file ~/.fonts.conf, (I'm using Firefox 57.0.1 on Xubuntu 18.04, and it still does not seem to use the hinting settings in XFCE, like some other answers on SuperUser have indicated such as How to override website fonts in Firefox?).

In order to "turn off hinting for a specific font" in ~/.fonts.conf, you might want to set up 2 match tags in order (order matters b/c the rules seem to be evaluated from top to bottom), one turning on font hinting for all hints, and the second one turning hinting off for the specific fonts (In my case, Noto Sans Mono CJK SC, Noto Sans CJK SC and Noto Sans):

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
 <match target="font">
  <edit mode="assign" name="rgba">
   <const>rgb</const>
  </edit>
 </match>

 <match target="font">                      <!-- This match tag sets the -->
  <edit mode="assign" name="hintstyle">     <!-- default for all fonts: -->
   <const>hintslight</const>                <!-- Turn On Slight Hint    -->
  </edit>
  <edit mode="assign" name="hinting">
   <bool>true</bool>
  </edit>
 </match>

 <match target="font">                      <!-- This match tag sets    -->
    <test name="family" qual="any">         <!-- the exception for the  -->
    <string>Noto Sans Mono CJK SC</string>  <!-- fonts that do not need -->
    <string>Noto Sans CJK SC</string>       <!-- hinting                -->
    <string>Noto Sans</string>
    </test>
    <edit mode="assign" name="hintstyle">
     <const>hintnone</const>
    </edit>
  <edit mode="assign" name="hinting">
   <bool>false</bool>
  </edit>
 </match>

 <match target="font">
  <edit mode="assign" name="antialias">
   <bool>true</bool>
  </edit>
 </match>
  <match target="font">
  <edit mode="assign" name="lcdfilter">
    <const>lcdlight</const>
  </edit>
  </match>
</fontconfig>

To verify the settings do take effect, you could use the fc-match command and examine its outputs:

fc-match -s -v mono | grep hinting

You will see many fonts with Hint set to "True" but "Noto Sans Mono CJK SC" set to "False":

$ fc-match -s -v mono | grep hinting
hinting: True(w)
hinting: True(w)
hinting: True(w)
hinting: True(w)
hinting: True(w)
hinting: False(w)  <-- This one is for Noto Sans Mono CJK SC
hinting: True(w)
hinting: True(w)
hinting: True(w)
hinting: True(w)
hinting: True(w)
hinting: True(w)
...

Hope this may be helpful!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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