float Font::platformWidthForGlyph(Glyph glyph) const
CGSize advance = CGSizeZero;
... populate advance ...
return advance.width + [unrelated stuff];
float width = font->widthForGlyph(glyph);
Created attachment 434191 [details]
Created attachment 434269 [details]
WebCore\platform\graphics\win\SimpleFontDataCGWin.cpp(121,16): error C3861: 'makeGyphBufferAdvance': identifier not found
Created attachment 434295 [details]
Comment on attachment 434295 [details]
We might not want to do this.
(In reply to Myles C. Maxfield from comment #6)
> We might not want to do this.
(In reply to Darin Adler from comment #7)
> (In reply to Myles C. Maxfield from comment #6)
> > We might not want to do this.
Because this data comes from the hmtx and vmtx tables in the font, but the data contained inside those tables is one-dimensional. This means that the y-components of these advances is always 0 (or almost always 0, if CoreText has some corner case somewhere which might set something in some circumstance to nonzero).
These advances are retained inside caches, and it would be kind of unfortunate to double the size of our caches just so we can store a bunch of 0 values.
So, I need to determine if CTFontGetAdvancesForCharacters() will ever return a nonzero value for the Y-components. If it does, I should rework this patch to only store the nonzero values in our caches (maybe by using a unique_ptr which is usually null or something). If it doesn't, then we should just straight up not do this patch.
There’s a chance that bitmap fonts might actually be capable of having nonzero y advances. I’m making a test font to see. https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6bdat.html
I believe I've proved that CoreText will always report 0 for one of the two fields when you ask it for advances. So, it looks like this bug is unnecessary.