Retain hints when subsetting for PDF.

There exist 'tricky' fonts which use bytecode hints to move all parts of
a glyph for legibility, not just to slightly tweak the outlines. Until
it is possible to detect these 'tricky' fonts, retain all font's
bytecode hints.

Bug: chromium:1010396
Change-Id: I4eaca967da1a853c8061a4997ce8b872a53fd2f1
Reviewed-by: Hal Canary <>
Commit-Queue: Ben Wagner <>
diff --git a/src/pdf/SkPDFSubsetFont.cpp b/src/pdf/SkPDFSubsetFont.cpp
index 934a1c7..df2999e 100644
--- a/src/pdf/SkPDFSubsetFont.cpp
+++ b/src/pdf/SkPDFSubsetFont.cpp
@@ -72,7 +72,9 @@
     glyphUsage.getSetValues([&glyphs](unsigned gid) { hb_set_add(glyphs, gid);});
     hb_subset_input_set_retain_gids(input.get(), true);
-    hb_subset_input_set_drop_hints(input.get(), true);
+    // TODO: When possible, check if a font is 'tricky' with FT_IS_TRICKY.
+    // If it isn't known if a font is 'tricky', retain the hints.
+    hb_subset_input_set_drop_hints(input.get(), false);
     HBFace subset(hb_subset(face.get(), input.get()));
     HBBlob result(hb_face_reference_blob(subset.get()));
     return to_data(std::move(result));