OLD | NEW |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkAdvancedTypefaceMetrics.h" | 9 #include "SkAdvancedTypefaceMetrics.h" |
10 #include "SkBase64.h" | 10 #include "SkBase64.h" |
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1054 if (0 == ret) { | 1054 if (0 == ret) { |
1055 return; | 1055 return; |
1056 } | 1056 } |
1057 | 1057 |
1058 if (mx) { | 1058 if (mx) { |
1059 mx->fTop = SkIntToScalar(-otm.otmrcFontBox.left); | 1059 mx->fTop = SkIntToScalar(-otm.otmrcFontBox.left); |
1060 mx->fAscent = SkIntToScalar(-otm.otmAscent); | 1060 mx->fAscent = SkIntToScalar(-otm.otmAscent); |
1061 mx->fDescent = SkIntToScalar(-otm.otmDescent); | 1061 mx->fDescent = SkIntToScalar(-otm.otmDescent); |
1062 mx->fBottom = SkIntToScalar(otm.otmrcFontBox.right); | 1062 mx->fBottom = SkIntToScalar(otm.otmrcFontBox.right); |
1063 mx->fLeading = SkIntToScalar(otm.otmLineGap); | 1063 mx->fLeading = SkIntToScalar(otm.otmLineGap); |
1064 mx->fUnderlineThickness = SkIntToScalar(otm.otmsUnderscoreSize); | |
1065 mx->fUnderlinePosition = SkIntToScalar(otm.otmsUnderscorePosition); | |
1066 | |
1067 if(!mx->fUnderlineThickness) | |
bungeman-skia
2014/02/19 15:39:17
If we get here, we're only dealing with fonts whic
h.joshi
2014/02/19 17:12:03
Okey, Added these checks below as "face->underline
| |
1068 mx->unsetFontMetricsFlag(SkPaint::FontMetrics::kUnderlineThinknessIs Valid_FontMetricFlag); | |
1069 else | |
1070 mx->setFontMetricsFlag(SkPaint::FontMetrics::kUnderlineThinknessIsVa lid_FontMetricFlag); | |
1071 | |
1072 if(!mx->fUnderlinePosition) | |
1073 mx->unsetFontMetricsFlag(SkPaint::FontMetrics::kUnderlinePositionIsV alid_FontMetricsflag); | |
1074 else | |
1075 mx->setFontMetricsFlag(SkPaint::FontMetrics::kUnderlinePositionIsVal id_FontMetricsflag); | |
1064 } | 1076 } |
1065 | 1077 |
1066 if (my) { | 1078 if (my) { |
1067 #ifndef SK_GDI_ALWAYS_USE_TEXTMETRICS_FOR_FONT_METRICS | 1079 #ifndef SK_GDI_ALWAYS_USE_TEXTMETRICS_FOR_FONT_METRICS |
1068 my->fTop = SkIntToScalar(-otm.otmrcFontBox.top); | 1080 my->fTop = SkIntToScalar(-otm.otmrcFontBox.top); |
1069 my->fAscent = SkIntToScalar(-otm.otmAscent); | 1081 my->fAscent = SkIntToScalar(-otm.otmAscent); |
1070 my->fDescent = SkIntToScalar(-otm.otmDescent); | 1082 my->fDescent = SkIntToScalar(-otm.otmDescent); |
1071 my->fBottom = SkIntToScalar(-otm.otmrcFontBox.bottom); | 1083 my->fBottom = SkIntToScalar(-otm.otmrcFontBox.bottom); |
1072 my->fLeading = SkIntToScalar(otm.otmLineGap); | 1084 my->fLeading = SkIntToScalar(otm.otmLineGap); |
1073 my->fAvgCharWidth = SkIntToScalar(otm.otmTextMetrics.tmAveCharWidth); | 1085 my->fAvgCharWidth = SkIntToScalar(otm.otmTextMetrics.tmAveCharWidth); |
1074 my->fMaxCharWidth = SkIntToScalar(otm.otmTextMetrics.tmMaxCharWidth); | 1086 my->fMaxCharWidth = SkIntToScalar(otm.otmTextMetrics.tmMaxCharWidth); |
1075 my->fXMin = SkIntToScalar(otm.otmrcFontBox.left); | 1087 my->fXMin = SkIntToScalar(otm.otmrcFontBox.left); |
1076 my->fXMax = SkIntToScalar(otm.otmrcFontBox.right); | 1088 my->fXMax = SkIntToScalar(otm.otmrcFontBox.right); |
1089 my->fUnderlineThickness = SkIntToScalar(otm.otmsUnderscoreSize); | |
1090 my->fUnderlinePosition = SkIntToScalar(otm.otmsUnderscorePosition); | |
1091 | |
1092 if(!my->fUnderlineThickness) | |
1093 my->unsetFontMetricsFlag(SkPaint::FontMetrics::kUnderlineThinknessIs Valid_FontMetricFlag); | |
1094 else | |
1095 my->setFontMetricsFlag(SkPaint::FontMetrics::kUnderlineThinknessIsVa lid_FontMetricFlag); | |
1096 | |
1097 if(!my->fUnderlinePosition) | |
1098 my->unsetFontMetricsFlag(SkPaint::FontMetrics::kUnderlinePositionIsV alid_FontMetricsflag); | |
1099 else | |
1100 my->setFontMetricsFlag(SkPaint::FontMetrics::kUnderlinePositionIsVal id_FontMetricsflag); | |
1077 #endif | 1101 #endif |
1078 my->fXHeight = SkIntToScalar(otm.otmsXHeight); | 1102 my->fXHeight = SkIntToScalar(otm.otmsXHeight); |
1079 | 1103 |
1080 GLYPHMETRICS gm; | 1104 GLYPHMETRICS gm; |
1081 sk_bzero(&gm, sizeof(gm)); | 1105 sk_bzero(&gm, sizeof(gm)); |
1082 DWORD len = GetGlyphOutlineW(fDDC, 'x', GGO_METRICS, &gm, 0, 0, &gMat2Id entity); | 1106 DWORD len = GetGlyphOutlineW(fDDC, 'x', GGO_METRICS, &gm, 0, 0, &gMat2Id entity); |
1083 if (len != GDI_ERROR && gm.gmBlackBoxY > 0) { | 1107 if (len != GDI_ERROR && gm.gmBlackBoxY > 0) { |
1084 my->fXHeight = SkIntToScalar(gm.gmBlackBoxY); | 1108 my->fXHeight = SkIntToScalar(gm.gmBlackBoxY); |
1085 } | 1109 } |
1086 } | 1110 } |
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2629 | 2653 |
2630 private: | 2654 private: |
2631 SkTDArray<ENUMLOGFONTEX> fLogFontArray; | 2655 SkTDArray<ENUMLOGFONTEX> fLogFontArray; |
2632 }; | 2656 }; |
2633 | 2657 |
2634 /////////////////////////////////////////////////////////////////////////////// | 2658 /////////////////////////////////////////////////////////////////////////////// |
2635 | 2659 |
2636 SkFontMgr* SkFontMgr_New_GDI() { | 2660 SkFontMgr* SkFontMgr_New_GDI() { |
2637 return SkNEW(SkFontMgrGDI); | 2661 return SkNEW(SkFontMgrGDI); |
2638 } | 2662 } |
OLD | NEW |