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

Side by Side Diff: src/ports/SkFontHost_win.cpp

Issue 152073003: Adding code to calculate Underline Thickness from Font Metrics, this will be useful when Skia is us… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Adding Bitfield to Font Metrics Structure Created 6 years, 10 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 unified diff | Download patch
OLDNEW
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
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);
1064 } 1066 }
1065 1067
1066 if (my) { 1068 if (my) {
1067 #ifndef SK_GDI_ALWAYS_USE_TEXTMETRICS_FOR_FONT_METRICS 1069 #ifndef SK_GDI_ALWAYS_USE_TEXTMETRICS_FOR_FONT_METRICS
1068 my->fTop = SkIntToScalar(-otm.otmrcFontBox.top); 1070 my->fTop = SkIntToScalar(-otm.otmrcFontBox.top);
1069 my->fAscent = SkIntToScalar(-otm.otmAscent); 1071 my->fAscent = SkIntToScalar(-otm.otmAscent);
1070 my->fDescent = SkIntToScalar(-otm.otmDescent); 1072 my->fDescent = SkIntToScalar(-otm.otmDescent);
1071 my->fBottom = SkIntToScalar(-otm.otmrcFontBox.bottom); 1073 my->fBottom = SkIntToScalar(-otm.otmrcFontBox.bottom);
1072 my->fLeading = SkIntToScalar(otm.otmLineGap); 1074 my->fLeading = SkIntToScalar(otm.otmLineGap);
1073 my->fAvgCharWidth = SkIntToScalar(otm.otmTextMetrics.tmAveCharWidth); 1075 my->fAvgCharWidth = SkIntToScalar(otm.otmTextMetrics.tmAveCharWidth);
1074 my->fMaxCharWidth = SkIntToScalar(otm.otmTextMetrics.tmMaxCharWidth); 1076 my->fMaxCharWidth = SkIntToScalar(otm.otmTextMetrics.tmMaxCharWidth);
1075 my->fXMin = SkIntToScalar(otm.otmrcFontBox.left); 1077 my->fXMin = SkIntToScalar(otm.otmrcFontBox.left);
1076 my->fXMax = SkIntToScalar(otm.otmrcFontBox.right); 1078 my->fXMax = SkIntToScalar(otm.otmrcFontBox.right);
1079 my->fUnderlineThickness = SkIntToScalar(otm.otmsUnderscoreSize);
1080 my->fUnderlinePosition = SkIntToScalar(otm.otmsUnderscorePosition);
1077 #endif 1081 #endif
1078 my->fXHeight = SkIntToScalar(otm.otmsXHeight); 1082 my->fXHeight = SkIntToScalar(otm.otmsXHeight);
1079 1083
1080 GLYPHMETRICS gm; 1084 GLYPHMETRICS gm;
1081 sk_bzero(&gm, sizeof(gm)); 1085 sk_bzero(&gm, sizeof(gm));
1082 DWORD len = GetGlyphOutlineW(fDDC, 'x', GGO_METRICS, &gm, 0, 0, &gMat2Id entity); 1086 DWORD len = GetGlyphOutlineW(fDDC, 'x', GGO_METRICS, &gm, 0, 0, &gMat2Id entity);
1083 if (len != GDI_ERROR && gm.gmBlackBoxY > 0) { 1087 if (len != GDI_ERROR && gm.gmBlackBoxY > 0) {
1084 my->fXHeight = SkIntToScalar(gm.gmBlackBoxY); 1088 my->fXHeight = SkIntToScalar(gm.gmBlackBoxY);
1085 } 1089 }
1086 } 1090 }
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after
2629 2633
2630 private: 2634 private:
2631 SkTDArray<ENUMLOGFONTEX> fLogFontArray; 2635 SkTDArray<ENUMLOGFONTEX> fLogFontArray;
2632 }; 2636 };
2633 2637
2634 /////////////////////////////////////////////////////////////////////////////// 2638 ///////////////////////////////////////////////////////////////////////////////
2635 2639
2636 SkFontMgr* SkFontMgr_New_GDI() { 2640 SkFontMgr* SkFontMgr_New_GDI() {
2637 return SkNEW(SkFontMgrGDI); 2641 return SkNEW(SkFontMgrGDI);
2638 } 2642 }
OLDNEW
« src/ports/SkFontHost_FreeType.cpp ('K') | « src/ports/SkFontHost_mac.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698