RESOLVED CONFIGURATION CHANGED 145234
[Cocoa] Use CTFontDrawGlyphs() instead of CGContextShowGlyphsWithAdvances()/CGContextShowGlyphsAtPositions()
https://bugs.webkit.org/show_bug.cgi?id=145234
Summary [Cocoa] Use CTFontDrawGlyphs() instead of CGContextShowGlyphsWithAdvances()/C...
Myles C. Maxfield
Reported 2015-05-20 17:46:38 PDT
[Cocoa] Use CTFontDrawGlyphs() instead of CGContextShowGlyphsWithAdvances()/CGContextShowGlyphsAtPositions()
Attachments
Patch (4.37 KB, patch)
2015-05-20 17:53 PDT, Myles C. Maxfield
no flags
Patch (5.08 KB, patch)
2015-05-20 19:16 PDT, Myles C. Maxfield
no flags
Patch (5.65 KB, patch)
2015-05-21 17:29 PDT, Myles C. Maxfield
enrica: review+
Myles C. Maxfield
Comment 1 2015-05-20 17:53:06 PDT
Jon Lee
Comment 2 2015-05-20 18:23:46 PDT
Comment on attachment 253480 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=253480&action=review > Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm:-386 > - CGAffineTransform matrix = useLetterpressEffect || platformData.isColorBitmapFont() ? CGAffineTransformIdentity : CGAffineTransformMakeScale(fontSize, fontSize); Does the scale end up being applied in CTFontDrawGlyphs?
Myles C. Maxfield
Comment 3 2015-05-20 19:16:26 PDT
Myles C. Maxfield
Comment 4 2015-05-20 19:23:14 PDT
Comment on attachment 253480 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=253480&action=review >> Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm:-386 >> - CGAffineTransform matrix = useLetterpressEffect || platformData.isColorBitmapFont() ? CGAffineTransformIdentity : CGAffineTransformMakeScale(fontSize, fontSize); > > Does the scale end up being applied in CTFontDrawGlyphs? No. Our current code draws the text at a size of 1pt into a scaled context. However, this approach is wrong when using CTFontDrawGlyphs() because CT will set the font size for us. Therefore, if we don't get rid of this context scaling, all text appears as if its point size was squared. (Note that [drawFont matrix] is just a scale by fontSize).
Enrica Casucci
Comment 5 2015-05-21 11:01:08 PDT
Comment on attachment 253494 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=253494&action=review > Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm:-219 > - CGContextSetTextMatrix(context, savedMatrix); I'm not sure I understand why it is ok to remove the line above. > Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm:386 > #endif Could you explain this piece of code? From what I understand you removed a font scaling transform, but you also removed line 392. I won't be able to review this unless I fully understand it.
Myles C. Maxfield
Comment 6 2015-05-21 16:42:47 PDT
Comment on attachment 253494 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=253494&action=review >> Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm:-219 >> - CGContextSetTextMatrix(context, savedMatrix); > > I'm not sure I understand why it is ok to remove the line above. Upon investigation, it appears that it isn't okay. The fact that no tests failed is troubling. I will investigate more. >> Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm:386 >> #endif > > Could you explain this piece of code? From what I understand you removed a font scaling transform, but you also removed line 392. I won't be able to review this unless I fully understand it. See my previous comment to jonlee. I think that should explain it.
Myles C. Maxfield
Comment 7 2015-05-21 16:55:34 PDT
(In reply to comment #4) > (Note that [drawFont matrix] is just a scale by fontSize). This is incorrect. It is often just a scale, but it might not be.
Myles C. Maxfield
Comment 8 2015-05-21 17:29:47 PDT
Enrica Casucci
Comment 9 2015-05-22 14:33:15 PDT
Comment on attachment 253561 [details] Patch Looks good now.
Myles C. Maxfield
Comment 10 2015-05-22 14:43:27 PDT
Antti Koivisto
Comment 11 2015-05-28 13:47:37 PDT
This might have been 2% PLT regression. Can we roll out to confirm?
Myles C. Maxfield
Comment 12 2015-05-28 15:13:10 PDT
But I measured it :( Go ahead, but make sure you also roll out http://trac.webkit.org/changeset/184832 first.
WebKit Commit Bot
Comment 13 2015-05-28 16:17:05 PDT
Re-opened since this is blocked by bug 145449
Myles C. Maxfield
Comment 14 2015-05-28 16:23:02 PDT
Myles C. Maxfield
Comment 15 2021-08-19 02:36:22 PDT
This is done.
Radar WebKit Bug Importer
Comment 16 2021-08-19 02:37:18 PDT
Note You need to log in before you can comment on or make changes to this bug.