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 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 | 866 |
867 void SkScalerContext_GDI::generateAdvance(SkGlyph* glyph) { | 867 void SkScalerContext_GDI::generateAdvance(SkGlyph* glyph) { |
868 this->generateMetrics(glyph); | 868 this->generateMetrics(glyph); |
869 } | 869 } |
870 | 870 |
871 void SkScalerContext_GDI::generateMetrics(SkGlyph* glyph) { | 871 void SkScalerContext_GDI::generateMetrics(SkGlyph* glyph) { |
872 SkASSERT(fDDC); | 872 SkASSERT(fDDC); |
873 | 873 |
874 if (fType == SkScalerContext_GDI::kBitmap_Type || fType == SkScalerContext_G
DI::kLine_Type) { | 874 if (fType == SkScalerContext_GDI::kBitmap_Type || fType == SkScalerContext_G
DI::kLine_Type) { |
875 SIZE size; | 875 SIZE size; |
876 WORD glyphs = glyph->getGlyphID(0); | 876 WORD glyphs = glyph->getGlyphID(); |
877 if (0 == GetTextExtentPointI(fDDC, &glyphs, 1, &size)) { | 877 if (0 == GetTextExtentPointI(fDDC, &glyphs, 1, &size)) { |
878 glyph->fWidth = SkToS16(fTM.tmMaxCharWidth); | 878 glyph->fWidth = SkToS16(fTM.tmMaxCharWidth); |
879 } else { | 879 } else { |
880 glyph->fWidth = SkToS16(size.cx); | 880 glyph->fWidth = SkToS16(size.cx); |
881 } | 881 } |
882 glyph->fHeight = SkToS16(size.cy); | 882 glyph->fHeight = SkToS16(size.cy); |
883 | 883 |
884 glyph->fTop = SkToS16(-fTM.tmAscent); | 884 glyph->fTop = SkToS16(-fTM.tmAscent); |
885 // Bitmap FON cannot underhang, but vector FON may. | 885 // Bitmap FON cannot underhang, but vector FON may. |
886 // There appears no means of determining underhang of vector FON. | 886 // There appears no means of determining underhang of vector FON. |
(...skipping 17 matching lines...) Expand all Loading... |
904 glyph->fHeight = SkScalarTruncToInt(bounds.height()); | 904 glyph->fHeight = SkScalarTruncToInt(bounds.height()); |
905 } | 905 } |
906 | 906 |
907 // Apply matrix to advance. | 907 // Apply matrix to advance. |
908 glyph->fAdvanceY = SkFixedMul(-SkFIXEDToFixed(fMat22.eM12), glyph->fAdva
nceX); | 908 glyph->fAdvanceY = SkFixedMul(-SkFIXEDToFixed(fMat22.eM12), glyph->fAdva
nceX); |
909 glyph->fAdvanceX = SkFixedMul(SkFIXEDToFixed(fMat22.eM11), glyph->fAdvan
ceX); | 909 glyph->fAdvanceX = SkFixedMul(SkFIXEDToFixed(fMat22.eM11), glyph->fAdvan
ceX); |
910 | 910 |
911 return; | 911 return; |
912 } | 912 } |
913 | 913 |
914 UINT glyphId = glyph->getGlyphID(0); | 914 UINT glyphId = glyph->getGlyphID(); |
915 | 915 |
916 GLYPHMETRICS gm; | 916 GLYPHMETRICS gm; |
917 sk_bzero(&gm, sizeof(gm)); | 917 sk_bzero(&gm, sizeof(gm)); |
918 | 918 |
919 DWORD status = GetGlyphOutlineW(fDDC, glyphId, GGO_METRICS | GGO_GLYPH_INDEX
, &gm, 0, NULL, &fMat22); | 919 DWORD status = GetGlyphOutlineW(fDDC, glyphId, GGO_METRICS | GGO_GLYPH_INDEX
, &gm, 0, NULL, &fMat22); |
920 if (GDI_ERROR == status) { | 920 if (GDI_ERROR == status) { |
921 LogFontTypeface::EnsureAccessible(this->getTypeface()); | 921 LogFontTypeface::EnsureAccessible(this->getTypeface()); |
922 status = GetGlyphOutlineW(fDDC, glyphId, GGO_METRICS | GGO_GLYPH_INDEX,
&gm, 0, NULL, &fMat22); | 922 status = GetGlyphOutlineW(fDDC, glyphId, GGO_METRICS | GGO_GLYPH_INDEX,
&gm, 0, NULL, &fMat22); |
923 if (GDI_ERROR == status) { | 923 if (GDI_ERROR == status) { |
924 glyph->zeroMetrics(); | 924 glyph->zeroMetrics(); |
(...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2587 | 2587 |
2588 private: | 2588 private: |
2589 SkTDArray<ENUMLOGFONTEX> fLogFontArray; | 2589 SkTDArray<ENUMLOGFONTEX> fLogFontArray; |
2590 }; | 2590 }; |
2591 | 2591 |
2592 /////////////////////////////////////////////////////////////////////////////// | 2592 /////////////////////////////////////////////////////////////////////////////// |
2593 | 2593 |
2594 SkFontMgr* SkFontMgr_New_GDI() { | 2594 SkFontMgr* SkFontMgr_New_GDI() { |
2595 return SkNEW(SkFontMgrGDI); | 2595 return SkNEW(SkFontMgrGDI); |
2596 } | 2596 } |
OLD | NEW |