OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkTypes.h" | 8 #include "SkTypes.h" |
9 #undef GetGlyphIndices | 9 #undef GetGlyphIndices |
10 | 10 |
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 fTypeface->fDWriteFontFace->GetMetrics(&dwfm); | 867 fTypeface->fDWriteFontFace->GetMetrics(&dwfm); |
868 | 868 |
869 SkScalar upem = SkIntToScalar(dwfm.designUnitsPerEm); | 869 SkScalar upem = SkIntToScalar(dwfm.designUnitsPerEm); |
870 if (mx) { | 870 if (mx) { |
871 mx->fTop = -fRec.fTextSize * SkIntToScalar(dwfm.ascent) / upem; | 871 mx->fTop = -fRec.fTextSize * SkIntToScalar(dwfm.ascent) / upem; |
872 mx->fAscent = mx->fTop; | 872 mx->fAscent = mx->fTop; |
873 mx->fDescent = fRec.fTextSize * SkIntToScalar(dwfm.descent) / upem; | 873 mx->fDescent = fRec.fTextSize * SkIntToScalar(dwfm.descent) / upem; |
874 mx->fBottom = mx->fDescent; | 874 mx->fBottom = mx->fDescent; |
875 mx->fLeading = fRec.fTextSize * SkIntToScalar(dwfm.lineGap) / upem; | 875 mx->fLeading = fRec.fTextSize * SkIntToScalar(dwfm.lineGap) / upem; |
876 mx->fXHeight = fRec.fTextSize * SkIntToScalar(dwfm.xHeight) / upem; | 876 mx->fXHeight = fRec.fTextSize * SkIntToScalar(dwfm.xHeight) / upem; |
| 877 mx->fUnderlineThickness = fRec.fTextSize * SkIntToScalar(dwfm.underlineP
osition) / upem; |
| 878 mx->fUnderlinePosition = -(fRec.fTextSize * SkIntToScalar(dwfm.underline
Thickness) / upem); |
| 879 |
| 880 mx->fFlags |= SkPaint::FontMetrics::kUnderlineThinknessIsValid_Flag; |
| 881 mx->fFlags |= SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag; |
877 } | 882 } |
878 | 883 |
879 if (my) { | 884 if (my) { |
880 my->fTop = -fRec.fTextSize * SkIntToScalar(dwfm.ascent) / upem; | 885 my->fTop = -fRec.fTextSize * SkIntToScalar(dwfm.ascent) / upem; |
881 my->fAscent = my->fTop; | 886 my->fAscent = my->fTop; |
882 my->fDescent = fRec.fTextSize * SkIntToScalar(dwfm.descent) / upem; | 887 my->fDescent = fRec.fTextSize * SkIntToScalar(dwfm.descent) / upem; |
883 my->fBottom = my->fDescent; | 888 my->fBottom = my->fDescent; |
884 my->fLeading = fRec.fTextSize * SkIntToScalar(dwfm.lineGap) / upem; | 889 my->fLeading = fRec.fTextSize * SkIntToScalar(dwfm.lineGap) / upem; |
885 my->fXHeight = fRec.fTextSize * SkIntToScalar(dwfm.xHeight) / upem; | 890 my->fXHeight = fRec.fTextSize * SkIntToScalar(dwfm.xHeight) / upem; |
| 891 my->fUnderlineThickness = fRec.fTextSize * SkIntToScalar(dwfm.underlineP
osition) / upem; |
| 892 my->fUnderlinePosition = -(fRec.fTextSize * SkIntToScalar(dwfm.underline
Thickness) / upem); |
| 893 |
| 894 my->fFlags |= SkPaint::FontMetrics::kUnderlineThinknessIsValid_Flag; |
| 895 my->fFlags |= SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag; |
886 } | 896 } |
887 } | 897 } |
888 | 898 |
889 /////////////////////////////////////////////////////////////////////////////// | 899 /////////////////////////////////////////////////////////////////////////////// |
890 | 900 |
891 #include "SkColorPriv.h" | 901 #include "SkColorPriv.h" |
892 | 902 |
893 static void bilevel_to_bw(const uint8_t* SK_RESTRICT src, const SkGlyph& glyph)
{ | 903 static void bilevel_to_bw(const uint8_t* SK_RESTRICT src, const SkGlyph& glyph)
{ |
894 const int width = glyph.fWidth; | 904 const int width = glyph.fWidth; |
895 const size_t dstRB = (width + 7) >> 3; | 905 const size_t dstRB = (width + 7) >> 3; |
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1912 SK_TRACEHR(hr, "Could not get GetUserDefaultLocaleName."); | 1922 SK_TRACEHR(hr, "Could not get GetUserDefaultLocaleName."); |
1913 } else { | 1923 } else { |
1914 localeNameLen = getUserDefaultLocaleNameProc(localeNameStorage, LOCALE_N
AME_MAX_LENGTH); | 1924 localeNameLen = getUserDefaultLocaleNameProc(localeNameStorage, LOCALE_N
AME_MAX_LENGTH); |
1915 if (localeNameLen) { | 1925 if (localeNameLen) { |
1916 localeName = localeNameStorage; | 1926 localeName = localeNameStorage; |
1917 }; | 1927 }; |
1918 } | 1928 } |
1919 | 1929 |
1920 return SkNEW_ARGS(SkFontMgr_DirectWrite, (sysFontCollection.get(), localeNam
e, localeNameLen)); | 1930 return SkNEW_ARGS(SkFontMgr_DirectWrite, (sysFontCollection.get(), localeNam
e, localeNameLen)); |
1921 } | 1931 } |
OLD | NEW |