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 "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 1729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1740 { "regular", SkFontStyle::kNormal_Weight }, | 1740 { "regular", SkFontStyle::kNormal_Weight }, |
1741 { "semibold", SkFontStyle::kSemiBold_Weight }, | 1741 { "semibold", SkFontStyle::kSemiBold_Weight }, |
1742 { "thin", SkFontStyle::kThin_Weight }, | 1742 { "thin", SkFontStyle::kThin_Weight }, |
1743 { "ultra", SkFontStyle::kExtraBold_Weight }, | 1743 { "ultra", SkFontStyle::kExtraBold_Weight }, |
1744 { "ultrablack", 1000 }, | 1744 { "ultrablack", 1000 }, |
1745 { "ultrabold", SkFontStyle::kExtraBold_Weight }, | 1745 { "ultrabold", SkFontStyle::kExtraBold_Weight }, |
1746 { "ultraheavy", 1000 }, | 1746 { "ultraheavy", 1000 }, |
1747 { "ultralight", SkFontStyle::kExtraLight_Weight }, | 1747 { "ultralight", SkFontStyle::kExtraLight_Weight }, |
1748 }; | 1748 }; |
1749 int const index = SkStrLCSearch(&commonWeights[0].name, SK_ARRAY_COUNT(c
ommonWeights), | 1749 int const index = SkStrLCSearch(&commonWeights[0].name, SK_ARRAY_COUNT(c
ommonWeights), |
1750 psFontInfo.weight, sizeof(commonWeights)
); | 1750 psFontInfo.weight, sizeof(commonWeights[
0])); |
1751 if (index >= 0) { | 1751 if (index >= 0) { |
1752 weight = commonWeights[index].weight; | 1752 weight = commonWeights[index].weight; |
1753 } else { | 1753 } else { |
1754 SkDEBUGF(("Do not know weight for: %s\n", psFontInfo.weight)); | 1754 SkDEBUGF(("Do not know weight for: %s\n", psFontInfo.weight)); |
1755 } | 1755 } |
1756 } | 1756 } |
1757 | 1757 |
1758 if (name) { | 1758 if (name) { |
1759 name->set(face->family_name); | 1759 name->set(face->family_name); |
1760 } | 1760 } |
1761 if (style) { | 1761 if (style) { |
1762 *style = SkFontStyle(weight, width, slant); | 1762 *style = SkFontStyle(weight, width, slant); |
1763 } | 1763 } |
1764 if (isFixedPitch) { | 1764 if (isFixedPitch) { |
1765 *isFixedPitch = FT_IS_FIXED_WIDTH(face); | 1765 *isFixedPitch = FT_IS_FIXED_WIDTH(face); |
1766 } | 1766 } |
1767 | 1767 |
1768 FT_Done_Face(face); | 1768 FT_Done_Face(face); |
1769 FT_Done_FreeType(library); | 1769 FT_Done_FreeType(library); |
1770 return true; | 1770 return true; |
1771 } | 1771 } |
OLD | NEW |