[PATCH v2 1/3] gdi32: Fix the truetype interpreter version problem.

Byeongsik Jeon bsjeon at hanmail.net
Mon Nov 5 02:07:30 CST 2018


On Mon, 5 Nov 2018 09:49:09 +0300, Dmitry Timoshkov <dmitry at baikal.ru>
wrote:
> Byeongsik Jeon <bsjeon at hanmail.net> wrote:
> 
>> The truetype bytecode interpreter of the Freetype appears to have the 
>> following problems depending on the version.
>> - v35: MS cleartype font(ex. Consolas) rendering is ugly.
>> - v40: MS legacy font (ex. Tahoma) rendering is ugly. Some fonts return 
>> the wrong values even for the glyph metrics. 
>>
>> Is this a Freetype bug? Basically NOT.
> 
> Arguably this is a Freetype bug, applications should not fiddle with
> underlying interpreter versions or even pretend to know anything about
> truetype interpreter implementation details.
> 
>> +static void set_forced_interpreter_version(void)
>> +{
>> +    static const char property_name[] = "truetype:interpreter-version=";
>> +    const char *env;
>> +
>> +    env = getenv( "WINE_GDI_PROPERTIES" );
>> +    if ( env && (env = strstr( env, property_name )) )
>> +    {
>> +        forced_interpreter_version = atoi( env + sizeof(property_name) - 1 );
>> +
>> +        TRACE( "forced_interpreter_version = %d\n" , forced_interpreter_version );
>> +    }
>> +}
> 
> Usually Wine tries to avoid such ugly hacks.
> 
I put it because it is convenient and fast test, but it seems to be not
appropriate for Wine. I'll delete it.

>> +        if (forced_interpreter_version == 0 && get_gasp_flags( ret, NULL, &gasp_version ))
>> +        {
>> +            ret->interpreter_version = 0;
>> +
>> +            if (gasp_version == 1)
>> +            {
>> +                if (interpreter_v40_supported)
>> +                    ret->interpreter_version = 40;
>> +                else if (interpreter_v38_supported)
>> +                    ret->interpreter_version = 38;
>> +            }
>> +            else if (interpreter_v35_supported)
>> +                ret->interpreter_version = 35;
>> +        }
> 
> Shouldn't Freetype itself set appropriate interpreter version based on
> GASP flags instead?
> 
At first, I thought this was a Freetype bug. But when I look at the
Freetype API design, it seems intentional. They know this mechanism and
they have been keeping this API design for a long time.

In short, the fonts can be created considering version 35 or version 40
or both. And record that information on the gasp table.

When The program(or OS, etc) uses the fonts, it is optional to render
which interpreter version is applied. In this way, MS GDI and
DirectWrite rendering results may be different.

In fact, because the Freetype implementation is different from
Microsoft, our choices are limited.



More information about the wine-devel mailing list