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

Side by Side Diff: src/ports/SkFontHost_win_dw.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: Updating files as per HEAD Created 6 years, 9 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
« no previous file with comments | « src/ports/SkFontHost_win.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « src/ports/SkFontHost_win.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698