[OpenJDK 2D-Dev] [PATCH] JDK-8146035: Windows - With LCD antialiasing, some glyphs are not rendered correctly
Sergey.Bylokhov at oracle.com
Tue Apr 12 13:34:22 UTC 2016
On 11.04.16 16:53, Alexey Ivanov wrote:
> Hello Dmitry,
> Thank you very much for your patch.
> The fix looks good to me.
> I will sponsor integrating the fix into the code base as soon as code
> review is complete.
> On 07.04.2016 15:26, Dmitry Batrak wrote:
>> I'd like to propose a fix for JDK-8146035. I am not a committer,
>> so I hope someone can sponsor this fix.
>> I work at Jetbrains, which has signed a company-level contributor
>> so, from a legal perspective, I believe, there are no obstacles.
>> My investigation shows that the issue is caused by incorrect
>> of bitmap size, prepared for glyph rendering, so only part of glyph
>> becomes visible due to cropping. This seems to happen because
>> compatible bitmap is not selected into memory device context (DC)
>> before calling GetTextMetrics. Documentation for CreateCompatibleDC call
>> says compatible bitmap needs to be selected into DC before any drawing
>> Even though GetTextMetrics is not a drawing operation, it turns out
>> to be affected by selected bitmap's type too (by default a monochrome
>> is selected in a memory DC). This behaviour was also mentioned in the
>> MSDN blog post comment:
>> The proposed fix is to select a temporary 1x1 compatible bitmap
>> into memory DC before GetTextMetrics call.
>> Here's webrev link - http://adm-12504.intellij.net/
>> I didn't create a test case, as it would require a specific font file
>> (I couldn't reproduce the issue for fonts bundled with Windows).
>> Best regards,
>> Dmitry Batrak
Best regards, Sergey.
More information about the 2d-dev