Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Unified Diff: Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp

Issue 11419217: Merge 133494 - Implement SimpleFontData::platformBoundsForGlyph on skia (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1312/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp
===================================================================
--- Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp (revision 136091)
+++ Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp (working copy)
@@ -234,9 +234,26 @@
m_treatAsFixedPitch = platformData().isFixedPitch();
}
-FloatRect SimpleFontData::platformBoundsForGlyph(Glyph) const
+FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const
{
- return FloatRect();
+ if (!m_platformData.size())
+ return FloatRect();
+
+ SkASSERT(sizeof(glyph) == 2); // compile-time assert
+
+ SkPaint paint;
+
+ m_platformData.setupPaint(&paint);
+
+ paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
+ SkRect bounds;
+ paint.measureText(&glyph, 2, &bounds);
+ if (!paint.isSubpixelText()) {
+ SkIRect ir;
+ bounds.round(&ir);
+ bounds.set(ir);
+ }
+ return FloatRect(bounds);
}
float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698