| Index: src/pdf/SkPDFDocument.cpp
|
| diff --git a/src/pdf/SkPDFDocument.cpp b/src/pdf/SkPDFDocument.cpp
|
| index 4f044c87717c90c8c77aced56f2d9f79bd94ba29..4a577fcff34ac1632541c72fca7d1734f1a2dcd1 100644
|
| --- a/src/pdf/SkPDFDocument.cpp
|
| +++ b/src/pdf/SkPDFDocument.cpp
|
| @@ -167,6 +167,46 @@
|
| } while (curNodes.count() > 1);
|
| return std::move(curNodes[0]);
|
| }
|
| +
|
| +#if 0
|
| +// TODO(halcanary): expose notEmbeddableCount in SkDocument
|
| +void GetCountOfFontTypes(
|
| + const SkTDArray<SkPDFDevice*>& pageDevices,
|
| + int counts[SkAdvancedTypefaceMetrics::kOther_Font + 1],
|
| + int* notSubsettableCount,
|
| + int* notEmbeddableCount) {
|
| + sk_bzero(counts, sizeof(int) *
|
| + (SkAdvancedTypefaceMetrics::kOther_Font + 1));
|
| + SkTDArray<SkFontID> seenFonts;
|
| + int notSubsettable = 0;
|
| + int notEmbeddable = 0;
|
| +
|
| + for (int pageNumber = 0; pageNumber < pageDevices.count(); pageNumber++) {
|
| + const SkTDArray<SkPDFFont*>& fontResources =
|
| + pageDevices[pageNumber]->getFontResources();
|
| + for (int font = 0; font < fontResources.count(); font++) {
|
| + SkFontID fontID = fontResources[font]->typeface()->uniqueID();
|
| + if (seenFonts.find(fontID) == -1) {
|
| + counts[fontResources[font]->getType()]++;
|
| + seenFonts.push(fontID);
|
| + if (!fontResources[font]->canSubset()) {
|
| + notSubsettable++;
|
| + }
|
| + if (!fontResources[font]->canEmbed()) {
|
| + notEmbeddable++;
|
| + }
|
| + }
|
| + }
|
| + }
|
| + if (notSubsettableCount) {
|
| + *notSubsettableCount = notSubsettable;
|
| +
|
| + }
|
| + if (notEmbeddableCount) {
|
| + *notEmbeddableCount = notEmbeddable;
|
| + }
|
| +}
|
| +#endif
|
|
|
| template <typename T> static T* clone(const T* o) { return o ? new T(*o) : nullptr; }
|
| ////////////////////////////////////////////////////////////////////////////////
|
| @@ -444,7 +484,7 @@
|
| // Build font subsetting info before calling addObjectRecursively().
|
| for (const auto& entry : fGlyphUsage) {
|
| sk_sp<SkPDFObject> subsetFont =
|
| - entry.fFont->getFontSubset(&fCanon, &entry.fGlyphSet);
|
| + entry.fFont->getFontSubset(&entry.fGlyphSet);
|
| if (subsetFont) {
|
| fObjectSerializer.fSubstituteMap.setSubstitute(
|
| entry.fFont, subsetFont.get());
|
|
|