Index: tools/skpinfo.cpp |
diff --git a/tools/skpinfo.cpp b/tools/skpinfo.cpp |
index c7fd8c870885a6a56ac59a7c4f288b51edaaf4ee..4b65cb8a8c692aacc9fa6f2dbb04a9223925dedb 100644 |
--- a/tools/skpinfo.cpp |
+++ b/tools/skpinfo.cpp |
@@ -9,6 +9,7 @@ |
#include "SkPicture.h" |
#include "SkPictureData.h" |
#include "SkStream.h" |
+#include "SkFontDescriptor.h" |
DEFINE_string2(input, i, "", "skp on which to report"); |
DEFINE_bool2(version, v, true, "version"); |
@@ -107,13 +108,26 @@ int tool_main(int argc, char** argv) { |
SkDebugf("SK_PICT_FACTORY_TAG %d\n", chunkSize); |
} |
break; |
- case SK_PICT_TYPEFACE_TAG: |
+ case SK_PICT_TYPEFACE_TAG: { |
if (FLAGS_tags && !FLAGS_quiet) { |
SkDebugf("SK_PICT_TYPEFACE_TAG %d\n", chunkSize); |
- SkDebugf("Exiting early due to format limitations\n"); |
} |
- return kSuccess; // TODO: need to store size in bytes |
+ |
+ const int count = SkToInt(chunkSize); |
+ for (int i = 0; i < count; i++) { |
+ SkFontDescriptor desc; |
+ if (!SkFontDescriptor::Deserialize(&stream, &desc)) { |
+ if (!FLAGS_quiet) { |
+ SkDebugf("File corruption in SkFontDescriptor\n"); |
+ } |
+ return kInvalidTag; |
+ } |
+ } |
+ |
+ // clear this since we've consumed all the typefaces |
+ chunkSize = 0; |
break; |
+ } |
case SK_PICT_PICTURE_TAG: |
if (FLAGS_tags && !FLAGS_quiet) { |
SkDebugf("SK_PICT_PICTURE_TAG %d\n", chunkSize); |