| 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 "SkFontDescriptor.h" | 10 #include "SkFontDescriptor.h" |
| 10 #include "SkFontHost.h" | 11 #include "SkFontHost.h" |
| 12 #include "SkOTTable_OS_2.h" |
| 11 #include "SkStream.h" | 13 #include "SkStream.h" |
| 12 #include "SkTypeface.h" | 14 #include "SkTypeface.h" |
| 13 | 15 |
| 14 //#define TRACE_LIFECYCLE | 16 //#define TRACE_LIFECYCLE |
| 15 | 17 |
| 16 #ifdef TRACE_LIFECYCLE | 18 #ifdef TRACE_LIFECYCLE |
| 17 static int32_t gTypefaceCounter; | 19 static int32_t gTypefaceCounter; |
| 18 #endif | 20 #endif |
| 19 | 21 |
| 20 SkTypeface::SkTypeface(Style style, SkFontID fontID, bool isFixedPitch) | 22 SkTypeface::SkTypeface(Style style, SkFontID fontID, bool isFixedPitch) |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 bool isLocal = false; | 254 bool isLocal = false; |
| 253 SkFontDescriptor desc(this->style()); | 255 SkFontDescriptor desc(this->style()); |
| 254 this->onGetFontDescriptor(&desc, &isLocal); | 256 this->onGetFontDescriptor(&desc, &isLocal); |
| 255 name->set(desc.getFamilyName()); | 257 name->set(desc.getFamilyName()); |
| 256 } | 258 } |
| 257 | 259 |
| 258 SkAdvancedTypefaceMetrics* SkTypeface::getAdvancedTypefaceMetrics( | 260 SkAdvancedTypefaceMetrics* SkTypeface::getAdvancedTypefaceMetrics( |
| 259 SkAdvancedTypefaceMetrics::PerGlyphInfo info, | 261 SkAdvancedTypefaceMetrics::PerGlyphInfo info, |
| 260 const uint32_t* glyphIDs, | 262 const uint32_t* glyphIDs, |
| 261 uint32_t glyphIDsCount) const { | 263 uint32_t glyphIDsCount) const { |
| 262 return this->onGetAdvancedTypefaceMetrics(info, glyphIDs, glyphIDsCount); | 264 SkAdvancedTypefaceMetrics* result = |
| 265 this->onGetAdvancedTypefaceMetrics(info, glyphIDs, glyphIDsCount); |
| 266 if (result && result->fType == SkAdvancedTypefaceMetrics::kTrueType_Font) { |
| 267 struct SkOTTableOS2 os2table; |
| 268 if (this->getTableData(SkEndian_SwapBE32(SkOTTableOS2::TAG), 0, |
| 269 sizeof(os2table), &os2table) > 0) { |
| 270 if (os2table.version.v4.fsType.field.Restricted || |
| 271 os2table.version.v4.fsType.field.Bitmap) { |
| 272 result->fFlags = SkTBitOr<SkAdvancedTypefaceMetrics::FontFlags>( |
| 273 result->fFlags, |
| 274 SkAdvancedTypefaceMetrics::kNotEmbeddable_Flag); |
| 275 } |
| 276 if (os2table.version.v4.fsType.field.NoSubsetting) { |
| 277 result->fFlags = SkTBitOr<SkAdvancedTypefaceMetrics::FontFlags>( |
| 278 result->fFlags, |
| 279 SkAdvancedTypefaceMetrics::kNotSubsettable_Flag); |
| 280 } |
| 281 } |
| 282 } |
| 283 return result; |
| 263 } | 284 } |
| 264 | 285 |
| 265 /////////////////////////////////////////////////////////////////////////////// | 286 /////////////////////////////////////////////////////////////////////////////// |
| 266 | 287 |
| 267 bool SkTypeface::onGetKerningPairAdjustments(const uint16_t glyphs[], int count, | 288 bool SkTypeface::onGetKerningPairAdjustments(const uint16_t glyphs[], int count, |
| 268 int32_t adjustments[]) const { | 289 int32_t adjustments[]) const { |
| 269 return false; | 290 return false; |
| 270 } | 291 } |
| OLD | NEW |