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 "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 info->fGlyphWidths->fAdvance.append(1, &advance); | 598 info->fGlyphWidths->fAdvance.append(1, &advance); |
599 finishRange(info->fGlyphWidths.get(), 0, | 599 finishRange(info->fGlyphWidths.get(), 0, |
600 SkAdvancedTypefaceMetrics::WidthRange::kDefault); | 600 SkAdvancedTypefaceMetrics::WidthRange::kDefault); |
601 } else if (!cid) { | 601 } else if (!cid) { |
602 appendRange(&info->fGlyphWidths, 0); | 602 appendRange(&info->fGlyphWidths, 0); |
603 // So as to not blow out the stack, get advances in batches. | 603 // So as to not blow out the stack, get advances in batches. |
604 for (int gID = 0; gID < face->num_glyphs; gID += 128) { | 604 for (int gID = 0; gID < face->num_glyphs; gID += 128) { |
605 FT_Fixed advances[128]; | 605 FT_Fixed advances[128]; |
606 int advanceCount = 128; | 606 int advanceCount = 128; |
607 if (gID + advanceCount > face->num_glyphs) | 607 if (gID + advanceCount > face->num_glyphs) |
608 advanceCount = face->num_glyphs - gID + 1; | 608 advanceCount = face->num_glyphs - gID; |
609 getAdvances(face, gID, advanceCount, FT_LOAD_NO_SCALE, | 609 getAdvances(face, gID, advanceCount, FT_LOAD_NO_SCALE, |
610 advances); | 610 advances); |
611 for (int i = 0; i < advanceCount; i++) { | 611 for (int i = 0; i < advanceCount; i++) { |
612 int16_t advance = advances[i]; | 612 int16_t advance = advances[i]; |
613 info->fGlyphWidths->fAdvance.append(1, &advance); | 613 info->fGlyphWidths->fAdvance.append(1, &advance); |
614 } | 614 } |
615 } | 615 } |
616 finishRange(info->fGlyphWidths.get(), face->num_glyphs - 1, | 616 finishRange(info->fGlyphWidths.get(), face->num_glyphs - 1, |
617 SkAdvancedTypefaceMetrics::WidthRange::kRange); | 617 SkAdvancedTypefaceMetrics::WidthRange::kRange); |
618 } else { | 618 } else { |
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1501 *style = (SkTypeface::Style) tempStyle; | 1501 *style = (SkTypeface::Style) tempStyle; |
1502 } | 1502 } |
1503 if (isFixedPitch) { | 1503 if (isFixedPitch) { |
1504 *isFixedPitch = FT_IS_FIXED_WIDTH(face); | 1504 *isFixedPitch = FT_IS_FIXED_WIDTH(face); |
1505 } | 1505 } |
1506 | 1506 |
1507 FT_Done_Face(face); | 1507 FT_Done_Face(face); |
1508 FT_Done_FreeType(library); | 1508 FT_Done_FreeType(library); |
1509 return true; | 1509 return true; |
1510 } | 1510 } |
OLD | NEW |