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

Unified Diff: src/core/SkTypeface.cpp

Issue 107863002: [PDF] Fix font embedding restrictions. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Comments Created 7 years 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 | « include/pdf/SkPDFDocument.h ('k') | src/pdf/SkPDFDocument.cpp » ('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 09a64324af2ea25cfef458b059dc1b65ce865eb3..20b6c89e4641f6e4c9f7b761d92ec3c55dadf041 100644
--- a/src/core/SkTypeface.cpp
+++ b/src/core/SkTypeface.cpp
@@ -6,8 +6,10 @@
*/
#include "SkAdvancedTypefaceMetrics.h"
+#include "SkEndian.h"
#include "SkFontDescriptor.h"
#include "SkFontHost.h"
+#include "SkOTTable_OS_2.h"
#include "SkStream.h"
#include "SkTypeface.h"
@@ -259,7 +261,26 @@ SkAdvancedTypefaceMetrics* SkTypeface::getAdvancedTypefaceMetrics(
SkAdvancedTypefaceMetrics::PerGlyphInfo info,
const uint32_t* glyphIDs,
uint32_t glyphIDsCount) const {
- return this->onGetAdvancedTypefaceMetrics(info, glyphIDs, glyphIDsCount);
+ SkAdvancedTypefaceMetrics* result =
+ this->onGetAdvancedTypefaceMetrics(info, glyphIDs, glyphIDsCount);
+ if (result && result->fType == SkAdvancedTypefaceMetrics::kTrueType_Font) {
bungeman-skia 2013/12/09 18:32:59 It seems you want to test for 'empty flags' here?
vandebo (ex-Chrome) 2013/12/09 18:42:59 Windows otm interface has a flag for not embeddabl
bungeman-skia 2013/12/09 18:46:30 We're already doing a ton of work, and just gettin
+ struct SkOTTableOS2 os2table;
+ if (this->getTableData(SkEndian_SwapBE32(SkOTTableOS2::TAG), 0,
+ sizeof(os2table), &os2table) > 0) {
+ if (os2table.version.v4.fsType.field.Restricted ||
bungeman-skia 2013/12/09 18:32:59 It looks like all of the fields you're looking for
vandebo (ex-Chrome) 2013/12/09 18:42:59 Sure, v2 is the first version with all the used fl
+ os2table.version.v4.fsType.field.Bitmap) {
+ result->fFlags = SkTBitOr<SkAdvancedTypefaceMetrics::FontFlags>(
+ result->fFlags,
+ SkAdvancedTypefaceMetrics::kNotEmbeddable_FontFlag);
+ }
+ if (os2table.version.v4.fsType.field.NoSubsetting) {
+ result->fFlags = SkTBitOr<SkAdvancedTypefaceMetrics::FontFlags>(
+ result->fFlags,
+ SkAdvancedTypefaceMetrics::kNotSubsettable_FontFlag);
+ }
+ }
+ }
+ return result;
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « include/pdf/SkPDFDocument.h ('k') | src/pdf/SkPDFDocument.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698