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" 12 class SkData; 13 class SkStream; 14 15 struct SkOTUtils { 16 /** 17 * Calculates the OpenType checksum for data. 18 */ 19 static uint32_t CalcTableChecksum(SK_OT_ULONG *data, size_t length); 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 */ 34 static SkData* RenameFont(SkStream* fontData, const char* fontName, int fontNameLen); 35 }; 36 37 #endif 38