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

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

Issue 2256783002: Simplify embeddability test. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | src/sfnt/SkOTTable_OS_2.h » ('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"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 this->onGetFamilyName(name); 284 this->onGetFamilyName(name);
285 } 285 }
286 286
287 SkAdvancedTypefaceMetrics* SkTypeface::getAdvancedTypefaceMetrics( 287 SkAdvancedTypefaceMetrics* SkTypeface::getAdvancedTypefaceMetrics(
288 PerGlyphInfo info, 288 PerGlyphInfo info,
289 const uint32_t* glyphIDs, 289 const uint32_t* glyphIDs,
290 uint32_t glyphIDsCount) const { 290 uint32_t glyphIDsCount) const {
291 SkAdvancedTypefaceMetrics* result = 291 SkAdvancedTypefaceMetrics* result =
292 this->onGetAdvancedTypefaceMetrics(info, glyphIDs, glyphIDsCount); 292 this->onGetAdvancedTypefaceMetrics(info, glyphIDs, glyphIDsCount);
293 if (result && result->fType == SkAdvancedTypefaceMetrics::kTrueType_Font) { 293 if (result && result->fType == SkAdvancedTypefaceMetrics::kTrueType_Font) {
294 struct SkOTTableOS2 os2table; 294 SkOTTableOS2::Version::V2::Type::Field fsType;
295 if (this->getTableData(SkTEndian_SwapBE32(SkOTTableOS2::TAG), 0, 295 constexpr SkFontTableTag os2Tag = SkTEndian_SwapBE32(SkOTTableOS2::TAG);
296 sizeof(os2table), &os2table) > 0) { 296 constexpr size_t fsTypeOffset = offsetof(SkOTTableOS2::Version::V2, fsTy pe);
297 if (os2table.version.v2.fsType.field.Bitmap || 297 if (this->getTableData(os2Tag, fsTypeOffset, sizeof(fsType), &fsType) == sizeof(fsType)) {
298 (os2table.version.v2.fsType.field.Restricted && 298 if (fsType.Bitmap || (fsType.Restricted && !(fsType.PreviewPrint || fsType.Editable))) {
299 !(os2table.version.v2.fsType.field.PreviewPrint ||
300 os2table.version.v2.fsType.field.Editable))) {
301 result->fFlags |= SkAdvancedTypefaceMetrics::kNotEmbeddable_Font Flag; 299 result->fFlags |= SkAdvancedTypefaceMetrics::kNotEmbeddable_Font Flag;
302 } 300 }
303 if (os2table.version.v2.fsType.field.NoSubsetting) { 301 if (fsType.NoSubsetting) {
304 result->fFlags |= SkAdvancedTypefaceMetrics::kNotSubsettable_Fon tFlag; 302 result->fFlags |= SkAdvancedTypefaceMetrics::kNotSubsettable_Fon tFlag;
305 } 303 }
306 } 304 }
307 } 305 }
308 return result; 306 return result;
309 } 307 }
310 308
311 bool SkTypeface::onGetKerningPairAdjustments(const uint16_t glyphs[], int count, 309 bool SkTypeface::onGetKerningPairAdjustments(const uint16_t glyphs[], int count,
312 int32_t adjustments[]) const { 310 int32_t adjustments[]) const {
313 return false; 311 return false;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 SkAutoTDelete<SkScalerContext> ctx(this->createScalerContext(noeffects, desc , true)); 348 SkAutoTDelete<SkScalerContext> ctx(this->createScalerContext(noeffects, desc , true));
351 if (ctx.get()) { 349 if (ctx.get()) {
352 SkPaint::FontMetrics fm; 350 SkPaint::FontMetrics fm;
353 ctx->getFontMetrics(&fm); 351 ctx->getFontMetrics(&fm);
354 bounds->set(fm.fXMin * invTextSize, fm.fTop * invTextSize, 352 bounds->set(fm.fXMin * invTextSize, fm.fTop * invTextSize,
355 fm.fXMax * invTextSize, fm.fBottom * invTextSize); 353 fm.fXMax * invTextSize, fm.fBottom * invTextSize);
356 return true; 354 return true;
357 } 355 }
358 return false; 356 return false;
359 } 357 }
OLDNEW
« no previous file with comments | « no previous file | src/sfnt/SkOTTable_OS_2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698