aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ports/SkFontHost_mac.cpp
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2017-05-04 18:20:35 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-04 18:20:45 +0000
commit59ad782b2b05b07aa6eb961aa4d62e934093cbd1 (patch)
treecc6445f595afe8117786aa94f0d9a25e0be31c99 /src/ports/SkFontHost_mac.cpp
parenta4677b5db51fca9f2d1077a4d09dd8f7c80df3d1 (diff)
Revert "SkTypeface::getAdvancedMetrics(): cleanup"
This reverts commit cef018896e5cad8eb46a536b60cdf79ebe2b0191. Reason for revert: broke chromium roll (windows). Original change's description: > SkTypeface::getAdvancedMetrics(): cleanup > > - SkAdvancedTypefaceMetrics is a struct not a class > - SkTypeface::PerGlyphInfo is gone > - s/getAdvancedTypefaceMetrics/getAdvancedMetrics/g > - s/onGetAdvancedTypefaceMetrics/onGetAdvancedMetrics/g > - [on]getAdvancedMetrics now return unique_ptr rather than bare ptr. > - [on]getAdvancedMetrics no longer has parameters. (Only caller always > used same arguments.) > - SkAdvancedTypefaceMetrics uses C++11 in-class member initializers. > - SkAdvancedTypefaceMetrics no longer inherits from SkRefCnt > > Change-Id: I37571ebcc383ba9eb21bc20c60c734e3ca317582 > Reviewed-on: https://skia-review.googlesource.com/15311 > Reviewed-by: Ben Wagner <bungeman@google.com> > Commit-Queue: Hal Canary <halcanary@google.com> > TBR=halcanary@google.com,bungeman@google.com,reed@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I84c7d53df566aaf83427e3368edaa02b7b5a9cb8 Reviewed-on: https://skia-review.googlesource.com/15319 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'src/ports/SkFontHost_mac.cpp')
-rw-r--r--src/ports/SkFontHost_mac.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index 92334cb6bc..a43cf22c98 100644
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -526,7 +526,8 @@ protected:
const SkDescriptor*) const override;
void onFilterRec(SkScalerContextRec*) const override;
void onGetFontDescriptor(SkFontDescriptor*, bool*) const override;
- std::unique_ptr<SkAdvancedTypefaceMetrics> onGetAdvancedMetrics() const override;
+ SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics(
+ PerGlyphInfo, const uint32_t* glyphIDs, uint32_t glyphIDsCount) const override;
int onCharsToGlyphs(const void* chars, Encoding,
uint16_t glyphs[], int glyphCount) const override;
int onCountGlyphs() const override;
@@ -1490,14 +1491,17 @@ static void CFStringToSkString(CFStringRef src, SkString* dst) {
dst->resize(strlen(dst->c_str()));
}
-std::unique_ptr<SkAdvancedTypefaceMetrics> SkTypeface_Mac::onGetAdvancedMetrics() const {
+SkAdvancedTypefaceMetrics* SkTypeface_Mac::onGetAdvancedTypefaceMetrics(
+ PerGlyphInfo perGlyphInfo,
+ const uint32_t* glyphIDs,
+ uint32_t glyphIDsCount) const {
AUTO_CG_LOCK();
UniqueCFRef<CTFontRef> ctFont =
ctfont_create_exact_copy(fFontRef.get(), CTFontGetUnitsPerEm(fFontRef.get()), nullptr);
- std::unique_ptr<SkAdvancedTypefaceMetrics> info(new SkAdvancedTypefaceMetrics);
+ SkAdvancedTypefaceMetrics* info = new SkAdvancedTypefaceMetrics;
{
UniqueCFRef<CFStringRef> fontName(CTFontCopyPostScriptName(ctFont.get()));
@@ -1520,7 +1524,9 @@ std::unique_ptr<SkAdvancedTypefaceMetrics> SkTypeface_Mac::onGetAdvancedMetrics(
CFIndex glyphCount = CTFontGetGlyphCount(ctFont.get());
- populate_glyph_to_unicode(ctFont.get(), glyphCount, &info->fGlyphToUnicode);
+ if (perGlyphInfo & kToUnicode_PerGlyphInfo) {
+ populate_glyph_to_unicode(ctFont.get(), glyphCount, &info->fGlyphToUnicode);
+ }
// If it's not a truetype font, mark it as 'other'. Assume that TrueType
// fonts always have both glyf and loca tables. At the least, this is what