TrueType bytecode support

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ben

    TrueType bytecode support

    Does anyone have any experience using the TrueType bytecode interpreter
    to display fonts in PHP under Windows? I'm running Windows XP, PHP
    4.3.11, GD 2.0.28 with FreeType enabled. It all works fine, but it's
    using the FreeType anti-aliased hinting rather than the clear Windows
    non-antialiased (bytecode interpreter?) hinting.

    I'm looking into converting my weather graph generator (at
    http://harvest.com/w.cgi), which now uses the Win32 API to draw the
    fonts, to use PHP and the GD library. To see a comparison of what I'm
    getting now with the FreeType non-anti-aliased and anti-aliased
    versions, check out http://harvest.com/images/truetype.png

    Obviously the first (Win32 API) is the best. The second is yucky. The
    last would do, but it doesn't look as nice IMHO, and produces bigger
    output because it needs lots of extra colours.

    I'm aware of the patent issues. I've tried recompiling FreeType with
    bytecode support (as per http://www.tldp.org/HOWTO/Font-HOWTO/bci.html)
    and that worked, but I realised I'd need to compile GD and libpng and
    and all the rest, which I can't do at the moment.

    Any ideas? Is there a Win32 version of PHP_GD2.DLL with the FreeType
    bytecode interpreter enabled?

  • Philip Ronan

    #2
    Re: TrueType bytecode support

    "Ben" wrote:
    [color=blue]
    > Does anyone have any experience using the TrueType bytecode interpreter
    > to display fonts in PHP under Windows? I'm running Windows XP, PHP
    > 4.3.11, GD 2.0.28 with FreeType enabled. It all works fine, but it's
    > using the FreeType anti-aliased hinting rather than the clear Windows
    > non-antialiased (bytecode interpreter?) hinting.[/color]

    Maybe I'm wrong, but it looks to me like your Windows system is using a
    bitmap screen font rather than relying on byte codes to correct the glyph
    shapes. Try installing a fixed point size (bitmap only) font in your server
    and see if that helps.

    --
    phil [dot] ronan @ virgin [dot] net



    Comment

    • Ben

      #3
      Re: TrueType bytecode support

      Thanks, Phil. Hmm, yes, that's possible. But my "server" is just my
      development PC, so I'm using exactly the same font file for all three
      images.

      That said, if there's an easy way to make a fixed point size font from
      a TrueType font, I could solve it. Any ideas?

      Comment

      • Philip Ronan

        #4
        Re: TrueType bytecode support

        "Ben" wrote:
        [color=blue]
        > Thanks, Phil. Hmm, yes, that's possible. But my "server" is just my
        > development PC, so I'm using exactly the same font file for all three
        > images.
        >
        > That said, if there's an easy way to make a fixed point size font from
        > a TrueType font, I could solve it. Any ideas?[/color]

        Apparently FreeType 2 supports SFNT-based bitmap fonts:
        <http://freetype.source forge.net/freetype2/index.html>

        Which version are you running at the moment? (run phpinfo() to find out)

        --
        phil [dot] ronan @ virgin [dot] net



        Comment

        • Ben

          #5
          Re: TrueType bytecode support

          I'm running PHP version 4.3.11, bundled GD version (2.0.28 compatible),
          and it doesn't say what FreeType version, but I'm almost certain it's
          FreeType 2. I just discovered the two functions imagettftext() and
          imagefttext(), the latter of which (according to the PHP docs) is
          supposed to use FreeType 2. But they both work and look exactly the
          same on my system.

          As for SFNTs, are they the embedded fixed point size bitmaps in
          TrueType fonts? I downloaded a Microsoft utility SBIT32, which is
          supposed to extract bitmap fonts from TrueType fonts. Looked very
          hopeful, but it said all the fonts I tried (Verdana, Arial, and others)
          didn't have bitmaps in them. See:
          Develop fonts, find existing fonts, and license fonts from registered vendors.


          So maybe the hinting is done in such a way now that they don't need
          bitmaps at small sizes. I don't know.

          Thanks again for your time,
          Ben.

          Comment

          Working...