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

Side by Side Diff: src/core/SkTypeface.cpp

Issue 2147733002: Remove user specified typeface id. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove one last straggler. Created 4 years, 5 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 | « include/core/SkTypeface.h ('k') | src/fonts/SkGScalerContext.cpp » ('j') | 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 2011 The Android Open Source Project 2 * Copyright 2011 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 "SkEndian.h" 9 #include "SkEndian.h"
10 #include "SkFontDescriptor.h" 10 #include "SkFontDescriptor.h"
11 #include "SkFontMgr.h" 11 #include "SkFontMgr.h"
12 #include "SkMutex.h" 12 #include "SkMutex.h"
13 #include "SkOTTable_OS_2.h" 13 #include "SkOTTable_OS_2.h"
14 #include "SkOnce.h" 14 #include "SkOnce.h"
15 #include "SkStream.h" 15 #include "SkStream.h"
16 #include "SkTypeface.h" 16 #include "SkTypeface.h"
17 #include "SkTypefaceCache.h"
17 18
18 SkTypeface::SkTypeface(const SkFontStyle& style, SkFontID fontID, bool isFixedPi tch) 19 SkTypeface::SkTypeface(const SkFontStyle& style, bool isFixedPitch)
19 : fUniqueID(fontID), fStyle(style), fIsFixedPitch(isFixedPitch) { } 20 : fUniqueID(SkTypefaceCache::NewFontID()), fStyle(style), fIsFixedPitch(isFi xedPitch) { }
20 21
21 SkTypeface::~SkTypeface() { } 22 SkTypeface::~SkTypeface() { }
22 23
23 #ifdef SK_WHITELIST_SERIALIZED_TYPEFACES 24 #ifdef SK_WHITELIST_SERIALIZED_TYPEFACES
24 extern void WhitelistSerializeTypeface(const SkTypeface*, SkWStream* ); 25 extern void WhitelistSerializeTypeface(const SkTypeface*, SkWStream* );
25 #define SK_TYPEFACE_DELEGATE WhitelistSerializeTypeface 26 #define SK_TYPEFACE_DELEGATE WhitelistSerializeTypeface
26 #else 27 #else
27 #define SK_TYPEFACE_DELEGATE nullptr 28 #define SK_TYPEFACE_DELEGATE nullptr
28 #endif 29 #endif
29 30
30 sk_sp<SkTypeface> (*gCreateTypefaceDelegate)(const char[], SkFontStyle) = nullpt r; 31 sk_sp<SkTypeface> (*gCreateTypefaceDelegate)(const char[], SkFontStyle) = nullpt r;
31 32
32 void (*gSerializeTypefaceDelegate)(const SkTypeface*, SkWStream* ) = SK_TYPEFACE _DELEGATE; 33 void (*gSerializeTypefaceDelegate)(const SkTypeface*, SkWStream* ) = SK_TYPEFACE _DELEGATE;
33 sk_sp<SkTypeface> (*gDeserializeTypefaceDelegate)(SkStream* ) = nullptr; 34 sk_sp<SkTypeface> (*gDeserializeTypefaceDelegate)(SkStream* ) = nullptr;
34 35
35 /////////////////////////////////////////////////////////////////////////////// 36 ///////////////////////////////////////////////////////////////////////////////
36 37
37 namespace { 38 namespace {
38 39
39 class SkEmptyTypeface : public SkTypeface { 40 class SkEmptyTypeface : public SkTypeface {
40 public: 41 public:
41 static SkEmptyTypeface* Create() { return new SkEmptyTypeface; } 42 static SkEmptyTypeface* Create() { return new SkEmptyTypeface; }
42 protected: 43 protected:
43 SkEmptyTypeface() : SkTypeface(SkFontStyle(), 0, true) { } 44 SkEmptyTypeface() : SkTypeface(SkFontStyle(), true) { }
44 45
45 SkStreamAsset* onOpenStream(int* ttcIndex) const override { return nullptr; } 46 SkStreamAsset* onOpenStream(int* ttcIndex) const override { return nullptr; }
46 SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&, 47 SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&,
47 const SkDescriptor*) const override { 48 const SkDescriptor*) const override {
48 return nullptr; 49 return nullptr;
49 } 50 }
50 void onFilterRec(SkScalerContextRec*) const override { } 51 void onFilterRec(SkScalerContextRec*) const override { }
51 virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( 52 virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics(
52 PerGlyphInfo, 53 PerGlyphInfo,
53 const uint32_t*, uint32_t) const override { retu rn nullptr; } 54 const uint32_t*, uint32_t) const override { retu rn nullptr; }
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 SkAutoTDelete<SkScalerContext> ctx(this->createScalerContext(noeffects, desc , true)); 355 SkAutoTDelete<SkScalerContext> ctx(this->createScalerContext(noeffects, desc , true));
355 if (ctx.get()) { 356 if (ctx.get()) {
356 SkPaint::FontMetrics fm; 357 SkPaint::FontMetrics fm;
357 ctx->getFontMetrics(&fm); 358 ctx->getFontMetrics(&fm);
358 bounds->set(fm.fXMin * invTextSize, fm.fTop * invTextSize, 359 bounds->set(fm.fXMin * invTextSize, fm.fTop * invTextSize,
359 fm.fXMax * invTextSize, fm.fBottom * invTextSize); 360 fm.fXMax * invTextSize, fm.fBottom * invTextSize);
360 return true; 361 return true;
361 } 362 }
362 return false; 363 return false;
363 } 364 }
OLDNEW
« no previous file with comments | « include/core/SkTypeface.h ('k') | src/fonts/SkGScalerContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698