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

Unified Diff: src/ports/SkFontHost_mac.cpp

Issue 370463002: Remove vertical/horizontal metrics selection. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix Mac. Created 6 years, 6 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
« no previous file with comments | « src/ports/SkFontHost_FreeType.cpp ('k') | src/ports/SkFontHost_win.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontHost_mac.cpp
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index 06e6fac2f75347c8ff076891d4bcbe79bf1a5dd2..21a2b956148b8ac53a17d2a3b94498ffdbf51e18 100755
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -656,7 +656,7 @@ protected:
void generateMetrics(SkGlyph* glyph) SK_OVERRIDE;
void generateImage(const SkGlyph& glyph) SK_OVERRIDE;
void generatePath(const SkGlyph& glyph, SkPath* path) SK_OVERRIDE;
- void generateFontMetrics(SkPaint::FontMetrics* mX, SkPaint::FontMetrics* mY) SK_OVERRIDE;
+ void generateFontMetrics(SkPaint::FontMetrics*) SK_OVERRIDE;
private:
static void CTPathElement(void *info, const CGPathElement *element);
@@ -1368,32 +1368,27 @@ void SkScalerContext_Mac::generatePath(const SkGlyph& glyph, SkPath* path) {
}
}
-void SkScalerContext_Mac::generateFontMetrics(SkPaint::FontMetrics* mx,
- SkPaint::FontMetrics* my) {
- CGRect theBounds = CTFontGetBoundingBox(fCTFont);
-
- SkPaint::FontMetrics theMetrics;
- theMetrics.fTop = CGToScalar(-CGRectGetMaxY_inline(theBounds));
- theMetrics.fAscent = CGToScalar(-CTFontGetAscent(fCTFont));
- theMetrics.fDescent = CGToScalar( CTFontGetDescent(fCTFont));
- theMetrics.fBottom = CGToScalar(-CGRectGetMinY_inline(theBounds));
- theMetrics.fLeading = CGToScalar( CTFontGetLeading(fCTFont));
- theMetrics.fAvgCharWidth = CGToScalar( CGRectGetWidth_inline(theBounds));
- theMetrics.fXMin = CGToScalar( CGRectGetMinX_inline(theBounds));
- theMetrics.fXMax = CGToScalar( CGRectGetMaxX_inline(theBounds));
- theMetrics.fXHeight = CGToScalar( CTFontGetXHeight(fCTFont));
- theMetrics.fUnderlineThickness = CGToScalar( CTFontGetUnderlineThickness(fCTFont));
- theMetrics.fUnderlinePosition = -CGToScalar( CTFontGetUnderlinePosition(fCTFont));
+void SkScalerContext_Mac::generateFontMetrics(SkPaint::FontMetrics* metrics) {
+ if (NULL == metrics) {
+ return;
+ }
- theMetrics.fFlags |= SkPaint::FontMetrics::kUnderlineThinknessIsValid_Flag;
- theMetrics.fFlags |= SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag;
+ CGRect theBounds = CTFontGetBoundingBox(fCTFont);
- if (mx != NULL) {
- *mx = theMetrics;
- }
- if (my != NULL) {
- *my = theMetrics;
- }
+ metrics->fTop = CGToScalar(-CGRectGetMaxY_inline(theBounds));
+ metrics->fAscent = CGToScalar(-CTFontGetAscent(fCTFont));
+ metrics->fDescent = CGToScalar( CTFontGetDescent(fCTFont));
+ metrics->fBottom = CGToScalar(-CGRectGetMinY_inline(theBounds));
+ metrics->fLeading = CGToScalar( CTFontGetLeading(fCTFont));
+ metrics->fAvgCharWidth = CGToScalar( CGRectGetWidth_inline(theBounds));
+ metrics->fXMin = CGToScalar( CGRectGetMinX_inline(theBounds));
+ metrics->fXMax = CGToScalar( CGRectGetMaxX_inline(theBounds));
+ metrics->fXHeight = CGToScalar( CTFontGetXHeight(fCTFont));
+ metrics->fUnderlineThickness = CGToScalar( CTFontGetUnderlineThickness(fCTFont));
+ metrics->fUnderlinePosition = -CGToScalar( CTFontGetUnderlinePosition(fCTFont));
+
+ metrics->fFlags |= SkPaint::FontMetrics::kUnderlineThinknessIsValid_Flag;
+ metrics->fFlags |= SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag;
}
void SkScalerContext_Mac::CTPathElement(void *info, const CGPathElement *element) {
« no previous file with comments | « src/ports/SkFontHost_FreeType.cpp ('k') | src/ports/SkFontHost_win.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698