normalize.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* Copyright 2013 Google Inc. All Rights Reserved.
  2. Distributed under MIT license.
  3. See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
  4. */
  5. /* Functions for normalizing fonts. Since the WOFF 2.0 decoder creates font
  6. files in normalized form, the WOFF 2.0 conversion is guaranteed to be
  7. lossless (in a bitwise sense) only for normalized font files. */
  8. #ifndef WOFF2_NORMALIZE_H_
  9. #define WOFF2_NORMALIZE_H_
  10. namespace woff2 {
  11. struct Font;
  12. struct FontCollection;
  13. // Changes the offset fields of the table headers so that the data for the
  14. // tables will be written in order of increasing tag values, without any gaps
  15. // other than the 4-byte padding.
  16. bool NormalizeOffsets(Font* font);
  17. // Changes the checksum fields of the table headers and the checksum field of
  18. // the head table so that it matches the current data.
  19. bool FixChecksums(Font* font);
  20. // Parses each of the glyphs in the font and writes them again to the glyf
  21. // table in normalized form, as defined by the StoreGlyph() function. Changes
  22. // the loca table accordigly.
  23. bool NormalizeGlyphs(Font* font);
  24. // Performs all of the normalization steps above.
  25. bool NormalizeFont(Font* font);
  26. bool NormalizeFontCollection(FontCollection* font_collection);
  27. } // namespace woff2
  28. #endif // WOFF2_NORMALIZE_H_