[OpenJDK 2D-Dev] [9] request for review: 8078382: Wrong glyph is displayed for a derived font
Andrew Brygin
andrew.brygin at oracle.com
Thu Jul 16 13:08:13 UTC 2015
Hi Phil,
another option to avoid the problem is to be a bit more specific
regarding the
required font when we obtaining lcd glyph from GDI.
If we specify a particular name of the font which we used to construct the
glyph vector, then we will get glyphs exactly for desired characters:
http://cr.openjdk.java.net/~bae/8078382/9/webrev.01/
This change affects only the case of lcd glyphs on windows,
it reduces the scope of required testing.
However, there seems to be a copy&paste error in FontFamily.java:
on lines 340 - 341 we check that bold font fits our needs but use italic
anyway. Was it done by purpose, or this is really an error?
Thanks,
Andrew
On 7/15/2015 7:25 PM, Phil Race wrote:
> This probably needs more examination and perhaps a more complex fix.
> The observation that GDI bases bold-italic on the bold version not the
> italic version is an implementation choice just as we had done the
> opposite. It is possible some other time it does the opposite or some
> other platform does the opposite. I have supposed it is harder to
> synthesise italic than to do 'over-strike'. And this GDI usage
> applies only to LCD glyphs.
>
> Maybe what we need to do is see if we can detect the cases when
> GDI and JDK disagree on the actual font and remap the glyph id.
>
> -phil.
>
> On 7/15/15 4:12 AM, Andrew Brygin wrote:
>> Hello,
>>
>> could you please review a fix for 8078382?
>>
>> bug: https://bugs.openjdk.java.net/browse/JDK-8078382
>> webrev: http://cr.openjdk.java.net/~bae/8078382/9/webrev.00/
>>
>> The problem is caused by following peculiarity of the Code New
>> Roman font: this font provides plain, italic and bold variants.
>> In bold and italic variants of the font, different glyphs
>> correspond to the apostrophe character (0039):
>> bold: 0039 -> 0x250 (592)
>> italic: 0039 -> 0x256 (598)
>>
>> So, we translate character to glyphs using italic variant
>> of the font, and then request glyph images from GDI.
>> However, GDI uses the bold variant of the font in order
>> to compose glyph images for artificial bold-italic variant,
>> and we have got a glyph image for ® instead of apostrophe.
>>
>> Suggested fix is to select bold variant (if possible) as a
>> base for artificial bold-italic.
>>
>> There is no regression test because it requires a specific font
>> to be installed on a test system. The font can be found here:
>> http://www.dafont.com/code-new-roman.font
>>
>> Please take a look.
>>
>> Thanks,
>> Andrew
>
More information about the 2d-dev
mailing list