From 5ef194c31ae498166bd9c468993514c5267ea077 Mon Sep 17 00:00:00 2001 From: caryclark Date: Mon, 31 Aug 2015 09:22:38 -0700 Subject: Suppress embedding fonts when the skp's fonts match the OS fonts. The million SKPs generated require >5T of storage. A good deal of that are copies of system fonts. Chrome built with #DEFINE SK_WHITELIST_SERIALIZED_TYPEFACES will omit the font data if the font matches a precomputed checksum. The captured SKP prepends sk_ to the names of fonts that have their data omitted. The SKP consumer can either add renamed fonts from the recording machine, or add gDeserializeTypefaceDelegate = WhitelistDeserializeTypeface; which strips the sk_ prefix when deserializing typefaces. whitelist_typefaces --check Computes the checksums of fallback fonts and returns 0 if the checksums match the checked-in file SkWhitelistChecksum.cpp. whitelist_typefaces --generate Writes an updated version of SkWhitelistChecksum.cpp. (Added Mike since this modifies a public header) R=bungeman@google.com,rmistry@google.com,reed@google.com Review URL: https://codereview.chromium.org/1317913005 --- tools/whitelist_typefaces.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tools/whitelist_typefaces.cpp (limited to 'tools/whitelist_typefaces.cpp') diff --git a/tools/whitelist_typefaces.cpp b/tools/whitelist_typefaces.cpp new file mode 100644 index 0000000000..205f54ac95 --- /dev/null +++ b/tools/whitelist_typefaces.cpp @@ -0,0 +1,38 @@ +/* + * Copyright 2013 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "SkForceLinking.h" +#include "SkGraphics.h" + +__SK_FORCE_IMAGE_DECODER_LINKING; + +extern bool CheckChecksums(); +extern bool GenerateChecksums(); + +int tool_main(int argc, char** argv); +int tool_main(int argc, char** argv) { + if (argc == 2) { + SkAutoGraphics ag; // Enable use of SkRTConfig + if (!strcmp(argv[1], "--check")) { + return (int) !CheckChecksums(); + } + if (!strcmp(argv[1], "--generate")) { + if (!GenerateChecksums()) { + return 2; + } + return 0; + } + } + SkDebugf("Usage:\n %s [--check] [--generate]\n\n", argv[0]); + return 3; +} + +#if !defined SK_BUILD_FOR_IOS +int main(int argc, char * const argv[]) { + return tool_main(argc, (char**) argv); +} +#endif -- cgit v1.2.3