michael@0: /* michael@0: * Copyright 2013 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #ifndef SkFontStream_DEFINED michael@0: #define SkFontStream_DEFINED michael@0: michael@0: class SkStream; michael@0: michael@0: #include "SkTypeface.h" michael@0: michael@0: class SkFontStream { michael@0: public: michael@0: /** michael@0: * Return the number of shared directories inside a TTC sfnt, or return 1 michael@0: * if the stream is a normal sfnt (ttf). If there is an error or michael@0: * no directory is found, return 0. michael@0: * michael@0: * Note: the stream is rewound initially, but is returned at an arbitrary michael@0: * read offset. michael@0: */ michael@0: static int CountTTCEntries(SkStream*); michael@0: michael@0: /** michael@0: * @param ttcIndex 0 for normal sfnts, or the index within a TTC sfnt. michael@0: * michael@0: * Note: the stream is rewound initially, but is returned at an arbitrary michael@0: * read offset. michael@0: */ michael@0: static int GetTableTags(SkStream*, int ttcIndex, SkFontTableTag tags[]); michael@0: michael@0: /** michael@0: * @param ttcIndex 0 for normal sfnts, or the index within a TTC sfnt. michael@0: * michael@0: * Note: the stream is rewound initially, but is returned at an arbitrary michael@0: * read offset. michael@0: */ michael@0: static size_t GetTableData(SkStream*, int ttcIndex, SkFontTableTag tag, michael@0: size_t offset, size_t length, void* data); michael@0: michael@0: static size_t GetTableSize(SkStream* stream, int ttcIndex, SkFontTableTag tag) { michael@0: return GetTableData(stream, ttcIndex, tag, 0, ~0U, NULL); michael@0: } michael@0: }; michael@0: michael@0: #endif