Flutter Engine
The Flutter Engine
SkOTTable_sbix.h
Go to the documentation of this file.
1/*
2 * Copyright 2024 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 SkOTTable_sbix_DEFINED
9#define SkOTTable_sbix_DEFINED
10
12#include "src/base/SkUtils.h"
14
15#pragma pack(push, 1)
16
18
20 static const SK_OT_CHAR TAG0 = 's';
21 static const SK_OT_CHAR TAG1 = 'b';
22 static const SK_OT_CHAR TAG2 = 'i';
23 static const SK_OT_CHAR TAG3 = 'x';
25
27 SK_OT_USHORT flags; // Bit 0: 1. Bit 1: Draw outlines. Bits 2 to 15: reserved (set to 0)
29 //SK_OT_ULONG strikeOffsets[/*numStrikes*/]; // offset from sbix table to Strike
30 SK_OT_ULONG strikeOffset(int strikeIndex) {
31 return sk_unaligned_load<SK_OT_ULONG>(
32 SkTAddOffset<void*>(&numStrikes, sizeof(numStrikes)+sizeof(SK_OT_ULONG)*strikeIndex));
33 }
34
35 struct Strike {
36 SK_OT_USHORT ppem; // pixels for em
37 SK_OT_USHORT ppi; // design pixel density
38 //SK_OT_ULONG glyphDataOffsets[/*numGlyphs+1*/]; // offset from Strike to GlyphData
40 return sk_unaligned_load<SK_OT_ULONG>(
41 SkTAddOffset<void*>(&ppi, sizeof(ppi)+sizeof(SK_OT_ULONG)*glyphId));
42 }
43 };
44
45 struct GlyphData {
46 SK_OT_SHORT originOffsetX; // x offset of bitmap in pixels
47 SK_OT_SHORT originOffsetY; // y offset of bitmap in pixels (y-up)
48 SK_OT_ULONG graphicType; // 'jpg ', 'png ', 'tiff', or 'dupe'
49 //SK_OT_BYTE data[]; // length is to next glyphDataOffsets entry
50 SK_OT_BYTE* data() { return SkTAfter<SK_OT_BYTE>(&graphicType); }
51 const SK_OT_BYTE* data() const { return SkTAfter<const SK_OT_BYTE>(&graphicType); }
52 };
53};
54
55#pragma pack(pop)
56
57#endif
uint8_t SK_OT_BYTE
uint16_t SK_OT_USHORT
uint32_t SK_OT_ULONG
int8_t SK_OT_CHAR
uint16_t SK_OT_SHORT
SK_OT_ULONG glyphDataOffset(int glyphId)
static const SK_OT_CHAR TAG1
static const SK_OT_ULONG TAG
static const SK_OT_CHAR TAG2
SK_OT_ULONG strikeOffset(int strikeIndex)
static const SK_OT_CHAR TAG0
static const SK_OT_CHAR TAG3