2

My goal is to configure Courier New font on CentOS7 to look like in Windows XP (XP just for example, not using it). Font configure file at ~/.config/fontconfig/fonts.conf:

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>

<alias>
    <family>monospace</family>
    <prefer><family>Courier New</family></prefer>
  </alias>

<match target="font">
<edit name="antialias" mode="assign">
<bool>false</bool>
</edit>
<edit name="autohint" mode="assign">
<bool>false</bool>
</edit>
<edit name="embeddedbitmap" mode="assign">
<bool>false</bool>
</edit>
<edit name="hinting" mode="assign">
<bool>true</bool>
</edit>
<edit name="hintstyle" mode="assign">
<const>hintslight</const>
</edit>
<edit name="lcdfilter" mode="assign">
<const>lcdlight</const>
</edit>
<edit name="rgba" mode="assign">
<const>rgb</const>
</edit>
</match>

</fontconfig>

Courier New fonts installed.

Bad result on CentOS:

enter image description here

Good result on Win10:

enter image description here

Tried with option:

<edit name="antialias" mode="assign">
<bool>true</bool>
</edit>

Even worse:

enter image description here

EDIT:

With ftview (thanks to @contemplator for good hint) I found the exact match, the problem now is how to convert those settings to xml:

enter image description here

EDIT 2:

It seems like FreeType is involved by setting:

export FREETYPE_PROPERTIES="truetype:interpreter-version=35"

Here is more related info: enter image description here

Now trying to find how set the value.

2 Answers 2

2

Thanks to @contemplator for pointing to ftview, I found the solution:

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>

  <alias>
    <family>monospace</family>
    <prefer><family>Courier New</family></prefer>
  </alias>

  <match target="font">
      <edit name="antialias" mode="assign">
          <bool>false</bool>
      </edit>
      <edit name="hinting" mode="assign">
          <bool>true</bool>
      </edit>
      <edit name="autohint" mode="assign">
          <bool>false</bool>
      </edit>
      <edit name="hintstyle" mode="assign">
          <const>hintfull</const>
      </edit>
  </match>

</fontconfig>

Then create the file at /etc/profile.d/freetype2.sh:

# Subpixel hinting mode can be chosen by setting the right TrueType interpreter
# version. The available settings are:
#
#     truetype:interpreter-version=35  # Classic mode (default in 2.6)
#     truetype:interpreter-version=38  # Infinality mode
#     truetype:interpreter-version=40  # Minimal mode (default in 2.7)
#
# There are more properties that can be set, separated by whitespace. Please
# refer to the FreeType documentation for details.

# Uncomment and configure below
export FREETYPE_PROPERTIES="truetype:interpreter-version=35"

After re-login, bingo :) The text is now superb, clean and easy to read (using Eizo ColorEdge CG243W high-end graphic monitor):

enter image description here

1
  • Glad it helped!
    – catemperor
    Jul 26, 2019 at 8:49
1

Try this:

 <match target="font">
   <test name="family" qual="any">
     <string>Courier New</string>
   </test>
   <edit name="antialias" mode="assign">
     <bool>false</bool>
   </edit>
   <edit name="hinting" mode="assign">
     <bool>true</bool>
   </edit>
   <edit name="hintstyle" mode="assign">
     <const>hintfull</const>
   </edit>
 </match>

This is how it looks, seems identical to me: ftview.png

10
  • Didn't helped - the same.. Jul 25, 2019 at 20:04
  • @ErnestasGruodis, I've updated the code, try again please.
    – catemperor
    Jul 25, 2019 at 20:09
  • The same.. Perhaps it's related to Courier New fonts - they are different from Windows OS? Jul 25, 2019 at 20:19
  • @ErnestasGruodis, if you installed the font with msttcorefonts package it is probably not the latest version. I've imported the font directly from a Win10 installation, see the screenshot how it renders here.
    – catemperor
    Jul 25, 2019 at 20:35
  • 1
    Check for yourself how it looks with ftview, like this: ftview -r 96 11 cour.ttf, see built-in help for how to switch rendering options.
    – catemperor
    Jul 25, 2019 at 21:48

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.