[Top][All Lists]

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

Re: [ft-devel] necessary change to DELTAP in subpixel hinting mode

From: Werner LEMBERG
Subject: Re: [ft-devel] necessary change to DELTAP in subpixel hinting mode
Date: Thu, 06 Nov 2014 07:23:50 +0100 (CET)

[I'm CCing this reply to a conversion with Eric to the list, since it
is of interest for others, too.  The project described here is very
important IMHO, and I want to start work on it this year.]

> I realized I'm going to have to do some more testing than I had
> planned [...]
> So, I can definitely agree with you that having a test suite would
> be extremely helpful.


> However, there are also many different methods (like Directwrite,
> but also just TT hint tweaks) that the MS rasterizer seems to use,
> depending on the Windows version.

Here's a list, taken from

   framework   Windows version   result of GETINFO[1]
    GDI         before XP         35
    GDI         XP and later      37
    GDI+ old    before Vista      37
    GDI+ old    Vista, 7          38
    GDI+        after 7           40
    DWrite      before 8          39
    DWrite      8 and later       40

IIRC, Greg Hitchcock mentioned that they have at least three
completely different rendering engines...  Funnily, the same is true
for Adobe's CFF engines.

> So, when we speak of rendering something "like the MS rasterizer",
> how the outlines are rendered could vary between Windows versions,
> font versions, and layout type (standard vs. Directwrite, etc.).

Exactly.  For this reason it seems probably best to use Microsoft's
virtual machines for IE 6 to IE 11, running Windows XP, Vista, Win7
and Win8.  Those machines are even available on GNU/Linux boxes!

Unfortunately, right now I neither have enough disk/RAM space nor a
fast CPU to use them by myself...

> Being able to test changes to Freetype is good, but it would also be
> useful to somehow test every combination of font version and MS
> rasterizer version from within Windows.  Of course, this seems much
> less realistic than a pure Freetype-only test suite.

Fortunately, due to the above, this *is* realistic.  The question is
how to automate the creation of snapshots...

Another possibility is the use of a rendering farm that essentially
provides those virtual boxes online, and that return image snapshots
of web pages.  I know that more than one such service exists in the
web, but I don't have any details right now, sorry.

> Ideally, Freetype would be able to render subpixel hinting where it
> exactly duplicates every version of the MS rasterizer, with all its
> tweaks, and the same way it does with each version of each font.

This is unrealistic.  FreeType can't emulate *all* aspects of *three*
different MS rendering engines!  Note that even recent MS rasterizers
sometimes produce very unpleasant rendering artifacts for older fonts.
In such cases, only the most recent rendering result should be
emulated by FreeType's core hinting and rendering, possibly improved
by font-specific tweaks.

> But the fact that the Cleartype whitepaper seems to be "point in
> time", and we're not likely to get every specific tweak figured out
> (much less the *source code*), I'm not sure that it's a viable goal
> to try to render each MS rasterizer version.

AFAIK, Greg's paper is still valid, describing how ClearType in
DirectWrite should work.  Note that it is actually possible to get the
source code of the MS rasterizer without costs, if you sign an
agreement with MS...  I'm not going to do this, however.

> Still, programmatically comparing freetype rendering to MS
> rendering would be difficult, unless there was some cross-platform
> way to access the different renderings, perhaps in a browser like
> Firefox or Chrome.

See above.

My idea is that you create images for font `foo' within IE browser
versions as described in the above setup (probably cropped as needed
to reduce space consumption).  Those images can be stored without
infringing copyright in a git repository.  The same is done with
FreeType rendering images.  In other words, a public FreeType test
repository contains rendered images but no original fonts (except for
freely available ones).

If a new font gets added to the repository, visual comparison is
necessary, of course.

If you switch on tracing, FreeType is already producing a hash value
for each rendered glyph; with proper tracing settings, the log files
are small and should be stored too.  As soon as you change rendering
or hinting code in FreeType, running the test suite on the given fonts
produces a new set of log files.  If they are identical, everything's
OK.  Otherwise, you immediately know which glyph to manually
investigate and compare.  In the end, you simply have to run the test
suite followed by `git diff'.


reply via email to

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