| OLD | NEW |
| 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 "SkLazyPtr.h" | 12 #include "SkLazyPtr.h" |
| 13 #include "SkOTTable_OS_2.h" | 13 #include "SkOTTable_OS_2.h" |
| 14 #include "SkStream.h" | 14 #include "SkStream.h" |
| 15 #include "SkTypeface.h" | 15 #include "SkTypeface.h" |
| 16 | 16 |
| 17 SkTypeface::SkTypeface(const SkFontStyle& style, SkFontID fontID, bool isFixedPi
tch) | 17 //#define TRACE_LIFECYCLE |
| 18 : fUniqueID(fontID), fStyle(style), fIsFixedPitch(isFixedPitch) { } | |
| 19 | 18 |
| 20 SkTypeface::~SkTypeface() { } | 19 #ifdef TRACE_LIFECYCLE |
| 20 static int32_t gTypefaceCounter; |
| 21 #endif |
| 22 |
| 23 SkTypeface::SkTypeface(Style style, SkFontID fontID, bool isFixedPitch) |
| 24 : fUniqueID(fontID), fStyle(style), fIsFixedPitch(isFixedPitch) { |
| 25 #ifdef TRACE_LIFECYCLE |
| 26 SkDebugf("SkTypeface: create %p fontID %d total %d\n", |
| 27 this, fontID, ++gTypefaceCounter); |
| 28 #endif |
| 29 } |
| 30 |
| 31 SkTypeface::~SkTypeface() { |
| 32 #ifdef TRACE_LIFECYCLE |
| 33 SkDebugf("SkTypeface: destroy %p fontID %d total %d\n", |
| 34 this, fUniqueID, --gTypefaceCounter); |
| 35 #endif |
| 36 } |
| 21 | 37 |
| 22 /////////////////////////////////////////////////////////////////////////////// | 38 /////////////////////////////////////////////////////////////////////////////// |
| 23 | 39 |
| 24 class SkEmptyTypeface : public SkTypeface { | 40 class SkEmptyTypeface : public SkTypeface { |
| 25 public: | 41 public: |
| 26 static SkEmptyTypeface* Create() { | 42 static SkEmptyTypeface* Create() { |
| 27 return SkNEW(SkEmptyTypeface); | 43 return SkNEW(SkEmptyTypeface); |
| 28 } | 44 } |
| 29 protected: | 45 protected: |
| 30 SkEmptyTypeface() : SkTypeface(SkFontStyle(), 0, true) { } | 46 SkEmptyTypeface() : SkTypeface(SkTypeface::kNormal, 0, true) { } |
| 31 | 47 |
| 32 virtual SkStream* onOpenStream(int* ttcIndex) const SK_OVERRIDE { return NUL
L; } | 48 virtual SkStream* onOpenStream(int* ttcIndex) const SK_OVERRIDE { return NUL
L; } |
| 33 virtual SkScalerContext* onCreateScalerContext(const SkDescriptor*) const SK
_OVERRIDE { | 49 virtual SkScalerContext* onCreateScalerContext(const SkDescriptor*) const SK
_OVERRIDE { |
| 34 return NULL; | 50 return NULL; |
| 35 } | 51 } |
| 36 virtual void onFilterRec(SkScalerContextRec*) const SK_OVERRIDE { } | 52 virtual void onFilterRec(SkScalerContextRec*) const SK_OVERRIDE { } |
| 37 virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( | 53 virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( |
| 38 SkAdvancedTypefaceMetrics::PerGlyphInfo, | 54 SkAdvancedTypefaceMetrics::PerGlyphInfo, |
| 39 const uint32_t*, uint32_t) const SK_OVERRIDE { r
eturn NULL; } | 55 const uint32_t*, uint32_t) const SK_OVERRIDE { r
eturn NULL; } |
| 40 virtual void onGetFontDescriptor(SkFontDescriptor*, bool*) const SK_OVERRIDE
{ } | 56 virtual void onGetFontDescriptor(SkFontDescriptor*, bool*) const SK_OVERRIDE
{ } |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 } | 293 } |
| 278 return result; | 294 return result; |
| 279 } | 295 } |
| 280 | 296 |
| 281 /////////////////////////////////////////////////////////////////////////////// | 297 /////////////////////////////////////////////////////////////////////////////// |
| 282 | 298 |
| 283 bool SkTypeface::onGetKerningPairAdjustments(const uint16_t glyphs[], int count, | 299 bool SkTypeface::onGetKerningPairAdjustments(const uint16_t glyphs[], int count, |
| 284 int32_t adjustments[]) const { | 300 int32_t adjustments[]) const { |
| 285 return false; | 301 return false; |
| 286 } | 302 } |
| OLD | NEW |