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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 int16_t advance = advances[i]; | 599 int16_t advance = advances[i]; |
600 range.fAdvance.append(1, &advance); | 600 range.fAdvance.append(1, &advance); |
601 } | 601 } |
602 } | 602 } |
603 SkAdvancedTypefaceMetrics::FinishRange( | 603 SkAdvancedTypefaceMetrics::FinishRange( |
604 &range, face->num_glyphs - 1, | 604 &range, face->num_glyphs - 1, |
605 SkAdvancedTypefaceMetrics::WidthRange::kRange); | 605 SkAdvancedTypefaceMetrics::WidthRange::kRange); |
606 info->fGlyphWidths.emplace_back(std::move(range)); | 606 info->fGlyphWidths.emplace_back(std::move(range)); |
607 } else { | 607 } else { |
608 info->setGlyphWidths( | 608 info->setGlyphWidths( |
609 face->num_glyphs, glyphIDs, glyphIDsCount, | 609 face->num_glyphs, |
610 SkAdvancedTypefaceMetrics::GetAdvance( | 610 glyphIDs, |
611 [face](int gId, int16_t* data) { | 611 glyphIDsCount, |
612 FT_Fixed advance = 0; | 612 SkAdvancedTypefaceMetrics::GetAdvance([face](int gId, int16_t* d
ata) { |
613 if (FT_Get_Advances(face, gId, 1, | 613 FT_Fixed advance = 0; |
614 FT_LOAD_NO_SCALE, &advance))
{ | 614 if (FT_Get_Advances(face, gId, 1, FT_LOAD_NO_SCALE, &advance
)) { |
615 return false; | 615 return false; |
616 } | 616 } |
617 SkASSERT(data); | 617 SkASSERT(data); |
618 *data = advance; | 618 *data = advance; |
619 return true; | 619 return true; |
620 })); | 620 }) |
| 621 ); |
621 } | 622 } |
622 } | 623 } |
623 | 624 |
624 if (perGlyphInfo & kVAdvance_PerGlyphInfo && | 625 if (perGlyphInfo & kVAdvance_PerGlyphInfo && |
625 FT_HAS_VERTICAL(face)) { | 626 FT_HAS_VERTICAL(face)) { |
626 SkASSERT(false); // Not implemented yet. | 627 SkASSERT(false); // Not implemented yet. |
627 } | 628 } |
628 | 629 |
629 if (perGlyphInfo & kGlyphNames_PerGlyphInfo && | 630 if (perGlyphInfo & kGlyphNames_PerGlyphInfo && |
630 info->fType == SkAdvancedTypefaceMetrics::kType1_Font) { | 631 info->fType == SkAdvancedTypefaceMetrics::kType1_Font) { |
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1817 SkDEBUGF(("Requested font axis not found: %s '%c%c%c%c'\n", | 1818 SkDEBUGF(("Requested font axis not found: %s '%c%c%c%c'\n", |
1818 name.c_str(), | 1819 name.c_str(), |
1819 (skTag >> 24) & 0xFF, | 1820 (skTag >> 24) & 0xFF, |
1820 (skTag >> 16) & 0xFF, | 1821 (skTag >> 16) & 0xFF, |
1821 (skTag >> 8) & 0xFF, | 1822 (skTag >> 8) & 0xFF, |
1822 (skTag) & 0xFF)); | 1823 (skTag) & 0xFF)); |
1823 } | 1824 } |
1824 } | 1825 } |
1825 ) | 1826 ) |
1826 } | 1827 } |
OLD | NEW |