Page 1 of 3 123 LastLast
Results 1 to 10 of 26

Thread: HOWTO: Improve font rendering; premade debs and instructions to patch yourself

  1. #1
    Join Date
    Jun 2006
    Location
    Houston, Texas
    Beans
    327
    Distro
    Ubuntu 7.04 Feisty Fawn

    HOWTO: Improve font rendering; premade debs and instructions to patch yourself

    New Foreword (Oct 30, 2006):

    Note that since I have upgraded to Edgy I am now using mlind's edgy respository myself (see below) and I think these patches should still work on edgy (actually I know they will because they came from an edgy forum originally), so if you'd like to patch the debs yourself I think the instructions should still work. But I would just use mlind's repos.

    Foreword:

    The instructions below are for people who are using the compiz repositories for their font packages. They might also work for people who are not using the compiz repositories, but if you are not using compiz and want to patch the debs yourselves, you should definitely follow the instructions I made for people not using compiz that are found here:

    http://ubuntuforums.org/showthread.p...14#post1402014

    Edit: Compiz seems to have taken these font packages out of their repositories since I wrote this howto (several days ago), so the binaries should still work, but please follow the patching instructions in the link above and not the ones below, as you will not be able to get the latest versions of the packages to work with the patches below in the default ubuntu repositories. Thanks.

    If you would like to add the compiz repositories and try the instructions below (the font packages are a little newer there, not sure what differences this would make, I use compiz on my system so I patched the compiz packages), do this:

    Code:
    sudo gedit /etc/apt/sources.list
    And put the following lines in there:

    Code:
    # XGL and Compiz
    deb http://www.beerorkid.com/compiz/ dapper main
    deb http://xgl.compiz.info/ dapper main
    deb-src http://xgl.compiz.info/ dapper main
    Also, you can also use the debs that user mlind has graciously made, which are found in his repository:

    Code:
    deb http://www.elisanet.fi/mlind/ubuntu dapper fonts
    deb-src http://www.elisanet.fi/mlind/ubuntu dapper fonts
    For edgy:

    Code:
    deb http://www.elisanet.fi/mlind/ubuntu edgy fonts
    deb-src http://www.elisanet.fi/mlind/ubuntu edgy fonts
    Thanks mlind!

    ---

    This is based on this thread:

    http://www.ubuntuforums.org/showthread.php?t=178737

    and also this thread:

    http://www.ubuntuforums.org/showthread.php?t=180647

    but unfortunately those debs do not work after the latest updates, and I did not find any other instructions on how to patch them yourselves.

    If you'd just like to install these patched font packages, make a "fonts" directory in your home directory, save the attachments there, open a Terminal, and type the following commands:

    Code:
    cd fonts
    tar xvjf fontdebs1.tar.bz2
    tar xvjf fontdebs2.tar.bz2
    sudo dpkg -i *.deb
    sudo cp local.conf /etc/fonts
    Now go to Synaptic Package Manager, search for libfreetype, libcairo, and libxft, and "lock" the package versions by selecting the package files, going to the Package menu and selecting Lock Version. If you are, at any later points in time, having problems with broken packages (which you will at some point after enough updates have been made, especially if new packages in Dapper depend on new version of these font packages that currently do not exist yet, which is why the instructions about patching them yourself are key), just unselect the Lock Version for these packages (click on the "Status" button in Synaptic Package Manager at the bottom left hand corner, click on "Pinned," and you will see all packages you have locked version there) and update and you should be great.

    Now, the really fun part:

    HOWTO PATCH THEM YOURSELF

    1. Get these patches (these are from this thread: http://www.ubuntuforums.org/showthread.php?t=235526)

    http://www.magiclinux.org/people/sun...by-default.txt
    http://www.magiclinux.org/people/sun...cleartype.diff

    Also, the following commands should install everything (I hope) you need to compile the packages:

    Code:
    sudo apt-get install build-essential devscripts fakeroot
    sudo apt-get build-dep libcairo2 libxft2 libfreetype6
    2. Now get the code for your packages:

    Code:
    mkdir fonts
    cd fonts
    apt-get source libcairo2 libxft2 libfreetype6
    3. Change the package version so that Update Manager will not try to update the packages if you lock their versions in synaptic manager. In each package directory, type:

    Code:
    dch -i
    Enter a short descriptive phrase for the changes you have made ("Patched with David Turner's font patches" for example), close the file by pressing Ctrl-X and answering Yes so that the file is saved. Do this for all three packages.

    4. Now patch the sources. Here is what you do:

    For libcairo, the file you downloaded (0001-something) is actually an email, you need to edit it with gedit and get rid of the headers down to the line that reads 6b0d... Now:

    Code:
    cd libcairo-1.2.2 [or whatever version you got]
    patch -p1 < pathtoyour0001filewiththeemailheadersremoved
    Should see no errors here (if you do, perhaps the patch no longer works with some newer version that does not yet exist, or, probably, you just forgot to remove the headers or did not remove them completely, or removed too much, etc.).

    For libxft, the patch is already in the right format. Do this:

    Code:
    cd libxft-2.1.8.2 [or whatever version you got]
    patch -p1 < pathtoyourlibXft-2.1.10-etcpatchfile
    Should get no errors.

    Finally, for libfreetype, it is a little more complicated since there is no patch. Basically, what you do is this. In the directory created (freetype-2.2.1 for example) there will be a file called freetype-2.2.1.tar.bz2. You will extract it, edit the appropriate file, adn then re-create the tar.bz2 archive. Here is how you can do it:

    Code:
    cd freetype-2.2.1
    tar xvjf freetype-2.2.1.tar.bz2
    gedit freetype-2.2.1/src/autofit/aflatin.c
    
    Now edit the file, find the part that reads:
        if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD )
          other_flags |= AF_LATIN_HINTS_HORZ_SNAP;
    
    Change that to:
        if ( mode == FT_RENDER_MODE_MONO )
          other_flags |= AF_LATIN_HINTS_HORZ_SNAP;
    
    Find the part that reads:
        if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD_V )
          other_flags |= AF_LATIN_HINTS_VERT_SNAP;
    
    Change that to:
        if ( mode == FT_RENDER_MODE_MONO )
          other_flags |= AF_LATIN_HINTS_VERT_SNAP;
    
    Now, do:
    tar cvjf freetype-2.2.1.tar.bz2 freetype-2.2.1/*
    rm -rf freetype-2.2.1
    Also do this to turn on the bytecode interpreter (I think this makes bold fonts better):

    Code:
    gedit debian/rules
    
    Find the line that reads:
    #        patch -p1 -d $(freetype_u) -i $(patchdir)/030-bytecode-interpreter.diff
    
    And take out the # at the beginning of the line so it reads:
            patch -p1 -d $(freetype_u) -i $(patchdir)/030-bytecode-interpreter.diff
    Great, you're done patching.

    5. Make the packages:

    In each package directory, just type:

    Code:
    dpkg-buildpackage -rfakeroot -us -uc
    Wait a while, you will get some errors about missing a private key, but other than that it should succeed, and your packages will be in the fonts parent directory that you created. Enjoy!

    Misha
    Attached Files Attached Files
    Last edited by misha680; October 31st, 2006 at 04:45 AM.

  2. #2
    Join Date
    Nov 2004
    Beans
    72

    Re: HOWTO: Improve font rendering; premade debs and instructions to patch yourself

    Hi,

    Thaks for those packages. Those patches are sooo much needed once you get used to them...

    When using your packages some dependency errors are found for libcairo2-dev
    and libxft-dev (if I remember correctly this happened with your first set of patches too).

    Those broken packages must be removed in order to keep packages database sane. This is a little annoying because it's not possible to install some other dev packages (in order to compile some Gnome/Gtk stuff).

    Apart from this they seem to work fine.

    Thanks

  3. #3
    Join Date
    Jun 2006
    Location
    Houston, Texas
    Beans
    327
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: HOWTO: Improve font rendering; premade debs and instructions to patch yourself

    Hmm... would you mind posting more info about the dependency errors?

    Thanks
    Misha

    Quote Originally Posted by snop View Post
    Hi,

    Thaks for those packages. Those patches are sooo much needed once you get used to them...

    When using your packages some dependency errors are found for libcairo2-dev
    and libxft-dev (if I remember correctly this happened with your first set of patches too).

    Those broken packages must be removed in order to keep packages database sane. This is a little annoying because it's not possible to install some other dev packages (in order to compile some Gnome/Gtk stuff).

    Apart from this they seem to work fine.

    Thanks

  4. #4
    Join Date
    Nov 2005
    Beans
    2,322
    Distro
    Ubuntu Intrepid Ibex (testing)

    Re: HOWTO: Improve font rendering; premade debs and instructions to patch yourself

    Dapper's freetype doesn't use any automated patching system and rules file looks ugly as hell. You can put the patch to debian/patches and add this to debian/rules build-stamp: section.
    Code:
    # lcd rendering patch
    patch -p1 -d $(freetype_u) -i $(patchdir)/libfreetype-no-stem-snapping.patch
    Compiling libcairo2 with both cairo-1.0.2-embedded-bitmaps.patch (that's included by default) and David Turner's lcd smoothing patch is bit trickier because these patches modify the same codeblocks and won't apply cleanly with each other. Did you drop cairo-1.0.2-embedded-bitmaps.patch ?


    For xft packge, you can use dpatch or quilt for easy patching without modifying the original source.

    To use quilt
    • put patch files to debian/patches
    • create debian/patches/series and add names of all patches to this file
    • add quilt to Build-Depends on debian/control
    • add to debian/rules:
      Code:
      #add to build-stamp: rule
      QUILT_PATCHES=debian/patches quilt push -a || test $$? = 2
      
      #add to clean: rule
      QUILT_PATCHES=debian/patches quilt pop -a -R || test $$? = 2
    Last edited by mlind; August 20th, 2006 at 02:30 AM.
    Building on Ubuntu using [pbuilder]
    Other resources [Upgrading from CVS, Gaim2, Anjuta, Rhythmbox]

  5. #5
    Join Date
    Jun 2006
    Location
    Houston, Texas
    Beans
    327
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: HOWTO: Improve font rendering; premade debs and instructions to patch yourself

    Oops, didn't notice that my libcairo2 source is from the compiz source deb repository:

    Code:
    deb-src http://xgl.compiz.info/ dapper main
    It has no debian/patches at all by default.

    Misha

    Quote Originally Posted by mlind View Post
    Compiling libcairo2 with both cairo-1.0.2-embedded-bitmaps.patch (that's included by default) and David Turner's lcd smoothing patch is bit trickier because these patches modify the same codeblocks and won't apply cleanly with each other. Did you drop cairo-1.0.2-embedded-bitmaps.patch ?

  6. #6
    Join Date
    Nov 2005
    Beans
    2,322
    Distro
    Ubuntu Intrepid Ibex (testing)

    Re: HOWTO: Improve font rendering; premade debs and instructions to patch yourself

    Quote Originally Posted by misha680 View Post
    Oops, didn't notice that my libcairo2 source is from the compiz source deb repository:

    Code:
    deb-src http://xgl.compiz.info/ dapper main
    It has no debian/patches at all by default.

    Misha
    There should be one if you get libcairo2 source package from dapper-updates. I'm not sure if it's worth the effort to get embedded bitmaps patch to work with LCD rendering patch, so I decided to drop it
    Building on Ubuntu using [pbuilder]
    Other resources [Upgrading from CVS, Gaim2, Anjuta, Rhythmbox]

  7. #7
    Join Date
    Jun 2006
    Location
    Houston, Texas
    Beans
    327
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: HOWTO: Improve font rendering; premade debs and instructions to patch yourself

    Hmm... so the patches I linked to don't even seem to work with the 1.0.4 version of libcairo at all (at least for me). Did you get them to work? If not, maybe you (or someone else) can let me know what the dependency problems are, so that I can just include those debs from the xgl repos?

    Thanks
    Misha

    Quote Originally Posted by mlind View Post
    There should be one if you get libcairo2 source package from dapper-updates. I'm not sure if it's worth the effort to get embedded bitmaps patch to work with LCD rendering patch, so I decided to drop it

  8. #8
    Join Date
    Nov 2005
    Beans
    2,322
    Distro
    Ubuntu Intrepid Ibex (testing)

    Re: HOWTO: Improve font rendering; premade debs and instructions to patch yourself

    Quote Originally Posted by misha680 View Post
    Hmm... so the patches I linked to don't even seem to work with the 1.0.4 version of libcairo at all (at least for me). Did you get them to work? If not, maybe you (or someone else) can let me know what the dependency problems are, so that I can just include those debs from the xgl repos?

    Thanks
    Misha
    Problem is not with dependencies, but with patches. Both apply fine to clean source, but won't mix together. You've got two ways to go here. Either you drop the cairo-1.0.2-embedded-bitmaps.patch and live without support for embedded bitmaps fonts or fix one of the patches to apply with another.
    Building on Ubuntu using [pbuilder]
    Other resources [Upgrading from CVS, Gaim2, Anjuta, Rhythmbox]

  9. #9
    Join Date
    Apr 2006
    Beans
    59

    Re: HOWTO: Improve font rendering; premade debs and instructions to patch yourself

    I get ugly "super bold" when using these patches, even when using your local.conf. Also "sudo dpkg-reconfigure fontconfig" doesn't show any options anymore. Any ideas?

  10. #10
    Join Date
    Jul 2005
    Beans
    740
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: HOWTO: Improve font rendering; premade debs and instructions to patch yourself

    Any screenshots to show the improvements?

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •