Skip to content

Instantly share code, notes, and snippets.

@FadeMind
Forked from cryzed/fix-infinality.md
Created January 8, 2017 12:30
Show Gist options
  • Save FadeMind/2a9a5644f5b874908368be044cc2ef1f to your computer and use it in GitHub Desktop.
Save FadeMind/2a9a5644f5b874908368be044cc2ef1f to your computer and use it in GitHub Desktop.
A basic set of instructions on how to fix the harfbuzz+infinality issue

Disclaimer: Please follow this guide being aware of the fact that I'm not an expert regarding the things outlined below, however I made my best attempt. A few people in IRC confirmed it worked for them and the results looked acceptable.

If you installed infinality-bundle or the patched freetype2-infinality you'll most likely recently have run into an error relating to the harfbuzz package (>= 1.4.1-1), specifically something like: /usr/lib/libharfbuzz.so.0: undefined symbol: FT_Get_Var_Blend_Coordinates.

This is because the packages provided by the Infinality repositories or even the freetype2-infinality on AUR are and have been outdated for quite some time, since infinality-bundle's creator, bohoomil, has been missing/unresponsive for the past few months. freetype2 since has gotten new features and a changed ABI, one of which is a symbol named FT_Get_Var_Blend_Coordinates which the updated libharfbuzz tries to reference.

What this means for you is: you'll need a freetype2 version >= 2.7.1 where this change was initially introduced. Since the future of the infinality-bundle is uncertain this is a good time as any to bite the bullet and remove it completely from your system until more is known. The font rendering won't be exactly the same, but with a few tweaks it will at least be similar.

A useful tool will be pkgbrowser in the process. Start by replacing the infinality-patched packages (as long as they are installed on your system) with their original versions:

  • freetype2-infinality-ultimate -> freetype2
  • lib32-freetype2-infinality-ultimate -> lib32-freetype2
  • fontconfig-infinality-ultimate -> fontconfig
  • lib32-fontconfig-infinality-ultimate -> lib32-fontconfig
  • cairo-infinality-ultimate -> cairo
  • lib32-cairo-infinality-ultimate -> lib32-cairo
  • jdk8-openjdk-infinality -> jdk8-openjdk
  • jre8-openjdk-infinality -> jre8-openjdk
  • jre8-openjdk-infinality -> jre8-openjdk-headless

If you explicitly installed fonts or font groups (for example ibfonts-meta-extended) from the Infinality-Bundle-Fonts repository it is advised that you remove these, since some of them were specifically patched to work with the modifications the infinality-bundle made to the various packages mentioned above. The pkgbrowser tool is useful during this process: mark the Infinality-Bundle-Fonts in the sidebar and sort using the Status column, remove those that were explicitly installed using: pacman -Rns <package>. If you simply installed ibfonts-meta-extended or a similar group of fonts, pacman -Rns ibfonts-meta-extended will have the expected effect.

After doing this, refresh the view in pkgbrowser using F5 and sort again by status. It is quite possible that still some packages are left which are marked as dependencies: these are packages that were most likely installed as dependencies by other packages, before you started using the infinality-bundle and subsequently replaced by infinality-specific versions. For these, select them and search for the fields "Conflicts with" which should give you a good idea which package they originally replaced. The goal is to replace the infinality-specific versions (ending in -ibx) with the original ones. For example:

  • t1-urw-fonts-ib conflicts with gsfonts: pacman -S gsfonts (answer yes to replace)
  • ttf-dejavu-ib conflicts with ttf-dejavu: pacman -S ttf-dejavu (answer yes to replace)

After taking care of all packages, no packages should be installed anymore when you check Infinality-Bundle, Infinality-Bundle-Multilib and Infinality-Bundle-Fonts in the sidebar. Your system should now be in a pre-infinality-bundle state.

To get back at least similar font rendering to that what it used to be with the infinality-bundle there are a few things you can do:

  1. Modify /etc/profile.d/freetype2.sh to look like this:
# 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=38"

This will enable the infinality interpreter that was recently added to the official freetype2 project. It takes selected patches that Infinality originally made to freetype2 and uses them -- although the behaviour is not 100% identical.

  1. Modify /etc/fonts/local.conf to look like this:
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
  <match target="font">
    <edit name="rgba" mode="assign">
      <const>rgb</const>
    </edit>
    <edit name="hinting" mode="assign">
      <bool>true</bool>
    </edit>
    <edit name="autohint" mode="assign">
      <bool>true</bool>
    </edit>
    <edit name="antialias" mode="assign">
      <bool>true</bool>
    </edit>
    <edit name="hintstyle" mode="assign">
      <const>hintslight</const>
    </edit>
    <edit name="lcdfilter" mode="assign">
      <const>lcddefault</const>
    </edit>
  </match>
</fontconfig>

These are the base-settings that were applied by /etc/fonts/conf.d/10-base-rendering.conf, installed by the package fontconfig-infinality-ultimate. There are of course other ways to configure these or instruct freetype2 to load them, however if you are aware of them you probably know what you are doing and this guide is most likely useless to you.

  1. Modify /etc/profile.d/jre.sh if you had the patched openjdk/openjre packages installed to look like this:
# Do not change this unless you want to completely by-pass Arch Linux' way
# of handling Java versions and vendors. Instead, please use script `archlinux-java`
export PATH=${PATH}:/usr/lib/jvm/default/bin

# https://wiki.archlinux.org/index.php/java#Better_font_rendering
export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true'

This will enable font anti-aliasing for Java applications according to the instructions found here. Without these, fonts in Java applications will look completely aliased, unless a different provider for java-environment is used which might implement different font rendering.

After having done all this, restarting the X-server by logging in and out should apply all changes. Try to get used to them, because the future of the infinality-bundle is unknown for now. Keep an eye on this and this and maybe this "guide" if you are curious about changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment