aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-06-21 05:31:38 +0000
committerGravatar bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-06-21 05:31:38 +0000
commite9d831957602e3fa46fc4b609ae6d2da46654915 (patch)
tree0ae833efa40840c0ece628070ae7939e4c6b2653
parent45a30714982e8b5b18539b2ad71f3aceab8ed075 (diff)
Add maxCharWidth and a compile flag to use old metrics (needed by Blink).
Review URL: https://codereview.chromium.org/17502006 git-svn-id: http://skia.googlecode.com/svn/trunk@9712 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--include/core/SkPaint.h1
-rwxr-xr-xsrc/ports/SkFontHost_win.cpp13
2 files changed, 14 insertions, 0 deletions
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index caa2030e6f..d390ce29f3 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -714,6 +714,7 @@ public:
SkScalar fBottom; //!< The greatest distance below the baseline for any glyph (will be >= 0)
SkScalar fLeading; //!< The recommended distance to add between lines of text (will be >= 0)
SkScalar fAvgCharWidth; //!< the average charactor width (>= 0)
+ SkScalar fMaxCharWidth; //!< the max charactor width (>= 0)
SkScalar fXMin; //!< The minimum bounding box x value for all glyphs
SkScalar fXMax; //!< The maximum bounding box x value for all glyphs
SkScalar fXHeight; //!< the height of an 'x' in px, or 0 if no 'x' in face
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp
index 3a7f518d6a..833c23f718 100755
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -839,7 +839,9 @@ void SkScalerContext_Windows::generateFontMetrics(SkPaint::FontMetrics* mx, SkPa
SkASSERT(fDDC);
+#ifndef SK_GDI_ALWAYS_USE_TEXTMETRICS_FOR_FONT_METRICS
if (fType == SkScalerContext_Windows::kBitmap_Type) {
+#endif
if (mx) {
mx->fTop = SkIntToScalar(-fTM.tmAscent);
mx->fAscent = SkIntToScalar(-fTM.tmAscent);
@@ -855,9 +857,15 @@ void SkScalerContext_Windows::generateFontMetrics(SkPaint::FontMetrics* mx, SkPa
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;
}
+#ifndef SK_GDI_ALWAYS_USE_TEXTMETRICS_FOR_FONT_METRICS
return;
}
+#endif
OUTLINETEXTMETRIC otm;
@@ -879,12 +887,17 @@ void SkScalerContext_Windows::generateFontMetrics(SkPaint::FontMetrics* mx, SkPa
}
if (my) {
+#ifndef SK_GDI_ALWAYS_USE_TEXTMETRICS_FOR_FONT_METRICS
my->fTop = -fScale * otm.otmrcFontBox.top;
my->fAscent = -fScale * otm.otmAscent;
my->fDescent = -fScale * otm.otmDescent;
my->fBottom = -fScale * otm.otmrcFontBox.bottom;
my->fLeading = fScale * otm.otmLineGap;
my->fAvgCharWidth = fScale * otm.otmTextMetrics.tmAveCharWidth;
+ my->fMaxCharWidth = fScale * otm.otmTextMetrics.tmMaxCharWidth;
+ my->fXMin = fScale * otm.otmrcFontBox.left;
+ my->fXMax = fScale * otm.otmrcFontBox.right;
+#endif
my->fXHeight = fScale * otm.otmsXHeight;
}
}