[webkit-dev] vertical text
caryclark at google.com
Thu Nov 10 14:07:50 PST 2011
TL;DR: Why is the graphics context rotated when drawing vertical text?
Skia ports use text-on-path to draw vertical text. This is slow, and
sometimes doesn't look very good, for instance when rendering
To fix this, I added vertical text support on Skia's Mac port. With the
current version, you can set a flag in the paint, so that drawing a line of
text goes from top to bottom instead of from left to right. Setting the
font and text size to match text-orientation-basic.html causes Skia to
generate identical output when compared to Safari.
Plugging this into WebKit, I was surprised that while the glyphs draw down
the page, each glyph is rotated 90 degrees from what I expected. While I
can fix this by rotating the graphics context one way and rotating the
glyph positions the opposite way, I wonder if there's a way to avoid the
>From reading online commentary and the implementation in FontMac.mm, there
appears to be some confusion about how to get CoreText to draw vertically.
I found that it is only necessary to rotate the advance and the vertical
offsets to compute the proper text metrics; the change from horizontal text
drawing is minimal. You can see that here:
The extra rotations may be a consequence of Skia on Mac using some Mac font
code in a way that wasn't intended -- I just don't know where to look to
find the code.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the webkit-dev