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

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

Issue 1955053002: SkAdvancedTypefaceMetrics: getAdvanceData uses std::function (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-05-06 (Friday) 12:08:37 EDT Created 4 years, 7 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
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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 } 607 }
608 FT_Get_Advances(face, gID, advanceCount, FT_LOAD_NO_SCALE, advan ces); 608 FT_Get_Advances(face, gID, advanceCount, FT_LOAD_NO_SCALE, advan ces);
609 for (int i = 0; i < advanceCount; i++) { 609 for (int i = 0; i < advanceCount; i++) {
610 int16_t advance = advances[i]; 610 int16_t advance = advances[i];
611 info->fGlyphWidths->fAdvance.append(1, &advance); 611 info->fGlyphWidths->fAdvance.append(1, &advance);
612 } 612 }
613 } 613 }
614 finishRange(info->fGlyphWidths.get(), face->num_glyphs - 1, 614 finishRange(info->fGlyphWidths.get(), face->num_glyphs - 1,
615 SkAdvancedTypefaceMetrics::WidthRange::kRange); 615 SkAdvancedTypefaceMetrics::WidthRange::kRange);
616 } else { 616 } else {
617 std::function<bool(int gId, int16_t* data)> getWidthAdvanceFn =
618 [face](int gId, int16_t* data) {
bungeman-skia 2016/05/09 00:14:08 I kinda understand why, but this indentation is ju
hal.canary 2016/05/09 12:15:08 Done.
619 return getWidthAdvance(face, gId, data);
620 };
617 info->fGlyphWidths.reset( 621 info->fGlyphWidths.reset(
618 getAdvanceData(face, 622 getAdvanceData(face->num_glyphs,
619 face->num_glyphs,
620 glyphIDs, 623 glyphIDs,
621 glyphIDsCount, 624 glyphIDsCount,
622 &getWidthAdvance)); 625 getWidthAdvanceFn));
623 } 626 }
624 } 627 }
625 628
626 if (perGlyphInfo & kVAdvance_PerGlyphInfo && 629 if (perGlyphInfo & kVAdvance_PerGlyphInfo &&
627 FT_HAS_VERTICAL(face)) { 630 FT_HAS_VERTICAL(face)) {
628 SkASSERT(false); // Not implemented yet. 631 SkASSERT(false); // Not implemented yet.
629 } 632 }
630 633
631 if (perGlyphInfo & kGlyphNames_PerGlyphInfo && 634 if (perGlyphInfo & kGlyphNames_PerGlyphInfo &&
632 info->fType == SkAdvancedTypefaceMetrics::kType1_Font) { 635 info->fType == SkAdvancedTypefaceMetrics::kType1_Font) {
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1819 SkDEBUGF(("Requested font axis not found: %s '%c%c%c%c'\n", 1822 SkDEBUGF(("Requested font axis not found: %s '%c%c%c%c'\n",
1820 name.c_str(), 1823 name.c_str(),
1821 (skTag >> 24) & 0xFF, 1824 (skTag >> 24) & 0xFF,
1822 (skTag >> 16) & 0xFF, 1825 (skTag >> 16) & 0xFF,
1823 (skTag >> 8) & 0xFF, 1826 (skTag >> 8) & 0xFF,
1824 (skTag) & 0xFF)); 1827 (skTag) & 0xFF));
1825 } 1828 }
1826 } 1829 }
1827 ) 1830 )
1828 } 1831 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698