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

Unified Diff: src/ports/SkFontHost_FreeType.cpp

Issue 29363009: prototype for kerning api (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 months 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
Index: src/ports/SkFontHost_FreeType.cpp
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index eb2f28a59dd8567f0fc71e970cc80620ed6830ba..fc14bd36443053772196d8fa5e3c70e22b5f20c6 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -729,6 +729,25 @@ int SkTypeface_FreeType::onGetUPEM() const {
return face ? face->units_per_EM : 0;
}
+bool SkTypeface_FreeType::onGetKerningPairAdjustments(const uint16_t glyphs[],
+ int count, int32_t adjustments[]) const {
+ AutoFTAccess fta(this);
+ FT_Face face = fta.face();
bungeman-skia 2013/10/29 21:38:41 I think you want a test around FT_HAS_KERNING(face
reed1 2013/10/30 13:59:37 Done.
+
+ for (int i = 0; i < count - 1; ++i) {
+ FT_Vector delta;
+ FT_Error err = FT_Get_Kerning(face, glyphs[i], glyphs[i+1],
+ FT_KERNING_UNSCALED, &delta);
+ if (err) {
+ return false;
bungeman-skia 2013/10/29 21:38:41 Hey, the documentation implies that adjustments wo
reed1 2013/10/30 13:59:37 Done.
+ }
+ if (adjustments) {
+ adjustments[i] = delta.x;
+ }
+ }
+ return true;
+}
+
SkScalerContext_FreeType::SkScalerContext_FreeType(SkTypeface* typeface,
const SkDescriptor* desc)
: SkScalerContext_FreeType_Base(typeface, desc) {

Powered by Google App Engine
This is Rietveld 408576698