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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/sfnt/SkOTTable_OS_2.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkTypeface.cpp
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp
index cda9b5ce5e57f021a8dd8d905e29af86c0cb4d13..0c960d591510a4b7992164208ac985587ec8b482 100644
--- a/src/core/SkTypeface.cpp
+++ b/src/core/SkTypeface.cpp
@@ -291,16 +291,14 @@ SkAdvancedTypefaceMetrics* SkTypeface::getAdvancedTypefaceMetrics(
SkAdvancedTypefaceMetrics* result =
this->onGetAdvancedTypefaceMetrics(info, glyphIDs, glyphIDsCount);
if (result && result->fType == SkAdvancedTypefaceMetrics::kTrueType_Font) {
- struct SkOTTableOS2 os2table;
- if (this->getTableData(SkTEndian_SwapBE32(SkOTTableOS2::TAG), 0,
- sizeof(os2table), &os2table) > 0) {
- if (os2table.version.v2.fsType.field.Bitmap ||
- (os2table.version.v2.fsType.field.Restricted &&
- !(os2table.version.v2.fsType.field.PreviewPrint ||
- os2table.version.v2.fsType.field.Editable))) {
+ SkOTTableOS2::Version::V2::Type::Field fsType;
+ constexpr SkFontTableTag os2Tag = SkTEndian_SwapBE32(SkOTTableOS2::TAG);
+ constexpr size_t fsTypeOffset = offsetof(SkOTTableOS2::Version::V2, fsType);
+ if (this->getTableData(os2Tag, fsTypeOffset, sizeof(fsType), &fsType) == sizeof(fsType)) {
+ if (fsType.Bitmap || (fsType.Restricted && !(fsType.PreviewPrint || fsType.Editable))) {
result->fFlags |= SkAdvancedTypefaceMetrics::kNotEmbeddable_FontFlag;
}
- if (os2table.version.v2.fsType.field.NoSubsetting) {
+ if (fsType.NoSubsetting) {
result->fFlags |= SkAdvancedTypefaceMetrics::kNotSubsettable_FontFlag;
}
}
« 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