Debian Codegraph @

src/core/SkFontStream.h

raw
1 /*
2 * Copyright 2013 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 SkFontStream_DEFINED
9 #define SkFontStream_DEFINED
10
11 #include "include/core/SkSpan.h"
12 #include "include/core/SkTypeface.h"
13
14 #include <cstddef>
15
16 class SkStream;
17
18 class SkFontStream {
19 public:
20 /**
21 * Return the number of shared directories inside a TTC sfnt, or return 1
22 * if the stream is a normal sfnt (ttf). If there is an error or
23 * no directory is found, return 0.
24 *
25 * Note: the stream is rewound initially, but is returned at an arbitrary
26 * read offset.
27 */
28 static int CountTTCEntries(SkStream*);
29
30 /**
31 * @param ttcIndex 0 for normal sfnts, or the index within a TTC sfnt.
32 *
33 * Note: the stream is rewound initially, but is returned at an arbitrary
34 * read offset.
35 */
36 static int GetTableTags(SkStream*, int ttcIndex, SkSpan<SkFontTableTag> tags);
37
38 /**
39 * @param ttcIndex 0 for normal sfnts, or the index within a TTC sfnt.
40 *
41 * Note: the stream is rewound initially, but is returned at an arbitrary
42 * read offset.
43 */
44 static size_t GetTableData(SkStream*, int ttcIndex, SkFontTableTag tag,
45 size_t offset, size_t length, void* data);
46
47 static size_t GetTableSize(SkStream* stream, int ttcIndex, SkFontTableTag tag) {
48 return GetTableData(stream, ttcIndex, tag, 0, ~0U, nullptr);
49 }
50 };
51
52 #endif