freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft-devel] testing freetype


From: George Williams
Subject: Re: [ft-devel] testing freetype
Date: 15 Feb 2006 14:02:16 -0800

Once upon a time, about last October, the thought of a freetype
testsuite appeared yet again on the list.

I've been working on a function in fontforge to make fontforge's
testsuite (such as it is) more capable, and I realized that this same
thing could be used to test freetype.

If anyone cares to.

The idea is essentially what Ulrich was suggesting: you create a set of
bitmaps for a font with a "good" version of the library, and then with
later versions you generate new bitmaps and compare against the
originals.

I've written two fontforge scripts which I'm attaching. One builds up an
sfd file of a font and inserts bitmaps, the other loads that in, builds
up new bitmaps, and tests that they are similar.

$ fontforge -script SetupBitmapTest.pe ARIAL.TTF 12 13 14 15 16 17 18 19
Created: ArialMTBitmaps.sfd
<install a new version of freetype to be tested>
$ fontforge -script TestBitmaps.pe ArialMTBitmaps.sfd
Ok

The first can take as arguments:
  * An integer (=> a bitmap strike at that pixelsize with depth 1)
  * <int>'@'<int> (=> a strike at first int pixelsize, depth of second)
  * a filename (containing a bitmap strike)
In the first two cases fontforge will use freetype to rasterize the font
to produce a strike of a given pixelsize/depth. In the third case it
will load a pregenerated strike (somehow obtained from another
rasterizer?)

The test script just takes one argument: the name of an sfd file
containing bitmaps to be tested. Bitmaps of depth 1 are tested for exact
pixel matches. Bitmaps of depth 8 are tested to make sure that pixels
are with in 2 (out of 256) of the corresponding pixel in the original
strike -- this can be adjusted by editing the script, I don't know what
a good value is here).

This method has a potential drawback: fontforge never rasterizes the
original font. Instead it regenerates the font from its internal copy of
the splines and metadata.

Currently I don't have any way to pass rasterization flags to freetype,
but if there is any interest in this approach I could easily add this
ability.

Is this worth pursuing?

(these scripts only work with the fontforge currently in the cvs tree,
none of the released versions support this yet)

Attachment: TestBitmaps.pe
Description: Text document

Attachment: SetupBitmapTest.pe
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]