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 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1519 glyphs[i] = SkToU16(id); | 1519 glyphs[i] = SkToU16(id); |
1520 if (0 == id && i < first) { | 1520 if (0 == id && i < first) { |
1521 first = i; | 1521 first = i; |
1522 } | 1522 } |
1523 } | 1523 } |
1524 return first; | 1524 return first; |
1525 } | 1525 } |
1526 } | 1526 } |
1527 | 1527 |
1528 int SkTypeface_FreeType::onCountGlyphs() const { | 1528 int SkTypeface_FreeType::onCountGlyphs() const { |
1529 // we cache this value, using -1 as a sentinel for "not computed" | 1529 AutoFTAccess fta(this); |
1530 if (fGlyphCount < 0) { | 1530 FT_Face face = fta.face(); |
1531 AutoFTAccess fta(this); | 1531 return face ? face->num_glyphs : 0; |
1532 FT_Face face = fta.face(); | |
1533 // if the face failed, we still assign a non-negative value | |
1534 fGlyphCount = face ? face->num_glyphs : 0; | |
1535 } | |
1536 return fGlyphCount; | |
1537 } | 1532 } |
1538 | 1533 |
1539 SkTypeface::LocalizedStrings* SkTypeface_FreeType::onCreateFamilyNameIterator()
const { | 1534 SkTypeface::LocalizedStrings* SkTypeface_FreeType::onCreateFamilyNameIterator()
const { |
1540 SkTypeface::LocalizedStrings* nameIter = | 1535 SkTypeface::LocalizedStrings* nameIter = |
1541 SkOTUtils::LocalizedStrings_NameTable::CreateForFamilyNames(*this); | 1536 SkOTUtils::LocalizedStrings_NameTable::CreateForFamilyNames(*this); |
1542 if (nullptr == nameIter) { | 1537 if (nullptr == nameIter) { |
1543 SkString familyName; | 1538 SkString familyName; |
1544 this->getFamilyName(&familyName); | 1539 this->getFamilyName(&familyName); |
1545 SkString language("und"); //undetermined | 1540 SkString language("und"); //undetermined |
1546 nameIter = new SkOTUtils::LocalizedStrings_SingleName(familyName, langua
ge); | 1541 nameIter = new SkOTUtils::LocalizedStrings_SingleName(familyName, langua
ge); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1824 SkDEBUGF(("Requested font axis not found: %s '%c%c%c%c'\n", | 1819 SkDEBUGF(("Requested font axis not found: %s '%c%c%c%c'\n", |
1825 name.c_str(), | 1820 name.c_str(), |
1826 (skTag >> 24) & 0xFF, | 1821 (skTag >> 24) & 0xFF, |
1827 (skTag >> 16) & 0xFF, | 1822 (skTag >> 16) & 0xFF, |
1828 (skTag >> 8) & 0xFF, | 1823 (skTag >> 8) & 0xFF, |
1829 (skTag) & 0xFF)); | 1824 (skTag) & 0xFF)); |
1830 } | 1825 } |
1831 } | 1826 } |
1832 ) | 1827 ) |
1833 } | 1828 } |
OLD | NEW |