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

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

Issue 1092793002: Add PS 'all' weight name to scanFont. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Make comment more specific. Created 5 years, 8 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 | « no previous file | 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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 "SkAdvancedTypefaceMetrics.h" 8 #include "SkAdvancedTypefaceMetrics.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after
1674 TT_OS2* os2 = static_cast<TT_OS2*>(FT_Get_Sfnt_Table(face, ft_sfnt_os2)); 1674 TT_OS2* os2 = static_cast<TT_OS2*>(FT_Get_Sfnt_Table(face, ft_sfnt_os2));
1675 if (os2 && os2->version != 0xffff) { 1675 if (os2 && os2->version != 0xffff) {
1676 weight = os2->usWeightClass; 1676 weight = os2->usWeightClass;
1677 width = os2->usWidthClass; 1677 width = os2->usWidthClass;
1678 } else if (0 == FT_Get_PS_Font_Info(face, &psFontInfo) && psFontInfo.weight) { 1678 } else if (0 == FT_Get_PS_Font_Info(face, &psFontInfo) && psFontInfo.weight) {
1679 static const struct { 1679 static const struct {
1680 char const * const name; 1680 char const * const name;
1681 int const weight; 1681 int const weight;
1682 } commonWeights [] = { 1682 } commonWeights [] = {
1683 // There are probably more common names, but these are known to exis t. 1683 // There are probably more common names, but these are known to exis t.
1684 { "all", SkFontStyle::kNormal_Weight }, // Multiple Masters usually default to normal.
1684 { "black", SkFontStyle::kBlack_Weight }, 1685 { "black", SkFontStyle::kBlack_Weight },
1685 { "bold", SkFontStyle::kBold_Weight }, 1686 { "bold", SkFontStyle::kBold_Weight },
1686 { "book", (SkFontStyle::kNormal_Weight + SkFontStyle::kLight_Weight) /2 }, 1687 { "book", (SkFontStyle::kNormal_Weight + SkFontStyle::kLight_Weight) /2 },
1687 { "demi", SkFontStyle::kSemiBold_Weight }, 1688 { "demi", SkFontStyle::kSemiBold_Weight },
1688 { "demibold", SkFontStyle::kSemiBold_Weight }, 1689 { "demibold", SkFontStyle::kSemiBold_Weight },
1689 { "extra", SkFontStyle::kExtraBold_Weight }, 1690 { "extra", SkFontStyle::kExtraBold_Weight },
1690 { "extrabold", SkFontStyle::kExtraBold_Weight }, 1691 { "extrabold", SkFontStyle::kExtraBold_Weight },
1691 { "extralight", SkFontStyle::kExtraLight_Weight }, 1692 { "extralight", SkFontStyle::kExtraLight_Weight },
1692 { "hairline", SkFontStyle::kThin_Weight }, 1693 { "hairline", SkFontStyle::kThin_Weight },
1693 { "heavy", SkFontStyle::kBlack_Weight }, 1694 { "heavy", SkFontStyle::kBlack_Weight },
(...skipping 27 matching lines...) Expand all
1721 if (style) { 1722 if (style) {
1722 *style = SkFontStyle(weight, width, slant); 1723 *style = SkFontStyle(weight, width, slant);
1723 } 1724 }
1724 if (isFixedPitch) { 1725 if (isFixedPitch) {
1725 *isFixedPitch = FT_IS_FIXED_WIDTH(face); 1726 *isFixedPitch = FT_IS_FIXED_WIDTH(face);
1726 } 1727 }
1727 1728
1728 FT_Done_Face(face); 1729 FT_Done_Face(face);
1729 return true; 1730 return true;
1730 } 1731 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698