1 /****************************************************************************
2 *
3 * ftcolor.h
4 *
5 * FreeType's glyph color management (specification).
6 *
7 * Copyright (C) 2018-2019 by
8 * David Turner, Robert Wilhelm, and Werner Lemberg.
9 *
10 * This file is part of the FreeType project, and may only be used,
11 * modified, and distributed under the terms of the FreeType project
12 * license, LICENSE.TXT. By continuing to use, modify, or distribute
13 * this file you indicate that you have read the license and
14 * understand and accept it fully.
15 *
16 */
17
18
19 #ifndef FTCOLOR_H_
20 #define FTCOLOR_H_
21
22 #include <ft2build.h>
23 #include FT_FREETYPE_H
24
25 #ifdef FREETYPE_H
26 #error "freetype.h of FreeType 1 has been loaded!"
27 #error "Please fix the directory search order for header files"
108 * @since:
109 * 2.10
110 */
111 #define FT_PALETTE_FOR_LIGHT_BACKGROUND 0x01
112 #define FT_PALETTE_FOR_DARK_BACKGROUND 0x02
113
114
115 /**************************************************************************
116 *
117 * @struct:
118 * FT_Palette_Data
119 *
120 * @description:
121 * This structure holds the data of the 'CPAL' table.
122 *
123 * @fields:
124 * num_palettes ::
125 * The number of palettes.
126 *
127 * palette_name_ids ::
128 * A read-only array of palette name IDs with `num_palettes` elements,
129 * corresponding to entries like 'dark' or 'light' in the font's 'name'
130 * table.
131 *
132 * An empty name ID in the 'CPAL' table gets represented as value
133 * 0xFFFF.
134 *
135 * `NULL` if the font's 'CPAL' table doesn't contain appropriate data.
136 *
137 * palette_flags ::
138 * A read-only array of palette flags with `num_palettes` elements.
139 * Possible values are an ORed combination of
140 * @FT_PALETTE_FOR_LIGHT_BACKGROUND and
141 * @FT_PALETTE_FOR_DARK_BACKGROUND.
142 *
143 * `NULL` if the font's 'CPAL' table doesn't contain appropriate data.
144 *
145 * num_palette_entries ::
146 * The number of entries in a single palette. All palettes have the
147 * same size.
148 *
149 * palette_entry_name_ids ::
150 * A read-only array of palette entry name IDs with
151 * `num_palette_entries`. In each palette, entries with the same index
152 * have the same function. For example, index~0 might correspond to
153 * string 'outline' in the font's 'name' table to indicate that this
154 * palette entry is used for outlines, index~1 might correspond to
155 * 'fill' to indicate the filling color palette entry, etc.
156 *
157 * An empty entry name ID in the 'CPAL' table gets represented as value
158 * 0xFFFF.
159 *
160 * `NULL` if the font's 'CPAL' table doesn't contain appropriate data.
161 *
162 * @note:
163 * Use function @FT_Get_Sfnt_Name to map name IDs and entry name IDs to
164 * name strings.
165 *
166 * @since:
167 * 2.10
168 */
169 typedef struct FT_Palette_Data_ {
170 FT_UShort num_palettes;
171 const FT_UShort* palette_name_ids;
172 const FT_UShort* palette_flags;
173
174 FT_UShort num_palette_entries;
175 const FT_UShort* palette_entry_name_ids;
176
177 } FT_Palette_Data;
178
179
180 /**************************************************************************
181 *
182 * @function:
183 * FT_Palette_Data_Get
184 *
|
1 /****************************************************************************
2 *
3 * ftcolor.h
4 *
5 * FreeType's glyph color management (specification).
6 *
7 * Copyright (C) 2018-2020 by
8 * David Turner, Robert Wilhelm, and Werner Lemberg.
9 *
10 * This file is part of the FreeType project, and may only be used,
11 * modified, and distributed under the terms of the FreeType project
12 * license, LICENSE.TXT. By continuing to use, modify, or distribute
13 * this file you indicate that you have read the license and
14 * understand and accept it fully.
15 *
16 */
17
18
19 #ifndef FTCOLOR_H_
20 #define FTCOLOR_H_
21
22 #include <ft2build.h>
23 #include FT_FREETYPE_H
24
25 #ifdef FREETYPE_H
26 #error "freetype.h of FreeType 1 has been loaded!"
27 #error "Please fix the directory search order for header files"
108 * @since:
109 * 2.10
110 */
111 #define FT_PALETTE_FOR_LIGHT_BACKGROUND 0x01
112 #define FT_PALETTE_FOR_DARK_BACKGROUND 0x02
113
114
115 /**************************************************************************
116 *
117 * @struct:
118 * FT_Palette_Data
119 *
120 * @description:
121 * This structure holds the data of the 'CPAL' table.
122 *
123 * @fields:
124 * num_palettes ::
125 * The number of palettes.
126 *
127 * palette_name_ids ::
128 * An optional read-only array of palette name IDs with `num_palettes`
129 * elements, corresponding to entries like 'dark' or 'light' in the
130 * font's 'name' table.
131 *
132 * An empty name ID in the 'CPAL' table gets represented as value
133 * 0xFFFF.
134 *
135 * `NULL` if the font's 'CPAL' table doesn't contain appropriate data.
136 *
137 * palette_flags ::
138 * An optional read-only array of palette flags with `num_palettes`
139 * elements. Possible values are an ORed combination of
140 * @FT_PALETTE_FOR_LIGHT_BACKGROUND and
141 * @FT_PALETTE_FOR_DARK_BACKGROUND.
142 *
143 * `NULL` if the font's 'CPAL' table doesn't contain appropriate data.
144 *
145 * num_palette_entries ::
146 * The number of entries in a single palette. All palettes have the
147 * same size.
148 *
149 * palette_entry_name_ids ::
150 * An optional read-only array of palette entry name IDs with
151 * `num_palette_entries`. In each palette, entries with the same index
152 * have the same function. For example, index~0 might correspond to
153 * string 'outline' in the font's 'name' table to indicate that this
154 * palette entry is used for outlines, index~1 might correspond to
155 * 'fill' to indicate the filling color palette entry, etc.
156 *
157 * An empty entry name ID in the 'CPAL' table gets represented as value
158 * 0xFFFF.
159 *
160 * `NULL` if the font's 'CPAL' table doesn't contain appropriate data.
161 *
162 * @note:
163 * Use function @FT_Get_Sfnt_Name to map name IDs and entry name IDs to
164 * name strings.
165 *
166 * Use function @FT_Palette_Select to get the colors associated with a
167 * palette entry.
168 *
169 * @since:
170 * 2.10
171 */
172 typedef struct FT_Palette_Data_ {
173 FT_UShort num_palettes;
174 const FT_UShort* palette_name_ids;
175 const FT_UShort* palette_flags;
176
177 FT_UShort num_palette_entries;
178 const FT_UShort* palette_entry_name_ids;
179
180 } FT_Palette_Data;
181
182
183 /**************************************************************************
184 *
185 * @function:
186 * FT_Palette_Data_Get
187 *
|