blob: 3c5ada25ebd010dcbde6f4286098ff3dc4f07e04 [file] [log] [blame]
bungeman@google.com8ec99562012-02-07 21:30:21 +00001/*
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.coma544f292012-11-20 18:52:23 +000012class SkData;
bungeman@google.coma5501992012-05-18 19:06:41 +000013class SkStream;
bungeman@google.com8ec99562012-02-07 21:30:21 +000014
15struct SkOTUtils {
bungeman@google.coma5501992012-05-18 19:06:41 +000016 /**
17 * Calculates the OpenType checksum for data.
18 */
bungeman@google.com8ec99562012-02-07 21:30:21 +000019 static uint32_t CalcTableChecksum(SK_OT_ULONG *data, size_t length);
bungeman@google.coma5501992012-05-18 19:06:41 +000020
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.coma544f292012-11-20 18:52:23 +000034 static SkData* RenameFont(SkStream* fontData, const char* fontName, int fontNameLen);
bungeman@google.com8ec99562012-02-07 21:30:21 +000035};
36
37#endif