Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: src/ports/SkFontHost_FreeType.cpp

Issue 2329953003: SkPDF: SkTypeface_FreeType ToUnicode table improvement. (Closed)
Patch Set: move comment Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 440
441 static void populate_glyph_to_unicode(FT_Face& face, SkTDArray<SkUnichar>* glyph ToUnicode) { 441 static void populate_glyph_to_unicode(FT_Face& face, SkTDArray<SkUnichar>* glyph ToUnicode) {
442 FT_Long numGlyphs = face->num_glyphs; 442 FT_Long numGlyphs = face->num_glyphs;
443 glyphToUnicode->setCount(SkToInt(numGlyphs)); 443 glyphToUnicode->setCount(SkToInt(numGlyphs));
444 sk_bzero(glyphToUnicode->begin(), sizeof((*glyphToUnicode)[0]) * numGlyphs); 444 sk_bzero(glyphToUnicode->begin(), sizeof((*glyphToUnicode)[0]) * numGlyphs);
445 445
446 FT_UInt glyphIndex; 446 FT_UInt glyphIndex;
447 SkUnichar charCode = FT_Get_First_Char(face, &glyphIndex); 447 SkUnichar charCode = FT_Get_First_Char(face, &glyphIndex);
448 while (glyphIndex) { 448 while (glyphIndex) {
449 SkASSERT(glyphIndex < SkToUInt(numGlyphs)); 449 SkASSERT(glyphIndex < SkToUInt(numGlyphs));
450 (*glyphToUnicode)[glyphIndex] = charCode; 450 // Use the first character that maps to this glyphID. https://crbug.com/ 359065
451 if (0 == (*glyphToUnicode)[glyphIndex]) {
452 (*glyphToUnicode)[glyphIndex] = charCode;
453 }
451 charCode = FT_Get_Next_Char(face, charCode, &glyphIndex); 454 charCode = FT_Get_Next_Char(face, charCode, &glyphIndex);
452 } 455 }
453 } 456 }
454 457
455 SkAdvancedTypefaceMetrics* SkTypeface_FreeType::onGetAdvancedTypefaceMetrics( 458 SkAdvancedTypefaceMetrics* SkTypeface_FreeType::onGetAdvancedTypefaceMetrics(
456 PerGlyphInfo perGlyphInfo, 459 PerGlyphInfo perGlyphInfo,
457 const uint32_t* glyphIDs, 460 const uint32_t* glyphIDs,
458 uint32_t glyphIDsCount) const { 461 uint32_t glyphIDsCount) const {
459 AutoFTAccess fta(this); 462 AutoFTAccess fta(this);
460 FT_Face face = fta.face(); 463 FT_Face face = fta.face();
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1766 SkDEBUGF(("Requested font axis not found: %s '%c%c%c%c'\n", 1769 SkDEBUGF(("Requested font axis not found: %s '%c%c%c%c'\n",
1767 name.c_str(), 1770 name.c_str(),
1768 (skTag >> 24) & 0xFF, 1771 (skTag >> 24) & 0xFF,
1769 (skTag >> 16) & 0xFF, 1772 (skTag >> 16) & 0xFF,
1770 (skTag >> 8) & 0xFF, 1773 (skTag >> 8) & 0xFF,
1771 (skTag) & 0xFF)); 1774 (skTag) & 0xFF));
1772 } 1775 }
1773 } 1776 }
1774 ) 1777 )
1775 } 1778 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698