bungeman@google.com | 8ec9956 | 2012-02-07 21:30:21 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2012 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef SkOTUtils_DEFINED |
| 9 | #define SkOTUtils_DEFINED |
| 10 | |
| 11 | #include "SkOTTableTypes.h" |
bungeman@google.com | a544f29 | 2012-11-20 18:52:23 +0000 | [diff] [blame] | 12 | class SkData; |
bungeman@google.com | a550199 | 2012-05-18 19:06:41 +0000 | [diff] [blame] | 13 | class SkStream; |
bungeman@google.com | 8ec9956 | 2012-02-07 21:30:21 +0000 | [diff] [blame] | 14 | |
| 15 | struct SkOTUtils { |
bungeman@google.com | a550199 | 2012-05-18 19:06:41 +0000 | [diff] [blame] | 16 | /** |
| 17 | * Calculates the OpenType checksum for data. |
| 18 | */ |
bungeman@google.com | 8ec9956 | 2012-02-07 21:30:21 +0000 | [diff] [blame] | 19 | static uint32_t CalcTableChecksum(SK_OT_ULONG *data, size_t length); |
bungeman@google.com | a550199 | 2012-05-18 19:06:41 +0000 | [diff] [blame] | 20 | |
| 21 | /** |
| 22 | * Renames an sfnt font. On failure (invalid data or not an sfnt font) |
| 23 | * returns NULL. |
| 24 | * |
| 25 | * Essentially, this removes any existing 'name' table and replaces it |
| 26 | * with a new one in which FontFamilyName, FontSubfamilyName, |
| 27 | * UniqueFontIdentifier, FullFontName, and PostscriptName are fontName. |
| 28 | * |
| 29 | * The new 'name' table records will be written with the Windows, |
| 30 | * UnicodeBMPUCS2, and English_UnitedStates settings. |
| 31 | * |
| 32 | * fontName and fontNameLen must be specified in terms of ASCII chars. |
| 33 | */ |
bungeman@google.com | a544f29 | 2012-11-20 18:52:23 +0000 | [diff] [blame] | 34 | static SkData* RenameFont(SkStream* fontData, const char* fontName, int fontNameLen); |
bungeman@google.com | 8ec9956 | 2012-02-07 21:30:21 +0000 | [diff] [blame] | 35 | }; |
| 36 | |
| 37 | #endif |