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

Unified Diff: src/ports/SkFontHost_win.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_mac.cpp ('k') | src/ports/SkScalerContext_win_dw.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontHost_win.cpp
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp
index a6ccf4d2ee37f0f90f024fe46d2ac2d021e878da..e4aab81b150aa73f2bec05c2c71316bb7b3fcec6 100755
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -559,8 +559,7 @@ protected:
virtual void generateMetrics(SkGlyph* glyph) SK_OVERRIDE;
virtual void generateImage(const SkGlyph& glyph) SK_OVERRIDE;
virtual void generatePath(const SkGlyph& glyph, SkPath* path) SK_OVERRIDE;
- virtual void generateFontMetrics(SkPaint::FontMetrics* mX,
- SkPaint::FontMetrics* mY) SK_OVERRIDE;
+ virtual void generateFontMetrics(SkPaint::FontMetrics*) SK_OVERRIDE;
private:
DWORD getGDIGlyphPath(const SkGlyph& glyph, UINT flags,
@@ -978,43 +977,27 @@ void SkScalerContext_GDI::generateMetrics(SkGlyph* glyph) {
}
static const MAT2 gMat2Identity = {{0, 1}, {0, 0}, {0, 0}, {0, 1}};
-void SkScalerContext_GDI::generateFontMetrics(SkPaint::FontMetrics* mx, SkPaint::FontMetrics* my) {
- if (!(mx || my)) {
- return;
- }
-
- if (mx) {
- sk_bzero(mx, sizeof(*mx));
- }
- if (my) {
- sk_bzero(my, sizeof(*my));
+void SkScalerContext_GDI::generateFontMetrics(SkPaint::FontMetrics* metrics) {
+ if (NULL == metrics) {
+ return;
}
+ sk_bzero(metrics, sizeof(*metrics));
SkASSERT(fDDC);
#ifndef SK_GDI_ALWAYS_USE_TEXTMETRICS_FOR_FONT_METRICS
if (fType == SkScalerContext_GDI::kBitmap_Type || fType == SkScalerContext_GDI::kLine_Type) {
#endif
- if (mx) {
- mx->fTop = SkIntToScalar(-fTM.tmAscent);
- mx->fAscent = SkIntToScalar(-fTM.tmAscent);
- mx->fDescent = SkIntToScalar(fTM.tmDescent);
- mx->fBottom = SkIntToScalar(fTM.tmDescent);
- mx->fLeading = SkIntToScalar(fTM.tmExternalLeading);
- }
-
- if (my) {
- my->fTop = SkIntToScalar(-fTM.tmAscent);
- my->fAscent = SkIntToScalar(-fTM.tmAscent);
- my->fDescent = SkIntToScalar(fTM.tmDescent);
- my->fBottom = SkIntToScalar(fTM.tmDescent);
- my->fLeading = SkIntToScalar(fTM.tmExternalLeading);
- my->fAvgCharWidth = SkIntToScalar(fTM.tmAveCharWidth);
- my->fMaxCharWidth = SkIntToScalar(fTM.tmMaxCharWidth);
- my->fXMin = 0;
- my->fXMax = my->fMaxCharWidth;
- //my->fXHeight = 0;
- }
+ metrics->fTop = SkIntToScalar(-fTM.tmAscent);
+ metrics->fAscent = SkIntToScalar(-fTM.tmAscent);
+ metrics->fDescent = SkIntToScalar(fTM.tmDescent);
+ metrics->fBottom = SkIntToScalar(fTM.tmDescent);
+ metrics->fLeading = SkIntToScalar(fTM.tmExternalLeading);
+ metrics->fAvgCharWidth = SkIntToScalar(fTM.tmAveCharWidth);
+ metrics->fMaxCharWidth = SkIntToScalar(fTM.tmMaxCharWidth);
+ metrics->fXMin = 0;
+ metrics->fXMax = metrics->fMaxCharWidth;
+ //metrics->fXHeight = 0;
#ifndef SK_GDI_ALWAYS_USE_TEXTMETRICS_FOR_FONT_METRICS
return;
}
@@ -1031,45 +1014,29 @@ void SkScalerContext_GDI::generateFontMetrics(SkPaint::FontMetrics* mx, SkPaint:
return;
}
- if (mx) {
- mx->fTop = SkIntToScalar(-otm.otmrcFontBox.left);
- mx->fAscent = SkIntToScalar(-otm.otmAscent);
- mx->fDescent = SkIntToScalar(-otm.otmDescent);
- mx->fBottom = SkIntToScalar(otm.otmrcFontBox.right);
- mx->fLeading = SkIntToScalar(otm.otmLineGap);
- mx->fUnderlineThickness = SkIntToScalar(otm.otmsUnderscoreSize);
- mx->fUnderlinePosition = -SkIntToScalar(otm.otmsUnderscorePosition);
-
- mx->fFlags |= SkPaint::FontMetrics::kUnderlineThinknessIsValid_Flag;
- mx->fFlags |= SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag;
- }
-
- if (my) {
#ifndef SK_GDI_ALWAYS_USE_TEXTMETRICS_FOR_FONT_METRICS
- my->fTop = SkIntToScalar(-otm.otmrcFontBox.top);
- my->fAscent = SkIntToScalar(-otm.otmAscent);
- my->fDescent = SkIntToScalar(-otm.otmDescent);
- my->fBottom = SkIntToScalar(-otm.otmrcFontBox.bottom);
- my->fLeading = SkIntToScalar(otm.otmLineGap);
- my->fAvgCharWidth = SkIntToScalar(otm.otmTextMetrics.tmAveCharWidth);
- my->fMaxCharWidth = SkIntToScalar(otm.otmTextMetrics.tmMaxCharWidth);
- my->fXMin = SkIntToScalar(otm.otmrcFontBox.left);
- my->fXMax = SkIntToScalar(otm.otmrcFontBox.right);
+ metrics->fTop = SkIntToScalar(-otm.otmrcFontBox.top);
+ metrics->fAscent = SkIntToScalar(-otm.otmAscent);
+ metrics->fDescent = SkIntToScalar(-otm.otmDescent);
+ metrics->fBottom = SkIntToScalar(-otm.otmrcFontBox.bottom);
+ metrics->fLeading = SkIntToScalar(otm.otmLineGap);
+ metrics->fAvgCharWidth = SkIntToScalar(otm.otmTextMetrics.tmAveCharWidth);
+ metrics->fMaxCharWidth = SkIntToScalar(otm.otmTextMetrics.tmMaxCharWidth);
+ metrics->fXMin = SkIntToScalar(otm.otmrcFontBox.left);
+ metrics->fXMax = SkIntToScalar(otm.otmrcFontBox.right);
#endif
- my->fUnderlineThickness = SkIntToScalar(otm.otmsUnderscoreSize);
- my->fUnderlinePosition = -SkIntToScalar(otm.otmsUnderscorePosition);
-
- my->fFlags |= SkPaint::FontMetrics::kUnderlineThinknessIsValid_Flag;
- my->fFlags |= SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag;
+ metrics->fUnderlineThickness = SkIntToScalar(otm.otmsUnderscoreSize);
+ metrics->fUnderlinePosition = -SkIntToScalar(otm.otmsUnderscorePosition);
- my->fXHeight = SkIntToScalar(otm.otmsXHeight);
+ metrics->fFlags |= SkPaint::FontMetrics::kUnderlineThinknessIsValid_Flag;
+ metrics->fFlags |= SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag;
- GLYPHMETRICS gm;
- sk_bzero(&gm, sizeof(gm));
- DWORD len = GetGlyphOutlineW(fDDC, 'x', GGO_METRICS, &gm, 0, 0, &gMat2Identity);
- if (len != GDI_ERROR && gm.gmBlackBoxY > 0) {
- my->fXHeight = SkIntToScalar(gm.gmBlackBoxY);
- }
+ metrics->fXHeight = SkIntToScalar(otm.otmsXHeight);
+ GLYPHMETRICS gm;
+ sk_bzero(&gm, sizeof(gm));
+ DWORD len = GetGlyphOutlineW(fDDC, 'x', GGO_METRICS, &gm, 0, 0, &gMat2Identity);
+ if (len != GDI_ERROR && gm.gmBlackBoxY > 0) {
+ metrics->fXHeight = SkIntToScalar(gm.gmBlackBoxY);
}
}
@@ -2409,7 +2376,8 @@ void LogFontTypeface::onFilterRec(SkScalerContextRec* rec) const {
rec->fFlags |= SkScalerContext::kGenA8FromLCD_Flag;
}
- unsigned flagsWeDontSupport = SkScalerContext::kDevKernText_Flag |
+ unsigned flagsWeDontSupport = SkScalerContext::kVertical_Flag |
+ SkScalerContext::kDevKernText_Flag |
SkScalerContext::kForceAutohinting_Flag |
SkScalerContext::kEmbeddedBitmapText_Flag |
SkScalerContext::kEmbolden_Flag |
« no previous file with comments | « src/ports/SkFontHost_mac.cpp ('k') | src/ports/SkScalerContext_win_dw.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698