Slackware

Optimizing fonts for Slackware 14.1 – Without Infinality

Before, font optimization techniques were originally created by Infinality but support for Slackware stops sometime after the Slackware 14.0 release. Just recently, dugan shared how he optimized fonts for Slackware 14.1 which is good enough according to him.

Read the original source here: How to Optimize Fonts in Slackware.

Below is the transcript:

If you’re like me and you plan to try living without Infinality, here’s something to try. First, here’s a patch to turn on Cleartype rendering.

diff -rupN freetype.orig/cleartype.diff freetype/cleartype.diff
--- freetype.orig/cleartype.diff	1969-12-31 16:00:00.000000000 -0800
+++ freetype/cleartype.diff	2013-11-19 15:32:04.811346576 -0800
@@ -0,0 +1,12 @@
+diff -rupN freetype-2.5.0.1.orig/include/freetype/config/ftoption.h freetype-2.5.0.1/include/freetype/config/ftoption.h
+--- freetype-2.5.0.1.orig/include/freetype/config/ftoption.h	2013-06-19 14:20:04.000000000 -0700
++++ freetype-2.5.0.1/include/freetype/config/ftoption.h	2013-11-19 15:27:47.456737625 -0800
+@@ -591,7 +591,7 @@ FT_BEGIN_HEADER
+   /*   This option requires TT_CONFIG_OPTION_BYTECODE_INTERPRETER to be    */
+   /*   defined.                                                            */
+   /*                                                                       */
+-/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING */
++#define TT_CONFIG_OPTION_SUBPIXEL_HINTING
+ 
+ 
+   /*************************************************************************/
diff -rupN freetype.orig/freetype.SlackBuild freetype/freetype.SlackBuild
--- freetype.orig/freetype.SlackBuild	2013-11-19 15:31:53.895891885 -0800
+++ freetype/freetype.SlackBuild	2013-11-19 15:33:17.885864416 -0800
@@ -78,7 +78,8 @@ zcat $CWD/freetype.illadvisederror.diff.
 # for doing so.
 # Please see this web site for more details:
 #   http://www.freetype.org/patents.html
-#zcat $CWD/freetype.subpixel.rendering.diff.gz | patch -p1 --verbose || exit 1
+zcat $CWD/freetype.subpixel.rendering.diff.gz | patch -p1 --verbose || exit 1
+patch -p1 --verbose < $CWD/cleartype.diff
 
 chown -R root:root .
 CFLAGS="$SLKCFLAGS" make setup CFG="--prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX} --build=$ARCH-slackware-linux"

Save it as freetype_cleartype.diff. Then download freetype and patch it:

bash-4.2$ lftp -c 'open http://slackware.osuosl.org ; mirror slackware-14.1/source/l/freetype'
bash-4.2$ cd freetype                                                 
bash-4.2$ patch -p1 < ../freetype_cleartype.diff 
patching file cleartype.diff
patching file freetype.SlackBuild
bash-4.2$

(Change the mirror directory if you need to: for example, if you’re using 64-bit Slackware).

Then rebuild Freetype!

I have FreeType rebuilt with the above patch

I have the following in /etc/fonts/conf.d:

10-sub-pixel-rgb.conf
11-lcdfilter-default.conf

