OLD | NEW |
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 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1689 } | 1689 } |
1690 if (face->style_flags & FT_STYLE_FLAG_ITALIC) { | 1690 if (face->style_flags & FT_STYLE_FLAG_ITALIC) { |
1691 slant = SkFontStyle::kItalic_Slant; | 1691 slant = SkFontStyle::kItalic_Slant; |
1692 } | 1692 } |
1693 | 1693 |
1694 PS_FontInfoRec psFontInfo; | 1694 PS_FontInfoRec psFontInfo; |
1695 TT_OS2* os2 = static_cast<TT_OS2*>(FT_Get_Sfnt_Table(face, ft_sfnt_os2)); | 1695 TT_OS2* os2 = static_cast<TT_OS2*>(FT_Get_Sfnt_Table(face, ft_sfnt_os2)); |
1696 if (os2 && os2->version != 0xffff) { | 1696 if (os2 && os2->version != 0xffff) { |
1697 weight = os2->usWeightClass; | 1697 weight = os2->usWeightClass; |
1698 width = os2->usWidthClass; | 1698 width = os2->usWidthClass; |
| 1699 |
| 1700 // OS/2::fsSelection bit 9 indicates oblique. |
| 1701 if (SkToBool(os2->fsSelection & (1u << 9))) { |
| 1702 slant = SkFontStyle::kOblique_Slant; |
| 1703 } |
1699 } else if (0 == FT_Get_PS_Font_Info(face, &psFontInfo) && psFontInfo.weight)
{ | 1704 } else if (0 == FT_Get_PS_Font_Info(face, &psFontInfo) && psFontInfo.weight)
{ |
1700 static const struct { | 1705 static const struct { |
1701 char const * const name; | 1706 char const * const name; |
1702 int const weight; | 1707 int const weight; |
1703 } commonWeights [] = { | 1708 } commonWeights [] = { |
1704 // There are probably more common names, but these are known to exis
t. | 1709 // There are probably more common names, but these are known to exis
t. |
1705 { "all", SkFontStyle::kNormal_Weight }, // Multiple Masters usually
default to normal. | 1710 { "all", SkFontStyle::kNormal_Weight }, // Multiple Masters usually
default to normal. |
1706 { "black", SkFontStyle::kBlack_Weight }, | 1711 { "black", SkFontStyle::kBlack_Weight }, |
1707 { "bold", SkFontStyle::kBold_Weight }, | 1712 { "bold", SkFontStyle::kBold_Weight }, |
1708 { "book", (SkFontStyle::kNormal_Weight + SkFontStyle::kLight_Weight)
/2 }, | 1713 { "book", (SkFontStyle::kNormal_Weight + SkFontStyle::kLight_Weight)
/2 }, |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1819 SkDEBUGF(("Requested font axis not found: %s '%c%c%c%c'\n", | 1824 SkDEBUGF(("Requested font axis not found: %s '%c%c%c%c'\n", |
1820 name.c_str(), | 1825 name.c_str(), |
1821 (skTag >> 24) & 0xFF, | 1826 (skTag >> 24) & 0xFF, |
1822 (skTag >> 16) & 0xFF, | 1827 (skTag >> 16) & 0xFF, |
1823 (skTag >> 8) & 0xFF, | 1828 (skTag >> 8) & 0xFF, |
1824 (skTag) & 0xFF)); | 1829 (skTag) & 0xFF)); |
1825 } | 1830 } |
1826 } | 1831 } |
1827 ) | 1832 ) |
1828 } | 1833 } |
OLD | NEW |