I have the following ~/.config/fontconfig/fonts.conf:

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
	<match target="font">
		<edit mode="assign" name="antialias">
			<bool>true</bool>
		</edit>
		<edit mode="assign" name="hinting">
			<bool>true</bool>
		</edit>

		<edit mode="assign" name="hintstyle">
			<const>hintslight</const>
		</edit>

		<!-- Ignore any embedded bitmaps in TTF, etc (Microsoft's Calibri and others from Office 07/Vista have these) -->
		<edit mode="assign" name="embeddedbitmap">
			<bool>false</bool>
		</edit>

		<!-- MS fonts use full hinting -->

		<test name="family">
			<string>Andale Mono</string>
		</test>
		<edit mode="assign" name="hintstyle">
			<const>hintfull</const>
		</edit>
		<test name="family">
			<string>Arial</string>
		</test>
		<edit mode="assign" name="hintstyle">
			<const>hintfull</const>
		</edit>
		<test name="family">
			<string>Arial Black</string>
		</test>
		<edit mode="assign" name="hintstyle">
			<const>hintfull</const>
		</edit>
		<test name="family">
			<string>Calibri</string>
		</test>
		<edit mode="assign" name="hintstyle">
			<const>hintfull</const>
		</edit>
		<test name="family">
			<string>Cambria</string>
		</test>
		<edit mode="assign" name="hintstyle">
			<const>hintfull</const>
		</edit>
		<test name="family">
			<string>Candara</string>
		</test>
		<edit mode="assign" name="hintstyle">
			<const>hintfull</const>
		</edit>
		<test name="family">
			<string>Comic Sans MS</string>
		</test>
		<edit mode="assign" name="hintstyle">
			<const>hintfull</const>
		</edit>
		<test name="family">
			<string>Consolas</string>
		</test>
		<edit mode="assign" name="hintstyle">
			<const>hintfull</const>
		</edit>
		<test name="family">
			<string>Constantia</string>
		</test>
		<edit mode="assign" name="hintstyle">
			<const>hintfull</const>
		</edit>
		<test name="family">
			<string>Corbel</string>
		</test>
		<edit mode="assign" name="hintstyle">
			<const>hintfull</const>
		</edit>
		<test name="family">
			<string>Courier New</string>
		</test>
		<edit mode="assign" name="hintstyle">
			<const>hintfull</const>
		</edit>
		<test name="family">
			<string>Georgia</string>
		</test>
		<edit mode="assign" name="hintstyle">
			<const>hintfull</const>
		</edit>
		<test name="family">
			<string>Impact</string>
		</test>
		<edit mode="assign" name="hintstyle">
			<const>hintfull</const>
		</edit>
		<test name="family">
			<string>Symbol</string>
		</test>
		<edit mode="assign" name="hintstyle">
			<const>hintfull</const>
		</edit>
		<test name="family">
			<string>Tahoma</string>
		</test>
		<edit mode="assign" name="hintstyle">
			<const>hintfull</const>
		</edit>
		<test name="family">
			<string>Times New Roman</string>
		</test>
		<edit mode="assign" name="hintstyle">
			<const>hintfull</const>
		</edit>
		<test name="family">
			<string>Trebuchet MS</string>
		</test>
		<edit mode="assign" name="hintstyle">
			<const>hintfull</const>
		</edit>
		<test name="family">
			<string>Verdana</string>
		</test>
		<edit mode="assign" name="hintstyle">
			<const>hintfull</const>
		</edit>
		<test name="family">
			<string>Webdings</string>
		</test>
		<edit mode="assign" name="hintstyle">
			<const>hintfull</const>
		</edit>
		<test name="family">
			<string>Wingdings</string>
		</test>
		<edit mode="assign" name="hintstyle">
			<const>hintfull</const>
		</edit>
	</match>
</fontconfig>

It’s not Infinality, but it’s good enough for me.

I will try this on my machine and probably post some screenshots later.

15 thoughts on “Optimizing fonts for Slackware 14.1 – Without Infinality”

  1. “..patching file freetype.SlackBuild
    bash-4.2$
    (Change the mirror directory if you need to: for example, if you’re using 64-bit
    Slackware).
    Then rebuild Freetype!.. ”

    How ? Advice please!

  2. You must know how to build a SlackBuild at least.

    You just need to run the script like this:

    ./freetype.SlackBuild

    given that the source code is present on the directory where the script is located.

  3. I downloaded the patch freetype_cleartype.diff and put it in the directory “test”
    ~$ cd Downloads/test
    lena@lena:~/Downloads/test$ lftp -c ‘open http://slackware.osuosl.org ; mirror slackware-14.1/source/l/freetype’
    $ cd freetype
    $ ls -F
    freetype-2.5.0.1.tar.xz freetype.SlackBuild
    freetype_cleartype.diff freetype.subpixel.rendering.diff.gz
    freetype.illadvisederror.diff.gz slack-desc
    lena@lena:~/Downloads/test/freetype$
    $ patch -p1 < ../freetype_cleartype.diff
    $ bash: ../freetype_cleartype.diff: No such file or directory
    Why ? Help, please.

  4. The script quoted in the post should be saved as freetype_cleartype.diff and put it somewhere, example, above the freetype source directory.

    As long as the path is correct, it should work. Adjust the command when necessary.

  5. Yes – incorrect path
    But now a new problem:
    :~/Downloads/test/freetype$ patch -p1 < ../freetype_cleartype.diff
    patching file cleartype.diff
    patching file freetype.SlackBuild
    lena@lena:~/Downloads/Polygon/test/freetype$./freetype.SlackBuild
    bash: ./freetype.SlackBuild: Access is denied

    Help, please

  6. Almost there. SlackBuild script must be executable. Simply set the execute bit.

    chmod +x freetype.SlackBuild

    And if it succeeds, at the end of the build process, it will display the full path of the new freetype package. Use that path to upgrade freetype. Ex:

    upgradepkg /tmp/path-to-freetype.txz

  7. Yes!
    Package freetype-… upgraded with new package /tmp/freetype-2.5.0.1-i486-1.txz
    Thank you very much for your help!
    —–
    I read about this command.
    $ upgradepkg –install-new –reinstall /tmp/.txz
    When it should be done?

  8. I don’t know much of upgradepkg options. I think it will just re-install the package when --reinstall option is passed.

  9. Very good patch. Indeed, there is no need for infinality. And I have used infinality for long time (on other distributions). Thank you very much for this.

  10. Could someone please upload the patch? It’s impossible to copy it from the website without weird errors like “ends in middle of line”

  11. Wow – 17 years of linux desktop use and for the first time ever I am seeing proper fonts. Thank you very much for posting this.

  12. I have tried this in 14.2 with freetype 2.6.3

    one[freetype]$ patch -p1 < ../freetype_cleartype.diff
    patching file cleartype.diff
    patching file freetype.SlackBuild
    Hunk #1 FAILED at 78.
    1 out of 1 hunk FAILED — saving rejects to file freetype.SlackBuild.rej
    one[freetype]$

    ??

    Please, help

  13. I can’t answer patch questions as I’m not an advanced user. It’s been a long time since I’ve used Slackware. I can’t keep it updated anymore as I focus more on servers and used Windows primarily for desktop.

    I wish I could try Slackware one more time. Maybe when Slackware 15 is released? πŸ™‚

Leave a reply

Your email address will not be published. Required fields are marked *