Werner Lemberg pushed to branch master at FreeType / FreeType
Commits:
-
284eec1e
by Dominik Röttsches at 2021-06-22T20:33:33+02:00
3 changed files:
Changes:
1 |
+2021-07-22 Dominik Röttsches <drott@chromium.org>
|
|
2 |
+ |
|
3 |
+ Move 'COLR' API to `ftcolor.h`.
|
|
4 |
+ |
|
5 |
+ * include/freetype/freetype.h: Cut section layer managament
|
|
6 |
+ containing 'COLR' v0 and v1 API and move it to `ftcolor.h` as
|
|
7 |
+ requested by Werner on freetype-devel.
|
|
8 |
+ * include/freetype/ftcolor.h: Paste that section.
|
|
9 |
+ |
|
1 | 10 |
2021-06-19 Werner Lemberg <david@freetype.org>
|
2 | 11 |
|
3 | 12 |
[truetype] Fix integer overflow.
|
... | ... | @@ -4122,1244 +4122,6 @@ FT_BEGIN_HEADER |
4122 | 4122 |
FT_Matrix *p_transform );
|
4123 | 4123 |
|
4124 | 4124 |
|
4125 |
- /**************************************************************************
|
|
4126 |
- *
|
|
4127 |
- * @section:
|
|
4128 |
- * layer_management
|
|
4129 |
- *
|
|
4130 |
- * @title:
|
|
4131 |
- * Glyph Layer Management
|
|
4132 |
- *
|
|
4133 |
- * @abstract:
|
|
4134 |
- * Retrieving and manipulating OpenType's 'COLR' table data.
|
|
4135 |
- *
|
|
4136 |
- * @description:
|
|
4137 |
- * The functions described here allow access of colored glyph layer data
|
|
4138 |
- * in OpenType's 'COLR' tables.
|
|
4139 |
- */
|
|
4140 |
- |
|
4141 |
- |
|
4142 |
- /**************************************************************************
|
|
4143 |
- *
|
|
4144 |
- * @struct:
|
|
4145 |
- * FT_LayerIterator
|
|
4146 |
- *
|
|
4147 |
- * @description:
|
|
4148 |
- * This iterator object is needed for @FT_Get_Color_Glyph_Layer.
|
|
4149 |
- *
|
|
4150 |
- * @fields:
|
|
4151 |
- * num_layers ::
|
|
4152 |
- * The number of glyph layers for the requested glyph index. Will be
|
|
4153 |
- * set by @FT_Get_Color_Glyph_Layer.
|
|
4154 |
- *
|
|
4155 |
- * layer ::
|
|
4156 |
- * The current layer. Will be set by @FT_Get_Color_Glyph_Layer.
|
|
4157 |
- *
|
|
4158 |
- * p ::
|
|
4159 |
- * An opaque pointer into 'COLR' table data. The caller must set this
|
|
4160 |
- * to `NULL` before the first call of @FT_Get_Color_Glyph_Layer.
|
|
4161 |
- */
|
|
4162 |
- typedef struct FT_LayerIterator_
|
|
4163 |
- {
|
|
4164 |
- FT_UInt num_layers;
|
|
4165 |
- FT_UInt layer;
|
|
4166 |
- FT_Byte* p;
|
|
4167 |
- |
|
4168 |
- } FT_LayerIterator;
|
|
4169 |
- |
|
4170 |
- |
|
4171 |
- /**************************************************************************
|
|
4172 |
- *
|
|
4173 |
- * @function:
|
|
4174 |
- * FT_Get_Color_Glyph_Layer
|
|
4175 |
- *
|
|
4176 |
- * @description:
|
|
4177 |
- * This is an interface to the 'COLR' table in OpenType fonts to
|
|
4178 |
- * iteratively retrieve the colored glyph layers associated with the
|
|
4179 |
- * current glyph slot.
|
|
4180 |
- *
|
|
4181 |
- * https://docs.microsoft.com/en-us/typography/opentype/spec/colr
|
|
4182 |
- *
|
|
4183 |
- * The glyph layer data for a given glyph index, if present, provides an
|
|
4184 |
- * alternative, multi-color glyph representation: Instead of rendering
|
|
4185 |
- * the outline or bitmap with the given glyph index, glyphs with the
|
|
4186 |
- * indices and colors returned by this function are rendered layer by
|
|
4187 |
- * layer.
|
|
4188 |
- *
|
|
4189 |
- * The returned elements are ordered in the z~direction from bottom to
|
|
4190 |
- * top; the 'n'th element should be rendered with the associated palette
|
|
4191 |
- * color and blended on top of the already rendered layers (elements 0,
|
|
4192 |
- * 1, ..., n-1).
|
|
4193 |
- *
|
|
4194 |
- * @input:
|
|
4195 |
- * face ::
|
|
4196 |
- * A handle to the parent face object.
|
|
4197 |
- *
|
|
4198 |
- * base_glyph ::
|
|
4199 |
- * The glyph index the colored glyph layers are associated with.
|
|
4200 |
- *
|
|
4201 |
- * @inout:
|
|
4202 |
- * iterator ::
|
|
4203 |
- * An @FT_LayerIterator object. For the first call you should set
|
|
4204 |
- * `iterator->p` to `NULL`. For all following calls, simply use the
|
|
4205 |
- * same object again.
|
|
4206 |
- *
|
|
4207 |
- * @output:
|
|
4208 |
- * aglyph_index ::
|
|
4209 |
- * The glyph index of the current layer.
|
|
4210 |
- *
|
|
4211 |
- * acolor_index ::
|
|
4212 |
- * The color index into the font face's color palette of the current
|
|
4213 |
- * layer. The value 0xFFFF is special; it doesn't reference a palette
|
|
4214 |
- * entry but indicates that the text foreground color should be used
|
|
4215 |
- * instead (to be set up by the application outside of FreeType).
|
|
4216 |
- *
|
|
4217 |
- * The color palette can be retrieved with @FT_Palette_Select.
|
|
4218 |
- *
|
|
4219 |
- * @return:
|
|
4220 |
- * Value~1 if everything is OK. If there are no more layers (or if there
|
|
4221 |
- * are no layers at all), value~0 gets returned. In case of an error,
|
|
4222 |
- * value~0 is returned also.
|
|
4223 |
- *
|
|
4224 |
- * @note:
|
|
4225 |
- * This function is necessary if you want to handle glyph layers by
|
|
4226 |
- * yourself. In particular, functions that operate with @FT_GlyphRec
|
|
4227 |
- * objects (like @FT_Get_Glyph or @FT_Glyph_To_Bitmap) don't have access
|
|
4228 |
- * to this information.
|
|
4229 |
- *
|
|
4230 |
- * Note that @FT_Render_Glyph is able to handle colored glyph layers
|
|
4231 |
- * automatically if the @FT_LOAD_COLOR flag is passed to a previous call
|
|
4232 |
- * to @FT_Load_Glyph. [This is an experimental feature.]
|
|
4233 |
- *
|
|
4234 |
- * @example:
|
|
4235 |
- * ```
|
|
4236 |
- * FT_Color* palette;
|
|
4237 |
- * FT_LayerIterator iterator;
|
|
4238 |
- *
|
|
4239 |
- * FT_Bool have_layers;
|
|
4240 |
- * FT_UInt layer_glyph_index;
|
|
4241 |
- * FT_UInt layer_color_index;
|
|
4242 |
- *
|
|
4243 |
- *
|
|
4244 |
- * error = FT_Palette_Select( face, palette_index, &palette );
|
|
4245 |
- * if ( error )
|
|
4246 |
- * palette = NULL;
|
|
4247 |
- *
|
|
4248 |
- * iterator.p = NULL;
|
|
4249 |
- * have_layers = FT_Get_Color_Glyph_Layer( face,
|
|
4250 |
- * glyph_index,
|
|
4251 |
- * &layer_glyph_index,
|
|
4252 |
- * &layer_color_index,
|
|
4253 |
- * &iterator );
|
|
4254 |
- *
|
|
4255 |
- * if ( palette && have_layers )
|
|
4256 |
- * {
|
|
4257 |
- * do
|
|
4258 |
- * {
|
|
4259 |
- * FT_Color layer_color;
|
|
4260 |
- *
|
|
4261 |
- *
|
|
4262 |
- * if ( layer_color_index == 0xFFFF )
|
|
4263 |
- * layer_color = text_foreground_color;
|
|
4264 |
- * else
|
|
4265 |
- * layer_color = palette[layer_color_index];
|
|
4266 |
- *
|
|
4267 |
- * // Load and render glyph `layer_glyph_index', then
|
|
4268 |
- * // blend resulting pixmap (using color `layer_color')
|
|
4269 |
- * // with previously created pixmaps.
|
|
4270 |
- *
|
|
4271 |
- * } while ( FT_Get_Color_Glyph_Layer( face,
|
|
4272 |
- * glyph_index,
|
|
4273 |
- * &layer_glyph_index,
|
|
4274 |
- * &layer_color_index,
|
|
4275 |
- * &iterator ) );
|
|
4276 |
- * }
|
|
4277 |
- * ```
|
|
4278 |
- */
|
|
4279 |
- FT_EXPORT( FT_Bool )
|
|
4280 |
- FT_Get_Color_Glyph_Layer( FT_Face face,
|
|
4281 |
- FT_UInt base_glyph,
|
|
4282 |
- FT_UInt *aglyph_index,
|
|
4283 |
- FT_UInt *acolor_index,
|
|
4284 |
- FT_LayerIterator* iterator );
|
|
4285 |
- |
|
4286 |
- |
|
4287 |
- /**************************************************************************
|
|
4288 |
- *
|
|
4289 |
- * @enum:
|
|
4290 |
- * FT_PaintFormat
|
|
4291 |
- *
|
|
4292 |
- * @description:
|
|
4293 |
- * Enumeration describing the different paint format types of the v1
|
|
4294 |
- * extensions to the 'COLR' table, see
|
|
4295 |
- * 'https://github.com/googlefonts/colr-gradients-spec'.
|
|
4296 |
- *
|
|
4297 |
- * Only non-variable format identifiers are listed in this enumeration;
|
|
4298 |
- * as soon as support for variable 'COLR' v1 fonts is implemented,
|
|
4299 |
- * interpolation is performed dependent on axis coordinates, which are
|
|
4300 |
- * configured on the @FT_Face through @FT_Set_Var_Design_Coordinates.
|
|
4301 |
- * This implies that always static (interpolated) values are returned
|
|
4302 |
- * for both variable and non-variable formats.
|
|
4303 |
- *
|
|
4304 |
- * @since:
|
|
4305 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
4306 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
4307 |
- *
|
|
4308 |
- */
|
|
4309 |
- typedef enum FT_PaintFormat_
|
|
4310 |
- {
|
|
4311 |
- FT_COLR_PAINTFORMAT_COLR_LAYERS = 1,
|
|
4312 |
- FT_COLR_PAINTFORMAT_SOLID = 2,
|
|
4313 |
- FT_COLR_PAINTFORMAT_LINEAR_GRADIENT = 4,
|
|
4314 |
- FT_COLR_PAINTFORMAT_RADIAL_GRADIENT = 6,
|
|
4315 |
- FT_COLR_PAINTFORMAT_SWEEP_GRADIENT = 8,
|
|
4316 |
- FT_COLR_PAINTFORMAT_GLYPH = 10,
|
|
4317 |
- FT_COLR_PAINTFORMAT_COLR_GLYPH = 11,
|
|
4318 |
- FT_COLR_PAINTFORMAT_TRANSFORMED = 12,
|
|
4319 |
- FT_COLR_PAINTFORMAT_TRANSLATE = 14,
|
|
4320 |
- FT_COLR_PAINTFORMAT_ROTATE = 16,
|
|
4321 |
- FT_COLR_PAINTFORMAT_SKEW = 18,
|
|
4322 |
- FT_COLR_PAINTFORMAT_COMPOSITE = 20,
|
|
4323 |
- FT_COLR_PAINT_FORMAT_MAX = 21,
|
|
4324 |
- FT_COLR_PAINTFORMAT_UNSUPPORTED = 255
|
|
4325 |
- |
|
4326 |
- } FT_PaintFormat;
|
|
4327 |
- |
|
4328 |
- |
|
4329 |
- /**************************************************************************
|
|
4330 |
- *
|
|
4331 |
- * @struct:
|
|
4332 |
- * FT_ColorStopIterator
|
|
4333 |
- *
|
|
4334 |
- * @description:
|
|
4335 |
- * This iterator object is needed for @FT_Get_Colorline_Stops. It keeps
|
|
4336 |
- * state while iterating over the stops of an @FT_ColorLine,
|
|
4337 |
- * representing the `ColorLine` struct of the v1 extensions to 'COLR',
|
|
4338 |
- * see 'https://github.com/googlefonts/colr-gradients-spec'.
|
|
4339 |
- *
|
|
4340 |
- * @fields:
|
|
4341 |
- * num_color_stops ::
|
|
4342 |
- * The number of color stops for the requested glyph index. Set by
|
|
4343 |
- * @FT_Get_Colorline_Stops.
|
|
4344 |
- *
|
|
4345 |
- * current_color_stop ::
|
|
4346 |
- * The current color stop. Set by @FT_Get_Colorline_Stops.
|
|
4347 |
- *
|
|
4348 |
- * p ::
|
|
4349 |
- * An opaque pointer into 'COLR' table data. The caller must set this
|
|
4350 |
- * to `NULL` before the first call of @FT_Get_Colorline_Stops.
|
|
4351 |
- *
|
|
4352 |
- * @since:
|
|
4353 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
4354 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
4355 |
- *
|
|
4356 |
- */
|
|
4357 |
- typedef struct FT_ColorStopIterator_
|
|
4358 |
- {
|
|
4359 |
- FT_UInt num_color_stops;
|
|
4360 |
- FT_UInt current_color_stop;
|
|
4361 |
- |
|
4362 |
- FT_Byte* p;
|
|
4363 |
- |
|
4364 |
- } FT_ColorStopIterator;
|
|
4365 |
- |
|
4366 |
- |
|
4367 |
- /**************************************************************************
|
|
4368 |
- *
|
|
4369 |
- * @struct:
|
|
4370 |
- * FT_ColorIndex
|
|
4371 |
- *
|
|
4372 |
- * @description:
|
|
4373 |
- * A structure representing a `ColorIndex` value of the 'COLR' v1
|
|
4374 |
- * extensions, see 'https://github.com/googlefonts/colr-gradients-spec'.
|
|
4375 |
- *
|
|
4376 |
- * @fields:
|
|
4377 |
- * palette_index ::
|
|
4378 |
- * The palette index into a 'CPAL' palette.
|
|
4379 |
- *
|
|
4380 |
- * alpha ::
|
|
4381 |
- * Alpha transparency value multiplied with the value from 'CPAL'.
|
|
4382 |
- *
|
|
4383 |
- * @since:
|
|
4384 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
4385 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
4386 |
- *
|
|
4387 |
- */
|
|
4388 |
- typedef struct FT_ColorIndex_
|
|
4389 |
- {
|
|
4390 |
- FT_UInt16 palette_index;
|
|
4391 |
- FT_F2Dot14 alpha;
|
|
4392 |
- |
|
4393 |
- } FT_ColorIndex;
|
|
4394 |
- |
|
4395 |
- |
|
4396 |
- /**************************************************************************
|
|
4397 |
- *
|
|
4398 |
- * @struct:
|
|
4399 |
- * FT_ColorStop
|
|
4400 |
- *
|
|
4401 |
- * @description:
|
|
4402 |
- * A structure representing a `ColorStop` value of the 'COLR' v1
|
|
4403 |
- * extensions, see 'https://github.com/googlefonts/colr-gradients-spec'.
|
|
4404 |
- *
|
|
4405 |
- * @fields:
|
|
4406 |
- * stop_offset ::
|
|
4407 |
- * The stop offset between 0 and 1 along the gradient.
|
|
4408 |
- *
|
|
4409 |
- * color ::
|
|
4410 |
- * The color information for this stop, see @FT_ColorIndex.
|
|
4411 |
- *
|
|
4412 |
- * @since:
|
|
4413 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
4414 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
4415 |
- *
|
|
4416 |
- */
|
|
4417 |
- typedef struct FT_ColorStop_
|
|
4418 |
- {
|
|
4419 |
- FT_F2Dot14 stop_offset;
|
|
4420 |
- FT_ColorIndex color;
|
|
4421 |
- |
|
4422 |
- } FT_ColorStop;
|
|
4423 |
- |
|
4424 |
- |
|
4425 |
- /**************************************************************************
|
|
4426 |
- *
|
|
4427 |
- * @enum:
|
|
4428 |
- * FT_PaintExtend
|
|
4429 |
- *
|
|
4430 |
- * @description:
|
|
4431 |
- * An enumeration representing the 'Extend' mode of the 'COLR' v1
|
|
4432 |
- * extensions, see 'https://github.com/googlefonts/colr-gradients-spec'.
|
|
4433 |
- * It describes how the gradient fill continues at the other boundaries.
|
|
4434 |
- *
|
|
4435 |
- * @since:
|
|
4436 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
4437 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
4438 |
- *
|
|
4439 |
- */
|
|
4440 |
- typedef enum FT_PaintExtend_
|
|
4441 |
- {
|
|
4442 |
- FT_COLR_PAINT_EXTEND_PAD = 0,
|
|
4443 |
- FT_COLR_PAINT_EXTEND_REPEAT = 1,
|
|
4444 |
- FT_COLR_PAINT_EXTEND_REFLECT = 2
|
|
4445 |
- |
|
4446 |
- } FT_PaintExtend;
|
|
4447 |
- |
|
4448 |
- |
|
4449 |
- /**************************************************************************
|
|
4450 |
- *
|
|
4451 |
- * @struct:
|
|
4452 |
- * FT_ColorLine
|
|
4453 |
- *
|
|
4454 |
- * @description:
|
|
4455 |
- * A structure representing a `ColorLine` value of the 'COLR' v1
|
|
4456 |
- * extensions, see 'https://github.com/googlefonts/colr-gradients-spec'.
|
|
4457 |
- * It describes a list of color stops along the defined gradient.
|
|
4458 |
- *
|
|
4459 |
- * @fields:
|
|
4460 |
- * extend ::
|
|
4461 |
- * The extend mode at the outer boundaries, see @FT_PaintExtend.
|
|
4462 |
- *
|
|
4463 |
- * color_stop_iterator ::
|
|
4464 |
- * The @FT_ColorStopIterator used to enumerate and retrieve the
|
|
4465 |
- * actual @FT_ColorStop's.
|
|
4466 |
- *
|
|
4467 |
- * @since:
|
|
4468 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
4469 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
4470 |
- *
|
|
4471 |
- */
|
|
4472 |
- typedef struct FT_ColorLine_
|
|
4473 |
- {
|
|
4474 |
- FT_PaintExtend extend;
|
|
4475 |
- FT_ColorStopIterator color_stop_iterator;
|
|
4476 |
- |
|
4477 |
- } FT_ColorLine;
|
|
4478 |
- |
|
4479 |
- |
|
4480 |
- /**************************************************************************
|
|
4481 |
- *
|
|
4482 |
- * @struct:
|
|
4483 |
- * FT_Affine23
|
|
4484 |
- *
|
|
4485 |
- * @description:
|
|
4486 |
- * A structure used to store a 2x3 matrix. Coefficients are in
|
|
4487 |
- * 16.16 fixed-point format. The computation performed is
|
|
4488 |
- *
|
|
4489 |
- * ```
|
|
4490 |
- * x' = x*xx + y*xy + dx
|
|
4491 |
- * y' = x*yx + y*yy + dy
|
|
4492 |
- * ```
|
|
4493 |
- *
|
|
4494 |
- * @fields:
|
|
4495 |
- * xx ::
|
|
4496 |
- * Matrix coefficient.
|
|
4497 |
- *
|
|
4498 |
- * xy ::
|
|
4499 |
- * Matrix coefficient.
|
|
4500 |
- *
|
|
4501 |
- * dx ::
|
|
4502 |
- * x translation.
|
|
4503 |
- *
|
|
4504 |
- * yx ::
|
|
4505 |
- * Matrix coefficient.
|
|
4506 |
- *
|
|
4507 |
- * yy ::
|
|
4508 |
- * Matrix coefficient.
|
|
4509 |
- *
|
|
4510 |
- * dy ::
|
|
4511 |
- * y translation.
|
|
4512 |
- *
|
|
4513 |
- * @since:
|
|
4514 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
4515 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
4516 |
- *
|
|
4517 |
- */
|
|
4518 |
- typedef struct FT_Affine_23_
|
|
4519 |
- {
|
|
4520 |
- FT_Fixed xx, xy, dx;
|
|
4521 |
- FT_Fixed yx, yy, dy;
|
|
4522 |
- |
|
4523 |
- } FT_Affine23;
|
|
4524 |
- |
|
4525 |
- |
|
4526 |
- /**************************************************************************
|
|
4527 |
- *
|
|
4528 |
- * @enum:
|
|
4529 |
- * FT_Composite_Mode
|
|
4530 |
- *
|
|
4531 |
- * @description:
|
|
4532 |
- * An enumeration listing the 'COLR' v1 composite modes used in
|
|
4533 |
- * @FT_PaintComposite. For more details on each paint mode, see
|
|
4534 |
- * 'https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators'.
|
|
4535 |
- *
|
|
4536 |
- * @since:
|
|
4537 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
4538 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
4539 |
- *
|
|
4540 |
- */
|
|
4541 |
- typedef enum FT_Composite_Mode_
|
|
4542 |
- {
|
|
4543 |
- FT_COLR_COMPOSITE_CLEAR = 0,
|
|
4544 |
- FT_COLR_COMPOSITE_SRC = 1,
|
|
4545 |
- FT_COLR_COMPOSITE_DEST = 2,
|
|
4546 |
- FT_COLR_COMPOSITE_SRC_OVER = 3,
|
|
4547 |
- FT_COLR_COMPOSITE_DEST_OVER = 4,
|
|
4548 |
- FT_COLR_COMPOSITE_SRC_IN = 5,
|
|
4549 |
- FT_COLR_COMPOSITE_DEST_IN = 6,
|
|
4550 |
- FT_COLR_COMPOSITE_SRC_OUT = 7,
|
|
4551 |
- FT_COLR_COMPOSITE_DEST_OUT = 8,
|
|
4552 |
- FT_COLR_COMPOSITE_SRC_ATOP = 9,
|
|
4553 |
- FT_COLR_COMPOSITE_DEST_ATOP = 10,
|
|
4554 |
- FT_COLR_COMPOSITE_XOR = 11,
|
|
4555 |
- FT_COLR_COMPOSITE_SCREEN = 12,
|
|
4556 |
- FT_COLR_COMPOSITE_OVERLAY = 13,
|
|
4557 |
- FT_COLR_COMPOSITE_DARKEN = 14,
|
|
4558 |
- FT_COLR_COMPOSITE_LIGHTEN = 15,
|
|
4559 |
- FT_COLR_COMPOSITE_COLOR_DODGE = 16,
|
|
4560 |
- FT_COLR_COMPOSITE_COLOR_BURN = 17,
|
|
4561 |
- FT_COLR_COMPOSITE_HARD_LIGHT = 18,
|
|
4562 |
- FT_COLR_COMPOSITE_SOFT_LIGHT = 19,
|
|
4563 |
- FT_COLR_COMPOSITE_DIFFERENCE = 20,
|
|
4564 |
- FT_COLR_COMPOSITE_EXCLUSION = 21,
|
|
4565 |
- FT_COLR_COMPOSITE_MULTIPLY = 22,
|
|
4566 |
- FT_COLR_COMPOSITE_HSL_HUE = 23,
|
|
4567 |
- FT_COLR_COMPOSITE_HSL_SATURATION = 24,
|
|
4568 |
- FT_COLR_COMPOSITE_HSL_COLOR = 25,
|
|
4569 |
- FT_COLR_COMPOSITE_HSL_LUMINOSITY = 26,
|
|
4570 |
- FT_COLR_COMPOSITE_MAX = 27
|
|
4571 |
- |
|
4572 |
- } FT_Composite_Mode;
|
|
4573 |
- |
|
4574 |
- |
|
4575 |
- /**************************************************************************
|
|
4576 |
- *
|
|
4577 |
- * @struct:
|
|
4578 |
- * FT_OpaquePaint
|
|
4579 |
- *
|
|
4580 |
- * @description:
|
|
4581 |
- * A structure representing an offset to a `Paint` value stored in any
|
|
4582 |
- * of the paint tables of a 'COLR' v1 font. Compare Offset<24> there.
|
|
4583 |
- * When 'COLR' v1 paint tables represented by FreeType objects such as
|
|
4584 |
- * @FT_PaintColrLayers, @FT_PaintComposite, or @FT_PaintTransformed
|
|
4585 |
- * reference downstream nested paint tables, we do not immediately
|
|
4586 |
- * retrieve them but encapsulate their location in this type. Use
|
|
4587 |
- * @FT_Get_Paint to retrieve the actual @FT_COLR_Paint object that
|
|
4588 |
- * describes the details of the respective paint table.
|
|
4589 |
- *
|
|
4590 |
- * @fields:
|
|
4591 |
- * p ::
|
|
4592 |
- * An internal offset to a Paint table, needs to be set to NULL before
|
|
4593 |
- * passing this struct as an argument to @FT_Get_Paint.
|
|
4594 |
- *
|
|
4595 |
- * insert_root_transform ::
|
|
4596 |
- * An internal boolean to track whether an initial root transform is
|
|
4597 |
- * to be provided. Do not set this value.
|
|
4598 |
- *
|
|
4599 |
- * @since:
|
|
4600 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
4601 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
4602 |
- *
|
|
4603 |
- */
|
|
4604 |
- typedef struct FT_Opaque_Paint_
|
|
4605 |
- {
|
|
4606 |
- FT_Byte* p;
|
|
4607 |
- FT_Bool insert_root_transform;
|
|
4608 |
- } FT_OpaquePaint;
|
|
4609 |
- |
|
4610 |
- |
|
4611 |
- /**************************************************************************
|
|
4612 |
- *
|
|
4613 |
- * @struct:
|
|
4614 |
- * FT_PaintColrLayers
|
|
4615 |
- *
|
|
4616 |
- * @description:
|
|
4617 |
- * A structure representing a `PaintColrLayers` table of a 'COLR' v1
|
|
4618 |
- * font. This table describes a set of layers that are to be composited
|
|
4619 |
- * with composite mode `FT_COLR_COMPOSITE_SRC_OVER`. The return value
|
|
4620 |
- * of this function is an @FT_LayerIterator initialized so that it can
|
|
4621 |
- * be used with @FT_Get_Paint_Layers to retrieve the @FT_OpaquePaint
|
|
4622 |
- * objects as references to each layer.
|
|
4623 |
- *
|
|
4624 |
- * @fields:
|
|
4625 |
- * layer_iterator ::
|
|
4626 |
- * The layer iterator that describes the layers of this paint.
|
|
4627 |
- *
|
|
4628 |
- * @since:
|
|
4629 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
4630 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
4631 |
- *
|
|
4632 |
- */
|
|
4633 |
- typedef struct FT_PaintColrLayers_
|
|
4634 |
- {
|
|
4635 |
- FT_LayerIterator layer_iterator;
|
|
4636 |
- |
|
4637 |
- } FT_PaintColrLayers;
|
|
4638 |
- |
|
4639 |
- |
|
4640 |
- /**************************************************************************
|
|
4641 |
- *
|
|
4642 |
- * @struct:
|
|
4643 |
- * FT_PaintSolid
|
|
4644 |
- *
|
|
4645 |
- * @description:
|
|
4646 |
- * A structure representing a `PaintSolid` value of the 'COLR' v1
|
|
4647 |
- * extensions, see 'https://github.com/googlefonts/colr-gradients-spec'.
|
|
4648 |
- * Using a `PaintSolid` value means that the glyph layer filled with
|
|
4649 |
- * this paint is solid-colored and does not contain a gradient.
|
|
4650 |
- *
|
|
4651 |
- * @fields:
|
|
4652 |
- * color ::
|
|
4653 |
- * The color information for this solid paint, see @FT_ColorIndex.
|
|
4654 |
- *
|
|
4655 |
- * @since:
|
|
4656 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
4657 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
4658 |
- *
|
|
4659 |
- */
|
|
4660 |
- typedef struct FT_PaintSolid_
|
|
4661 |
- {
|
|
4662 |
- FT_ColorIndex color;
|
|
4663 |
- |
|
4664 |
- } FT_PaintSolid;
|
|
4665 |
- |
|
4666 |
- |
|
4667 |
- /**************************************************************************
|
|
4668 |
- *
|
|
4669 |
- * @struct:
|
|
4670 |
- * FT_PaintLinearGradient
|
|
4671 |
- *
|
|
4672 |
- * @description:
|
|
4673 |
- * A structure representing a `PaintLinearGradient` value of the 'COLR'
|
|
4674 |
- * v1 extensions, see
|
|
4675 |
- * 'https://github.com/googlefonts/colr-gradients-spec'. The glyph
|
|
4676 |
- * layer filled with this paint is drawn filled with a linear gradient.
|
|
4677 |
- *
|
|
4678 |
- * @fields:
|
|
4679 |
- * colorline ::
|
|
4680 |
- * The @FT_ColorLine information for this paint, i.e., the list of
|
|
4681 |
- * color stops along the gradient.
|
|
4682 |
- *
|
|
4683 |
- * p0 ::
|
|
4684 |
- * The starting point of the gradient definition (in font units).
|
|
4685 |
- *
|
|
4686 |
- * p1 ::
|
|
4687 |
- * The end point of the gradient definition (in font units).
|
|
4688 |
- *
|
|
4689 |
- * p2 ::
|
|
4690 |
- * Optional point~p2 to rotate the gradient (in font units).
|
|
4691 |
- * Otherwise equal to~p0.
|
|
4692 |
- *
|
|
4693 |
- * @since:
|
|
4694 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
4695 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
4696 |
- *
|
|
4697 |
- */
|
|
4698 |
- typedef struct FT_PaintLinearGradient_
|
|
4699 |
- {
|
|
4700 |
- FT_ColorLine colorline;
|
|
4701 |
- |
|
4702 |
- /* TODO: Potentially expose those as x0, y0 etc. */
|
|
4703 |
- FT_Vector p0;
|
|
4704 |
- FT_Vector p1;
|
|
4705 |
- FT_Vector p2;
|
|
4706 |
- |
|
4707 |
- } FT_PaintLinearGradient;
|
|
4708 |
- |
|
4709 |
- |
|
4710 |
- /**************************************************************************
|
|
4711 |
- *
|
|
4712 |
- * @struct:
|
|
4713 |
- * FT_PaintRadialGradient
|
|
4714 |
- *
|
|
4715 |
- * @description:
|
|
4716 |
- * A structure representing a `PaintRadialGradient` value of the 'COLR'
|
|
4717 |
- * v1 extensions, see
|
|
4718 |
- * 'https://github.com/googlefonts/colr-gradients-spec'. The glyph
|
|
4719 |
- * layer filled with this paint is drawn filled filled with a radial
|
|
4720 |
- * gradient.
|
|
4721 |
- *
|
|
4722 |
- * @fields:
|
|
4723 |
- * colorline ::
|
|
4724 |
- * The @FT_ColorLine information for this paint, i.e., the list of
|
|
4725 |
- * color stops along the gradient.
|
|
4726 |
- *
|
|
4727 |
- * c0 ::
|
|
4728 |
- * The center of the starting point of the radial gradient (in font
|
|
4729 |
- * units).
|
|
4730 |
- *
|
|
4731 |
- * r0 ::
|
|
4732 |
- * The radius of the starting circle of the radial gradient (in font
|
|
4733 |
- * units).
|
|
4734 |
- *
|
|
4735 |
- * c1 ::
|
|
4736 |
- * The center of the end point of the radial gradient (in font units).
|
|
4737 |
- *
|
|
4738 |
- * r1 ::
|
|
4739 |
- * The radius of the end circle of the radial gradient (in font
|
|
4740 |
- * units).
|
|
4741 |
- *
|
|
4742 |
- * @since:
|
|
4743 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
4744 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
4745 |
- *
|
|
4746 |
- */
|
|
4747 |
- typedef struct FT_PaintRadialGradient_
|
|
4748 |
- {
|
|
4749 |
- FT_ColorLine colorline;
|
|
4750 |
- |
|
4751 |
- FT_Vector c0;
|
|
4752 |
- FT_UShort r0;
|
|
4753 |
- FT_Vector c1;
|
|
4754 |
- FT_UShort r1;
|
|
4755 |
- |
|
4756 |
- } FT_PaintRadialGradient;
|
|
4757 |
- |
|
4758 |
- |
|
4759 |
- /**************************************************************************
|
|
4760 |
- *
|
|
4761 |
- * @struct:
|
|
4762 |
- * FT_PaintSweepGradient
|
|
4763 |
- *
|
|
4764 |
- * @description:
|
|
4765 |
- * A structure representing a `PaintSweepGradient` value of the 'COLR'
|
|
4766 |
- * v1 extensions, see
|
|
4767 |
- * 'https://github.com/googlefonts/colr-gradients-spec'. The glyph
|
|
4768 |
- * layer filled with this paint is drawn filled with a sweep gradient
|
|
4769 |
- * from `start_angle` to `end_angle`.
|
|
4770 |
- *
|
|
4771 |
- * @fields:
|
|
4772 |
- * colorline ::
|
|
4773 |
- * The @FT_ColorLine information for this paint, i.e., the list of
|
|
4774 |
- * color stops along the gradient.
|
|
4775 |
- *
|
|
4776 |
- * center ::
|
|
4777 |
- * The center of the sweep gradient (in font units).
|
|
4778 |
- *
|
|
4779 |
- * start_angle ::
|
|
4780 |
- * The start angle of the sweep gradient, in 16.16 fixed point format
|
|
4781 |
- * specifying degrees. Values are given counter-clockwise, starting
|
|
4782 |
- * from the (positive) y~axis.
|
|
4783 |
- *
|
|
4784 |
- * end_angle ::
|
|
4785 |
- * The end angle of the sweep gradient, in 16.16 fixed point format
|
|
4786 |
- * specifying degrees. Values are given counter-clockwise, starting
|
|
4787 |
- * from the (positive) y~axis.
|
|
4788 |
- *
|
|
4789 |
- * @since:
|
|
4790 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
4791 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
4792 |
- *
|
|
4793 |
- */
|
|
4794 |
- typedef struct FT_PaintSweepGradient_
|
|
4795 |
- {
|
|
4796 |
- FT_ColorLine colorline;
|
|
4797 |
- |
|
4798 |
- FT_Vector center;
|
|
4799 |
- FT_Fixed start_angle;
|
|
4800 |
- FT_Fixed end_angle;
|
|
4801 |
- |
|
4802 |
- } FT_PaintSweepGradient;
|
|
4803 |
- |
|
4804 |
- |
|
4805 |
- /**************************************************************************
|
|
4806 |
- *
|
|
4807 |
- * @struct:
|
|
4808 |
- * FT_PaintGlyph
|
|
4809 |
- *
|
|
4810 |
- * @description:
|
|
4811 |
- * A structure representing a 'COLR' v1 `PaintGlyph` paint table.
|
|
4812 |
- *
|
|
4813 |
- * @fields:
|
|
4814 |
- * paint ::
|
|
4815 |
- * An opaque paint object pointing to a `Paint` table that serves as
|
|
4816 |
- * the fill for the glyph ID.
|
|
4817 |
- *
|
|
4818 |
- * glyphID ::
|
|
4819 |
- * The glyph ID from the 'glyf' table, which serves as the contour
|
|
4820 |
- * information that is filled with paint.
|
|
4821 |
- *
|
|
4822 |
- * @since:
|
|
4823 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
4824 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
4825 |
- *
|
|
4826 |
- */
|
|
4827 |
- typedef struct FT_PaintGlyph_
|
|
4828 |
- {
|
|
4829 |
- FT_OpaquePaint paint;
|
|
4830 |
- FT_UInt glyphID;
|
|
4831 |
- |
|
4832 |
- } FT_PaintGlyph;
|
|
4833 |
- |
|
4834 |
- |
|
4835 |
- /**************************************************************************
|
|
4836 |
- *
|
|
4837 |
- * @struct:
|
|
4838 |
- * FT_PaintColrGlyph
|
|
4839 |
- *
|
|
4840 |
- * @description:
|
|
4841 |
- * A structure representing a 'COLR' v1 `PaintColorGlyph` paint table.
|
|
4842 |
- *
|
|
4843 |
- * @fields:
|
|
4844 |
- * glyphID ::
|
|
4845 |
- * The glyph ID from the `BaseGlyphV1List` table that is drawn for
|
|
4846 |
- * this paint.
|
|
4847 |
- *
|
|
4848 |
- * @since:
|
|
4849 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
4850 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
4851 |
- *
|
|
4852 |
- */
|
|
4853 |
- typedef struct FT_PaintColrGlyph_
|
|
4854 |
- {
|
|
4855 |
- FT_UInt glyphID;
|
|
4856 |
- |
|
4857 |
- } FT_PaintColrGlyph;
|
|
4858 |
- |
|
4859 |
- |
|
4860 |
- /**************************************************************************
|
|
4861 |
- *
|
|
4862 |
- * @struct:
|
|
4863 |
- * FT_PaintTransformed
|
|
4864 |
- *
|
|
4865 |
- * @description:
|
|
4866 |
- * A structure representing a 'COLR' v1 `PaintTransformed` paint table.
|
|
4867 |
- *
|
|
4868 |
- * @fields:
|
|
4869 |
- * paint ::
|
|
4870 |
- * An opaque paint that is subject to being transformed.
|
|
4871 |
- *
|
|
4872 |
- * affine ::
|
|
4873 |
- * A 2x3 transformation matrix in @FT_Affine23 format.
|
|
4874 |
- *
|
|
4875 |
- * @since:
|
|
4876 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
4877 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
4878 |
- *
|
|
4879 |
- */
|
|
4880 |
- typedef struct FT_PaintTransformed_
|
|
4881 |
- {
|
|
4882 |
- FT_OpaquePaint paint;
|
|
4883 |
- FT_Affine23 affine;
|
|
4884 |
- |
|
4885 |
- } FT_PaintTransformed;
|
|
4886 |
- |
|
4887 |
- |
|
4888 |
- /**************************************************************************
|
|
4889 |
- *
|
|
4890 |
- * @struct:
|
|
4891 |
- * FT_PaintTranslate
|
|
4892 |
- *
|
|
4893 |
- * @description:
|
|
4894 |
- * A structure representing a 'COLR' v1 `PaintTranslate` paint table.
|
|
4895 |
- * Used for translating downstream paints by a given x and y~delta.
|
|
4896 |
- *
|
|
4897 |
- * @fields:
|
|
4898 |
- * paint ::
|
|
4899 |
- * An @FT_OpaquePaint object referencing the paint that is to be
|
|
4900 |
- * rotated.
|
|
4901 |
- *
|
|
4902 |
- * dx ::
|
|
4903 |
- * Translation in x~direction (in font units).
|
|
4904 |
- *
|
|
4905 |
- * dy ::
|
|
4906 |
- * Translation in y~direction (in font units).
|
|
4907 |
- *
|
|
4908 |
- * @since:
|
|
4909 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
4910 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
4911 |
- *
|
|
4912 |
- */
|
|
4913 |
- typedef struct FT_PaintTranslate_
|
|
4914 |
- {
|
|
4915 |
- FT_OpaquePaint paint;
|
|
4916 |
- |
|
4917 |
- FT_Fixed dx;
|
|
4918 |
- FT_Fixed dy;
|
|
4919 |
- |
|
4920 |
- } FT_PaintTranslate;
|
|
4921 |
- |
|
4922 |
- |
|
4923 |
- /**************************************************************************
|
|
4924 |
- *
|
|
4925 |
- * @struct:
|
|
4926 |
- * FT_PaintRotate
|
|
4927 |
- *
|
|
4928 |
- * @description:
|
|
4929 |
- * A structure representing a 'COLR' v1 `PaintRotate` paint table. Used
|
|
4930 |
- * for rotating downstream paints with a given center and angle.
|
|
4931 |
- *
|
|
4932 |
- * @fields:
|
|
4933 |
- * paint ::
|
|
4934 |
- * An @FT_OpaquePaint object referencing the paint that is to be
|
|
4935 |
- * rotated.
|
|
4936 |
- *
|
|
4937 |
- * angle ::
|
|
4938 |
- * The rotation angle that is to be applied.
|
|
4939 |
- *
|
|
4940 |
- * center_x ::
|
|
4941 |
- * The x~coordinate of the pivot point of the rotation (in font
|
|
4942 |
- * units).
|
|
4943 |
- *
|
|
4944 |
- * center_y ::
|
|
4945 |
- * The y~coordinate of the pivot point of the rotation (in font
|
|
4946 |
- * units).
|
|
4947 |
- *
|
|
4948 |
- * @since:
|
|
4949 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
4950 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
4951 |
- *
|
|
4952 |
- */
|
|
4953 |
- |
|
4954 |
- typedef struct FT_PaintRotate_
|
|
4955 |
- {
|
|
4956 |
- FT_OpaquePaint paint;
|
|
4957 |
- |
|
4958 |
- FT_Fixed angle;
|
|
4959 |
- |
|
4960 |
- FT_Fixed center_x;
|
|
4961 |
- FT_Fixed center_y;
|
|
4962 |
- |
|
4963 |
- } FT_PaintRotate;
|
|
4964 |
- |
|
4965 |
- |
|
4966 |
- /**************************************************************************
|
|
4967 |
- *
|
|
4968 |
- * @struct:
|
|
4969 |
- * FT_PaintSkew
|
|
4970 |
- *
|
|
4971 |
- * @description:
|
|
4972 |
- * A structure representing a 'COLR' v1 `PaintSkew` paint table. Used
|
|
4973 |
- * for skewing or shearing downstream paints by a given center and
|
|
4974 |
- * angle.
|
|
4975 |
- *
|
|
4976 |
- * @fields:
|
|
4977 |
- * paint ::
|
|
4978 |
- * An @FT_OpaquePaint object referencing the paint that is to be
|
|
4979 |
- * skewed.
|
|
4980 |
- *
|
|
4981 |
- * x_skew_angle ::
|
|
4982 |
- * The skewing angle in x~direction.
|
|
4983 |
- *
|
|
4984 |
- * y_skew_angle ::
|
|
4985 |
- * The skewing angle in y~direction.
|
|
4986 |
- *
|
|
4987 |
- * center_x ::
|
|
4988 |
- * The x~coordinate of the pivot point of the skew (in font units).
|
|
4989 |
- *
|
|
4990 |
- * center_y ::
|
|
4991 |
- * The y~coordinate of the pivot point of the skew (in font units).
|
|
4992 |
- *
|
|
4993 |
- * @since:
|
|
4994 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
4995 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
4996 |
- *
|
|
4997 |
- */
|
|
4998 |
- typedef struct FT_PaintSkew_
|
|
4999 |
- {
|
|
5000 |
- FT_OpaquePaint paint;
|
|
5001 |
- |
|
5002 |
- FT_Fixed x_skew_angle;
|
|
5003 |
- FT_Fixed y_skew_angle;
|
|
5004 |
- |
|
5005 |
- FT_Fixed center_x;
|
|
5006 |
- FT_Fixed center_y;
|
|
5007 |
- |
|
5008 |
- } FT_PaintSkew;
|
|
5009 |
- |
|
5010 |
- |
|
5011 |
- /**************************************************************************
|
|
5012 |
- *
|
|
5013 |
- * @struct:
|
|
5014 |
- * FT_PaintComposite
|
|
5015 |
- *
|
|
5016 |
- * @description:
|
|
5017 |
- * A structure representing a 'COLR'v1 `PaintComposite` paint table.
|
|
5018 |
- * Used for compositing two paints in a 'COLR' v1 directed acycling
|
|
5019 |
- * graph.
|
|
5020 |
- *
|
|
5021 |
- * @fields:
|
|
5022 |
- * source_paint ::
|
|
5023 |
- * An @FT_OpaquePaint object referencing the source that is to be
|
|
5024 |
- * composited.
|
|
5025 |
- *
|
|
5026 |
- * composite_mode ::
|
|
5027 |
- * An @FT_Composite_Mode enum value determining the composition
|
|
5028 |
- * operation.
|
|
5029 |
- *
|
|
5030 |
- * backdrop_paint ::
|
|
5031 |
- * An @FT_OpaquePaint object referencing the backdrop paint that
|
|
5032 |
- * `source_paint` is composited onto.
|
|
5033 |
- *
|
|
5034 |
- * @since:
|
|
5035 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
5036 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
5037 |
- *
|
|
5038 |
- */
|
|
5039 |
- typedef struct FT_PaintComposite_
|
|
5040 |
- {
|
|
5041 |
- FT_OpaquePaint source_paint;
|
|
5042 |
- FT_Composite_Mode composite_mode;
|
|
5043 |
- FT_OpaquePaint backdrop_paint;
|
|
5044 |
- |
|
5045 |
- } FT_PaintComposite;
|
|
5046 |
- |
|
5047 |
- |
|
5048 |
- /**************************************************************************
|
|
5049 |
- *
|
|
5050 |
- * @union:
|
|
5051 |
- * FT_COLR_Paint
|
|
5052 |
- *
|
|
5053 |
- * @description:
|
|
5054 |
- * A union object representing format and details of a paint table of a
|
|
5055 |
- * 'COLR' v1 font, see
|
|
5056 |
- * 'https://github.com/googlefonts/colr-gradients-spec'. Use
|
|
5057 |
- * @FT_Get_Paint to retrieve a @FT_COLR_Paint for an @FT_OpaquePaint
|
|
5058 |
- * object.
|
|
5059 |
- *
|
|
5060 |
- * @fields:
|
|
5061 |
- * format ::
|
|
5062 |
- * The gradient format for this Paint structure.
|
|
5063 |
- *
|
|
5064 |
- * u ::
|
|
5065 |
- * Union of all paint table types:
|
|
5066 |
- *
|
|
5067 |
- * * @FT_PaintColrLayers
|
|
5068 |
- * * @FT_PaintGlyph
|
|
5069 |
- * * @FT_PaintSolid
|
|
5070 |
- * * @FT_PaintLinearGradient
|
|
5071 |
- * * @FT_PaintRadialGradient
|
|
5072 |
- * * @FT_PaintSweepGradient
|
|
5073 |
- * * @FT_PaintTransformed
|
|
5074 |
- * * @FT_PaintTranslate
|
|
5075 |
- * * @FT_PaintRotate
|
|
5076 |
- * * @FT_PaintSkew
|
|
5077 |
- * * @FT_PaintComposite
|
|
5078 |
- * * @FT_PaintColrGlyph
|
|
5079 |
- *
|
|
5080 |
- * @since:
|
|
5081 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
5082 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
5083 |
- *
|
|
5084 |
- */
|
|
5085 |
- typedef struct FT_COLR_Paint_
|
|
5086 |
- {
|
|
5087 |
- FT_PaintFormat format;
|
|
5088 |
- |
|
5089 |
- union
|
|
5090 |
- {
|
|
5091 |
- FT_PaintColrLayers colr_layers;
|
|
5092 |
- FT_PaintGlyph glyph;
|
|
5093 |
- FT_PaintSolid solid;
|
|
5094 |
- FT_PaintLinearGradient linear_gradient;
|
|
5095 |
- FT_PaintRadialGradient radial_gradient;
|
|
5096 |
- FT_PaintSweepGradient sweep_gradient;
|
|
5097 |
- FT_PaintTransformed transformed;
|
|
5098 |
- FT_PaintTranslate translate;
|
|
5099 |
- FT_PaintRotate rotate;
|
|
5100 |
- FT_PaintSkew skew;
|
|
5101 |
- FT_PaintComposite composite;
|
|
5102 |
- FT_PaintColrGlyph colr_glyph;
|
|
5103 |
- |
|
5104 |
- } u;
|
|
5105 |
- |
|
5106 |
- } FT_COLR_Paint;
|
|
5107 |
- |
|
5108 |
- |
|
5109 |
- /**************************************************************************
|
|
5110 |
- *
|
|
5111 |
- * @enum:
|
|
5112 |
- * FT_Color_Root_Transform
|
|
5113 |
- *
|
|
5114 |
- * @description:
|
|
5115 |
- * An enumeration to specify whether @FT_Get_Color_Glyph_Paint is to
|
|
5116 |
- * return a root transform to configure the client's graphics context
|
|
5117 |
- * matrix.
|
|
5118 |
- *
|
|
5119 |
- * @values:
|
|
5120 |
- * FT_COLOR_INCLUDE_ROOT_TRANSFORM ::
|
|
5121 |
- * Do include the root transform as the initial @FT_COLR_Paint object.
|
|
5122 |
- *
|
|
5123 |
- * FT_COLOR_NO_ROOT_TRANSFORM ::
|
|
5124 |
- * Do not output an initial root transform.
|
|
5125 |
- *
|
|
5126 |
- * @since:
|
|
5127 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
5128 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
5129 |
- *
|
|
5130 |
- */
|
|
5131 |
- typedef enum FT_Color_Root_Transform_
|
|
5132 |
- {
|
|
5133 |
- FT_COLOR_INCLUDE_ROOT_TRANSFORM,
|
|
5134 |
- FT_COLOR_NO_ROOT_TRANSFORM,
|
|
5135 |
- |
|
5136 |
- FT_COLOR_ROOT_TRANSFORM_MAX
|
|
5137 |
- |
|
5138 |
- } FT_Color_Root_Transform;
|
|
5139 |
- |
|
5140 |
- |
|
5141 |
- /**************************************************************************
|
|
5142 |
- *
|
|
5143 |
- * @function:
|
|
5144 |
- * FT_Get_Color_Glyph_Paint
|
|
5145 |
- *
|
|
5146 |
- * @description:
|
|
5147 |
- * This is the starting point and interface to color gradient
|
|
5148 |
- * information in a 'COLR' v1 table in OpenType fonts to recursively
|
|
5149 |
- * retrieve the paint tables for the directed acyclic graph of a colored
|
|
5150 |
- * glyph, given a glyph ID.
|
|
5151 |
- *
|
|
5152 |
- * https://github.com/googlefonts/colr-gradients-spec
|
|
5153 |
- *
|
|
5154 |
- * In a 'COLR' v1 font, each color glyph defines a directed acyclic
|
|
5155 |
- * graph of nested paint tables, such as `PaintGlyph`, `PaintSolid`,
|
|
5156 |
- * `PaintLinearGradient`, `PaintRadialGradient`, and so on. Using this
|
|
5157 |
- * function and specifying a glyph ID, one retrieves the root paint
|
|
5158 |
- * table for this glyph ID.
|
|
5159 |
- *
|
|
5160 |
- * This function allows control whether an initial root transform is
|
|
5161 |
- * returned to configure scaling, transform, and translation correctly
|
|
5162 |
- * on the client's graphics context. The initial root transform is
|
|
5163 |
- * computed and returned according to the values configured for @FT_Size
|
|
5164 |
- * and @FT_Set_Transform on the @FT_Face object, see below for details
|
|
5165 |
- * of the `root_transform` parameter. This has implications for a
|
|
5166 |
- * client 'COLR' v1 implementation: When this function returns an
|
|
5167 |
- * initially computed root transform, at the time of executing the
|
|
5168 |
- * @FT_PaintGlyph operation, the contours should be retrieved using
|
|
5169 |
- * @FT_Load_Glyph at unscaled, untransformed size. This is because the
|
|
5170 |
- * root transform applied to the graphics context will take care of
|
|
5171 |
- * correct scaling.
|
|
5172 |
- *
|
|
5173 |
- * Alternatively, to allow hinting of contours, at the time of executing
|
|
5174 |
- * @FT_Load_Glyph, the current graphics context transformation matrix
|
|
5175 |
- * can be decomposed into a scaling matrix and a remainder, and
|
|
5176 |
- * @FT_Load_Glyph can be used to retrieve the contours at scaled size.
|
|
5177 |
- * Care must then be taken to blit or clip to the graphics context with
|
|
5178 |
- * taking this remainder transformation into account.
|
|
5179 |
- *
|
|
5180 |
- * @input:
|
|
5181 |
- * face ::
|
|
5182 |
- * A handle to the parent face object.
|
|
5183 |
- *
|
|
5184 |
- * base_glyph ::
|
|
5185 |
- * The glyph index for which to retrieve the root paint table.
|
|
5186 |
- *
|
|
5187 |
- * root_transform ::
|
|
5188 |
- * Specifies whether an initially computed root is returned by the
|
|
5189 |
- * @FT_PaintTransformed operation to account for the activated size
|
|
5190 |
- * (see @FT_Activate_Size) and the configured transform and translate
|
|
5191 |
- * (see @FT_Set_Transform).
|
|
5192 |
- *
|
|
5193 |
- * This root transform is returned before nodes of the glyph graph of
|
|
5194 |
- * the font are returned. Subsequent @FT_COLR_Paint structures
|
|
5195 |
- * contain unscaled and untransformed values. The inserted root
|
|
5196 |
- * transform enables the client application to apply an initial
|
|
5197 |
- * transform to its graphics context. When executing subsequent
|
|
5198 |
- * FT_COLR_Paint operations, values from @FT_COLR_Paint operations
|
|
5199 |
- * will ultimately be correctly scaled because of the root transform
|
|
5200 |
- * applied to the graphics context. Use
|
|
5201 |
- * @FT_COLOR_INCLUDE_ROOT_TRANSFORM to include the root transform, use
|
|
5202 |
- * @FT_COLOR_NO_ROOT_TRANSFORM to not include it. The latter may be
|
|
5203 |
- * useful when traversing the 'COLR' v1 glyph graph and reaching a
|
|
5204 |
- * @FT_PaintColrGlyph. When recursing into @FT_PaintColrGlyph and
|
|
5205 |
- * painting that inline, no additional root transform is needed as it
|
|
5206 |
- * has already been applied to the graphics context at the beginning
|
|
5207 |
- * of drawing this glyph.
|
|
5208 |
- *
|
|
5209 |
- * @output:
|
|
5210 |
- * paint ::
|
|
5211 |
- * The @FT_OpaquePaint object that references the actual paint table.
|
|
5212 |
- *
|
|
5213 |
- * The respective actual @FT_COLR_Paint object is retrieved via
|
|
5214 |
- * @FT_Get_Paint.
|
|
5215 |
- *
|
|
5216 |
- * @return:
|
|
5217 |
- * Value~1 if everything is OK. If no color glyph is found, or the root
|
|
5218 |
- * paint could not be retrieved, value~0 gets returned. In case of an
|
|
5219 |
- * error, value~0 is returned also.
|
|
5220 |
- *
|
|
5221 |
- * @since:
|
|
5222 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
5223 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
5224 |
- *
|
|
5225 |
- */
|
|
5226 |
- FT_EXPORT( FT_Bool )
|
|
5227 |
- FT_Get_Color_Glyph_Paint( FT_Face face,
|
|
5228 |
- FT_UInt base_glyph,
|
|
5229 |
- FT_Color_Root_Transform root_transform,
|
|
5230 |
- FT_OpaquePaint* paint );
|
|
5231 |
- |
|
5232 |
- |
|
5233 |
- /**************************************************************************
|
|
5234 |
- *
|
|
5235 |
- * @function:
|
|
5236 |
- * FT_Get_Paint_Layers
|
|
5237 |
- *
|
|
5238 |
- * @description:
|
|
5239 |
- * Access the layers of a `PaintColrLayers` table.
|
|
5240 |
- *
|
|
5241 |
- * If the root paint of a color glyph, or a nested paint of a 'COLR'
|
|
5242 |
- * glyph is a `PaintColrLayers` table, this function retrieves the
|
|
5243 |
- * layers of the `PaintColrLayers` table.
|
|
5244 |
- *
|
|
5245 |
- * The @FT_PaintColrLayers object contains an @FT_LayerIterator, which
|
|
5246 |
- * is used here to iterate over the layers. Each layer is returned as
|
|
5247 |
- * an @FT_OpaquePaint object, which then can be used with @FT_Get_Paint
|
|
5248 |
- * to retrieve the actual paint object.
|
|
5249 |
- *
|
|
5250 |
- * @input:
|
|
5251 |
- * face ::
|
|
5252 |
- * A handle to the parent face object.
|
|
5253 |
- *
|
|
5254 |
- * @inout:
|
|
5255 |
- * iterator ::
|
|
5256 |
- * The @FT_LayerIterator from an @FT_PaintColrLayers object, for which
|
|
5257 |
- * the layers are to be retrieved. The internal state of the iterator
|
|
5258 |
- * is incremented after one call to this function for retrieving one
|
|
5259 |
- * layer.
|
|
5260 |
- *
|
|
5261 |
- * @output:
|
|
5262 |
- * paint ::
|
|
5263 |
- * The @FT_OpaquePaint object that references the actual paint table.
|
|
5264 |
- * The respective actual @FT_COLR_Paint object is retrieved via
|
|
5265 |
- * @FT_Get_Paint.
|
|
5266 |
- *
|
|
5267 |
- * @return:
|
|
5268 |
- * Value~1 if everything is OK. Value~0 gets returned when the paint
|
|
5269 |
- * object can not be retrieved or any other error occurs.
|
|
5270 |
- *
|
|
5271 |
- * @since:
|
|
5272 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
5273 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
5274 |
- *
|
|
5275 |
- */
|
|
5276 |
- FT_EXPORT( FT_Bool )
|
|
5277 |
- FT_Get_Paint_Layers( FT_Face face,
|
|
5278 |
- FT_LayerIterator* iterator,
|
|
5279 |
- FT_OpaquePaint* paint );
|
|
5280 |
- |
|
5281 |
- |
|
5282 |
- /**************************************************************************
|
|
5283 |
- *
|
|
5284 |
- * @function:
|
|
5285 |
- * FT_Get_Colorline_Stops
|
|
5286 |
- *
|
|
5287 |
- * @description:
|
|
5288 |
- * This is an interface to color gradient information in a 'COLR' v1
|
|
5289 |
- * table in OpenType fonts to iteratively retrieve the gradient and
|
|
5290 |
- * solid fill information for colored glyph layers for a specified glyph
|
|
5291 |
- * ID.
|
|
5292 |
- *
|
|
5293 |
- * https://github.com/googlefonts/colr-gradients-spec
|
|
5294 |
- *
|
|
5295 |
- * @input:
|
|
5296 |
- * face ::
|
|
5297 |
- * A handle to the parent face object.
|
|
5298 |
- *
|
|
5299 |
- * @inout:
|
|
5300 |
- * iterator ::
|
|
5301 |
- * The retrieved @FT_ColorStopIterator, configured on an @FT_ColorLine,
|
|
5302 |
- * which in turn got retrieved via paint information in
|
|
5303 |
- * @FT_PaintLinearGradient or @FT_PaintRadialGradient.
|
|
5304 |
- *
|
|
5305 |
- * @output:
|
|
5306 |
- * color_stop ::
|
|
5307 |
- * Color index and alpha value for the retrieved color stop.
|
|
5308 |
- *
|
|
5309 |
- * @return:
|
|
5310 |
- * Value~1 if everything is OK. If there are no more color stops,
|
|
5311 |
- * value~0 gets returned. In case of an error, value~0 is returned
|
|
5312 |
- * also.
|
|
5313 |
- *
|
|
5314 |
- * @since:
|
|
5315 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
5316 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
5317 |
- *
|
|
5318 |
- */
|
|
5319 |
- FT_EXPORT( FT_Bool )
|
|
5320 |
- FT_Get_Colorline_Stops( FT_Face face,
|
|
5321 |
- FT_ColorStop* color_stop,
|
|
5322 |
- FT_ColorStopIterator* iterator );
|
|
5323 |
- |
|
5324 |
- |
|
5325 |
- /**************************************************************************
|
|
5326 |
- *
|
|
5327 |
- * @function:
|
|
5328 |
- * FT_Get_Paint
|
|
5329 |
- *
|
|
5330 |
- * @description:
|
|
5331 |
- * Access the details of a paint using an @FT_OpaquePaint opaque paint
|
|
5332 |
- * object, which internally stores the offset to the respective `Paint`
|
|
5333 |
- * object in the 'COLR' table.
|
|
5334 |
- *
|
|
5335 |
- * @input:
|
|
5336 |
- * face ::
|
|
5337 |
- * A handle to the parent face object.
|
|
5338 |
- *
|
|
5339 |
- * opaque_paint ::
|
|
5340 |
- * The opaque paint object for which the underlying @FT_COLR_Paint
|
|
5341 |
- * data is to be retrieved.
|
|
5342 |
- *
|
|
5343 |
- * @output:
|
|
5344 |
- * paint ::
|
|
5345 |
- * The specific @FT_COLR_Paint object containing information coming
|
|
5346 |
- * from one of the font's `Paint*` tables.
|
|
5347 |
- *
|
|
5348 |
- * @return:
|
|
5349 |
- * Value~1 if everything is OK. Value~0 if no details can be found for
|
|
5350 |
- * this paint or any other error occured.
|
|
5351 |
- *
|
|
5352 |
- * @since:
|
|
5353 |
- * 2.11 -- **currently experimental only!** There might be changes
|
|
5354 |
- * without retaining backward-compatibility of both the API and ABI.
|
|
5355 |
- *
|
|
5356 |
- */
|
|
5357 |
- FT_EXPORT( FT_Bool )
|
|
5358 |
- FT_Get_Paint( FT_Face face,
|
|
5359 |
- FT_OpaquePaint opaque_paint,
|
|
5360 |
- FT_COLR_Paint* paint );
|
|
5361 |
- |
|
5362 |
- |
|
5363 | 4125 |
/**************************************************************************
|
5364 | 4126 |
*
|
5365 | 4127 |
* @section:
|
... | ... | @@ -302,6 +302,1244 @@ FT_BEGIN_HEADER |
302 | 302 |
FT_Palette_Set_Foreground_Color( FT_Face face,
|
303 | 303 |
FT_Color foreground_color );
|
304 | 304 |
|
305 |
+ |
|
306 |
+ /**************************************************************************
|
|
307 |
+ *
|
|
308 |
+ * @section:
|
|
309 |
+ * layer_management
|
|
310 |
+ *
|
|
311 |
+ * @title:
|
|
312 |
+ * Glyph Layer Management
|
|
313 |
+ *
|
|
314 |
+ * @abstract:
|
|
315 |
+ * Retrieving and manipulating OpenType's 'COLR' table data.
|
|
316 |
+ *
|
|
317 |
+ * @description:
|
|
318 |
+ * The functions described here allow access of colored glyph layer data
|
|
319 |
+ * in OpenType's 'COLR' tables.
|
|
320 |
+ */
|
|
321 |
+ |
|
322 |
+ |
|
323 |
+ /**************************************************************************
|
|
324 |
+ *
|
|
325 |
+ * @struct:
|
|
326 |
+ * FT_LayerIterator
|
|
327 |
+ *
|
|
328 |
+ * @description:
|
|
329 |
+ * This iterator object is needed for @FT_Get_Color_Glyph_Layer.
|
|
330 |
+ *
|
|
331 |
+ * @fields:
|
|
332 |
+ * num_layers ::
|
|
333 |
+ * The number of glyph layers for the requested glyph index. Will be
|
|
334 |
+ * set by @FT_Get_Color_Glyph_Layer.
|
|
335 |
+ *
|
|
336 |
+ * layer ::
|
|
337 |
+ * The current layer. Will be set by @FT_Get_Color_Glyph_Layer.
|
|
338 |
+ *
|
|
339 |
+ * p ::
|
|
340 |
+ * An opaque pointer into 'COLR' table data. The caller must set this
|
|
341 |
+ * to `NULL` before the first call of @FT_Get_Color_Glyph_Layer.
|
|
342 |
+ */
|
|
343 |
+ typedef struct FT_LayerIterator_
|
|
344 |
+ {
|
|
345 |
+ FT_UInt num_layers;
|
|
346 |
+ FT_UInt layer;
|
|
347 |
+ FT_Byte* p;
|
|
348 |
+ |
|
349 |
+ } FT_LayerIterator;
|
|
350 |
+ |
|
351 |
+ |
|
352 |
+ /**************************************************************************
|
|
353 |
+ *
|
|
354 |
+ * @function:
|
|
355 |
+ * FT_Get_Color_Glyph_Layer
|
|
356 |
+ *
|
|
357 |
+ * @description:
|
|
358 |
+ * This is an interface to the 'COLR' table in OpenType fonts to
|
|
359 |
+ * iteratively retrieve the colored glyph layers associated with the
|
|
360 |
+ * current glyph slot.
|
|
361 |
+ *
|
|
362 |
+ * https://docs.microsoft.com/en-us/typography/opentype/spec/colr
|
|
363 |
+ *
|
|
364 |
+ * The glyph layer data for a given glyph index, if present, provides an
|
|
365 |
+ * alternative, multi-color glyph representation: Instead of rendering
|
|
366 |
+ * the outline or bitmap with the given glyph index, glyphs with the
|
|
367 |
+ * indices and colors returned by this function are rendered layer by
|
|
368 |
+ * layer.
|
|
369 |
+ *
|
|
370 |
+ * The returned elements are ordered in the z~direction from bottom to
|
|
371 |
+ * top; the 'n'th element should be rendered with the associated palette
|
|
372 |
+ * color and blended on top of the already rendered layers (elements 0,
|
|
373 |
+ * 1, ..., n-1).
|
|
374 |
+ *
|
|
375 |
+ * @input:
|
|
376 |
+ * face ::
|
|
377 |
+ * A handle to the parent face object.
|
|
378 |
+ *
|
|
379 |
+ * base_glyph ::
|
|
380 |
+ * The glyph index the colored glyph layers are associated with.
|
|
381 |
+ *
|
|
382 |
+ * @inout:
|
|
383 |
+ * iterator ::
|
|
384 |
+ * An @FT_LayerIterator object. For the first call you should set
|
|
385 |
+ * `iterator->p` to `NULL`. For all following calls, simply use the
|
|
386 |
+ * same object again.
|
|
387 |
+ *
|
|
388 |
+ * @output:
|
|
389 |
+ * aglyph_index ::
|
|
390 |
+ * The glyph index of the current layer.
|
|
391 |
+ *
|
|
392 |
+ * acolor_index ::
|
|
393 |
+ * The color index into the font face's color palette of the current
|
|
394 |
+ * layer. The value 0xFFFF is special; it doesn't reference a palette
|
|
395 |
+ * entry but indicates that the text foreground color should be used
|
|
396 |
+ * instead (to be set up by the application outside of FreeType).
|
|
397 |
+ *
|
|
398 |
+ * The color palette can be retrieved with @FT_Palette_Select.
|
|
399 |
+ *
|
|
400 |
+ * @return:
|
|
401 |
+ * Value~1 if everything is OK. If there are no more layers (or if there
|
|
402 |
+ * are no layers at all), value~0 gets returned. In case of an error,
|
|
403 |
+ * value~0 is returned also.
|
|
404 |
+ *
|
|
405 |
+ * @note:
|
|
406 |
+ * This function is necessary if you want to handle glyph layers by
|
|
407 |
+ * yourself. In particular, functions that operate with @FT_GlyphRec
|
|
408 |
+ * objects (like @FT_Get_Glyph or @FT_Glyph_To_Bitmap) don't have access
|
|
409 |
+ * to this information.
|
|
410 |
+ *
|
|
411 |
+ * Note that @FT_Render_Glyph is able to handle colored glyph layers
|
|
412 |
+ * automatically if the @FT_LOAD_COLOR flag is passed to a previous call
|
|
413 |
+ * to @FT_Load_Glyph. [This is an experimental feature.]
|
|
414 |
+ *
|
|
415 |
+ * @example:
|
|
416 |
+ * ```
|
|
417 |
+ * FT_Color* palette;
|
|
418 |
+ * FT_LayerIterator iterator;
|
|
419 |
+ *
|
|
420 |
+ * FT_Bool have_layers;
|
|
421 |
+ * FT_UInt layer_glyph_index;
|
|
422 |
+ * FT_UInt layer_color_index;
|
|
423 |
+ *
|
|
424 |
+ *
|
|
425 |
+ * error = FT_Palette_Select( face, palette_index, &palette );
|
|
426 |
+ * if ( error )
|
|
427 |
+ * palette = NULL;
|
|
428 |
+ *
|
|
429 |
+ * iterator.p = NULL;
|
|
430 |
+ * have_layers = FT_Get_Color_Glyph_Layer( face,
|
|
431 |
+ * glyph_index,
|
|
432 |
+ * &layer_glyph_index,
|
|
433 |
+ * &layer_color_index,
|
|
434 |
+ * &iterator );
|
|
435 |
+ *
|
|
436 |
+ * if ( palette && have_layers )
|
|
437 |
+ * {
|
|
438 |
+ * do
|
|
439 |
+ * {
|
|
440 |
+ * FT_Color layer_color;
|
|
441 |
+ *
|
|
442 |
+ *
|
|
443 |
+ * if ( layer_color_index == 0xFFFF )
|
|
444 |
+ * layer_color = text_foreground_color;
|
|
445 |
+ * else
|
|
446 |
+ * layer_color = palette[layer_color_index];
|
|
447 |
+ *
|
|
448 |
+ * // Load and render glyph `layer_glyph_index', then
|
|
449 |
+ * // blend resulting pixmap (using color `layer_color')
|
|
450 |
+ * // with previously created pixmaps.
|
|
451 |
+ *
|
|
452 |
+ * } while ( FT_Get_Color_Glyph_Layer( face,
|
|
453 |
+ * glyph_index,
|
|
454 |
+ * &layer_glyph_index,
|
|
455 |
+ * &layer_color_index,
|
|
456 |
+ * &iterator ) );
|
|
457 |
+ * }
|
|
458 |
+ * ```
|
|
459 |
+ */
|
|
460 |
+ FT_EXPORT( FT_Bool )
|
|
461 |
+ FT_Get_Color_Glyph_Layer( FT_Face face,
|
|
462 |
+ FT_UInt base_glyph,
|
|
463 |
+ FT_UInt *aglyph_index,
|
|
464 |
+ FT_UInt *acolor_index,
|
|
465 |
+ FT_LayerIterator* iterator );
|
|
466 |
+ |
|
467 |
+ |
|
468 |
+ /**************************************************************************
|
|
469 |
+ *
|
|
470 |
+ * @enum:
|
|
471 |
+ * FT_PaintFormat
|
|
472 |
+ *
|
|
473 |
+ * @description:
|
|
474 |
+ * Enumeration describing the different paint format types of the v1
|
|
475 |
+ * extensions to the 'COLR' table, see
|
|
476 |
+ * 'https://github.com/googlefonts/colr-gradients-spec'.
|
|
477 |
+ *
|
|
478 |
+ * Only non-variable format identifiers are listed in this enumeration;
|
|
479 |
+ * as soon as support for variable 'COLR' v1 fonts is implemented,
|
|
480 |
+ * interpolation is performed dependent on axis coordinates, which are
|
|
481 |
+ * configured on the @FT_Face through @FT_Set_Var_Design_Coordinates.
|
|
482 |
+ * This implies that always static (interpolated) values are returned
|
|
483 |
+ * for both variable and non-variable formats.
|
|
484 |
+ *
|
|
485 |
+ * @since:
|
|
486 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
487 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
488 |
+ *
|
|
489 |
+ */
|
|
490 |
+ typedef enum FT_PaintFormat_
|
|
491 |
+ {
|
|
492 |
+ FT_COLR_PAINTFORMAT_COLR_LAYERS = 1,
|
|
493 |
+ FT_COLR_PAINTFORMAT_SOLID = 2,
|
|
494 |
+ FT_COLR_PAINTFORMAT_LINEAR_GRADIENT = 4,
|
|
495 |
+ FT_COLR_PAINTFORMAT_RADIAL_GRADIENT = 6,
|
|
496 |
+ FT_COLR_PAINTFORMAT_SWEEP_GRADIENT = 8,
|
|
497 |
+ FT_COLR_PAINTFORMAT_GLYPH = 10,
|
|
498 |
+ FT_COLR_PAINTFORMAT_COLR_GLYPH = 11,
|
|
499 |
+ FT_COLR_PAINTFORMAT_TRANSFORMED = 12,
|
|
500 |
+ FT_COLR_PAINTFORMAT_TRANSLATE = 14,
|
|
501 |
+ FT_COLR_PAINTFORMAT_ROTATE = 16,
|
|
502 |
+ FT_COLR_PAINTFORMAT_SKEW = 18,
|
|
503 |
+ FT_COLR_PAINTFORMAT_COMPOSITE = 20,
|
|
504 |
+ FT_COLR_PAINT_FORMAT_MAX = 21,
|
|
505 |
+ FT_COLR_PAINTFORMAT_UNSUPPORTED = 255
|
|
506 |
+ |
|
507 |
+ } FT_PaintFormat;
|
|
508 |
+ |
|
509 |
+ |
|
510 |
+ /**************************************************************************
|
|
511 |
+ *
|
|
512 |
+ * @struct:
|
|
513 |
+ * FT_ColorStopIterator
|
|
514 |
+ *
|
|
515 |
+ * @description:
|
|
516 |
+ * This iterator object is needed for @FT_Get_Colorline_Stops. It keeps
|
|
517 |
+ * state while iterating over the stops of an @FT_ColorLine,
|
|
518 |
+ * representing the `ColorLine` struct of the v1 extensions to 'COLR',
|
|
519 |
+ * see 'https://github.com/googlefonts/colr-gradients-spec'.
|
|
520 |
+ *
|
|
521 |
+ * @fields:
|
|
522 |
+ * num_color_stops ::
|
|
523 |
+ * The number of color stops for the requested glyph index. Set by
|
|
524 |
+ * @FT_Get_Colorline_Stops.
|
|
525 |
+ *
|
|
526 |
+ * current_color_stop ::
|
|
527 |
+ * The current color stop. Set by @FT_Get_Colorline_Stops.
|
|
528 |
+ *
|
|
529 |
+ * p ::
|
|
530 |
+ * An opaque pointer into 'COLR' table data. The caller must set this
|
|
531 |
+ * to `NULL` before the first call of @FT_Get_Colorline_Stops.
|
|
532 |
+ *
|
|
533 |
+ * @since:
|
|
534 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
535 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
536 |
+ *
|
|
537 |
+ */
|
|
538 |
+ typedef struct FT_ColorStopIterator_
|
|
539 |
+ {
|
|
540 |
+ FT_UInt num_color_stops;
|
|
541 |
+ FT_UInt current_color_stop;
|
|
542 |
+ |
|
543 |
+ FT_Byte* p;
|
|
544 |
+ |
|
545 |
+ } FT_ColorStopIterator;
|
|
546 |
+ |
|
547 |
+ |
|
548 |
+ /**************************************************************************
|
|
549 |
+ *
|
|
550 |
+ * @struct:
|
|
551 |
+ * FT_ColorIndex
|
|
552 |
+ *
|
|
553 |
+ * @description:
|
|
554 |
+ * A structure representing a `ColorIndex` value of the 'COLR' v1
|
|
555 |
+ * extensions, see 'https://github.com/googlefonts/colr-gradients-spec'.
|
|
556 |
+ *
|
|
557 |
+ * @fields:
|
|
558 |
+ * palette_index ::
|
|
559 |
+ * The palette index into a 'CPAL' palette.
|
|
560 |
+ *
|
|
561 |
+ * alpha ::
|
|
562 |
+ * Alpha transparency value multiplied with the value from 'CPAL'.
|
|
563 |
+ *
|
|
564 |
+ * @since:
|
|
565 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
566 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
567 |
+ *
|
|
568 |
+ */
|
|
569 |
+ typedef struct FT_ColorIndex_
|
|
570 |
+ {
|
|
571 |
+ FT_UInt16 palette_index;
|
|
572 |
+ FT_F2Dot14 alpha;
|
|
573 |
+ |
|
574 |
+ } FT_ColorIndex;
|
|
575 |
+ |
|
576 |
+ |
|
577 |
+ /**************************************************************************
|
|
578 |
+ *
|
|
579 |
+ * @struct:
|
|
580 |
+ * FT_ColorStop
|
|
581 |
+ *
|
|
582 |
+ * @description:
|
|
583 |
+ * A structure representing a `ColorStop` value of the 'COLR' v1
|
|
584 |
+ * extensions, see 'https://github.com/googlefonts/colr-gradients-spec'.
|
|
585 |
+ *
|
|
586 |
+ * @fields:
|
|
587 |
+ * stop_offset ::
|
|
588 |
+ * The stop offset between 0 and 1 along the gradient.
|
|
589 |
+ *
|
|
590 |
+ * color ::
|
|
591 |
+ * The color information for this stop, see @FT_ColorIndex.
|
|
592 |
+ *
|
|
593 |
+ * @since:
|
|
594 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
595 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
596 |
+ *
|
|
597 |
+ */
|
|
598 |
+ typedef struct FT_ColorStop_
|
|
599 |
+ {
|
|
600 |
+ FT_F2Dot14 stop_offset;
|
|
601 |
+ FT_ColorIndex color;
|
|
602 |
+ |
|
603 |
+ } FT_ColorStop;
|
|
604 |
+ |
|
605 |
+ |
|
606 |
+ /**************************************************************************
|
|
607 |
+ *
|
|
608 |
+ * @enum:
|
|
609 |
+ * FT_PaintExtend
|
|
610 |
+ *
|
|
611 |
+ * @description:
|
|
612 |
+ * An enumeration representing the 'Extend' mode of the 'COLR' v1
|
|
613 |
+ * extensions, see 'https://github.com/googlefonts/colr-gradients-spec'.
|
|
614 |
+ * It describes how the gradient fill continues at the other boundaries.
|
|
615 |
+ *
|
|
616 |
+ * @since:
|
|
617 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
618 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
619 |
+ *
|
|
620 |
+ */
|
|
621 |
+ typedef enum FT_PaintExtend_
|
|
622 |
+ {
|
|
623 |
+ FT_COLR_PAINT_EXTEND_PAD = 0,
|
|
624 |
+ FT_COLR_PAINT_EXTEND_REPEAT = 1,
|
|
625 |
+ FT_COLR_PAINT_EXTEND_REFLECT = 2
|
|
626 |
+ |
|
627 |
+ } FT_PaintExtend;
|
|
628 |
+ |
|
629 |
+ |
|
630 |
+ /**************************************************************************
|
|
631 |
+ *
|
|
632 |
+ * @struct:
|
|
633 |
+ * FT_ColorLine
|
|
634 |
+ *
|
|
635 |
+ * @description:
|
|
636 |
+ * A structure representing a `ColorLine` value of the 'COLR' v1
|
|
637 |
+ * extensions, see 'https://github.com/googlefonts/colr-gradients-spec'.
|
|
638 |
+ * It describes a list of color stops along the defined gradient.
|
|
639 |
+ *
|
|
640 |
+ * @fields:
|
|
641 |
+ * extend ::
|
|
642 |
+ * The extend mode at the outer boundaries, see @FT_PaintExtend.
|
|
643 |
+ *
|
|
644 |
+ * color_stop_iterator ::
|
|
645 |
+ * The @FT_ColorStopIterator used to enumerate and retrieve the
|
|
646 |
+ * actual @FT_ColorStop's.
|
|
647 |
+ *
|
|
648 |
+ * @since:
|
|
649 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
650 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
651 |
+ *
|
|
652 |
+ */
|
|
653 |
+ typedef struct FT_ColorLine_
|
|
654 |
+ {
|
|
655 |
+ FT_PaintExtend extend;
|
|
656 |
+ FT_ColorStopIterator color_stop_iterator;
|
|
657 |
+ |
|
658 |
+ } FT_ColorLine;
|
|
659 |
+ |
|
660 |
+ |
|
661 |
+ /**************************************************************************
|
|
662 |
+ *
|
|
663 |
+ * @struct:
|
|
664 |
+ * FT_Affine23
|
|
665 |
+ *
|
|
666 |
+ * @description:
|
|
667 |
+ * A structure used to store a 2x3 matrix. Coefficients are in
|
|
668 |
+ * 16.16 fixed-point format. The computation performed is
|
|
669 |
+ *
|
|
670 |
+ * ```
|
|
671 |
+ * x' = x*xx + y*xy + dx
|
|
672 |
+ * y' = x*yx + y*yy + dy
|
|
673 |
+ * ```
|
|
674 |
+ *
|
|
675 |
+ * @fields:
|
|
676 |
+ * xx ::
|
|
677 |
+ * Matrix coefficient.
|
|
678 |
+ *
|
|
679 |
+ * xy ::
|
|
680 |
+ * Matrix coefficient.
|
|
681 |
+ *
|
|
682 |
+ * dx ::
|
|
683 |
+ * x translation.
|
|
684 |
+ *
|
|
685 |
+ * yx ::
|
|
686 |
+ * Matrix coefficient.
|
|
687 |
+ *
|
|
688 |
+ * yy ::
|
|
689 |
+ * Matrix coefficient.
|
|
690 |
+ *
|
|
691 |
+ * dy ::
|
|
692 |
+ * y translation.
|
|
693 |
+ *
|
|
694 |
+ * @since:
|
|
695 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
696 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
697 |
+ *
|
|
698 |
+ */
|
|
699 |
+ typedef struct FT_Affine_23_
|
|
700 |
+ {
|
|
701 |
+ FT_Fixed xx, xy, dx;
|
|
702 |
+ FT_Fixed yx, yy, dy;
|
|
703 |
+ |
|
704 |
+ } FT_Affine23;
|
|
705 |
+ |
|
706 |
+ |
|
707 |
+ /**************************************************************************
|
|
708 |
+ *
|
|
709 |
+ * @enum:
|
|
710 |
+ * FT_Composite_Mode
|
|
711 |
+ *
|
|
712 |
+ * @description:
|
|
713 |
+ * An enumeration listing the 'COLR' v1 composite modes used in
|
|
714 |
+ * @FT_PaintComposite. For more details on each paint mode, see
|
|
715 |
+ * 'https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators'.
|
|
716 |
+ *
|
|
717 |
+ * @since:
|
|
718 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
719 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
720 |
+ *
|
|
721 |
+ */
|
|
722 |
+ typedef enum FT_Composite_Mode_
|
|
723 |
+ {
|
|
724 |
+ FT_COLR_COMPOSITE_CLEAR = 0,
|
|
725 |
+ FT_COLR_COMPOSITE_SRC = 1,
|
|
726 |
+ FT_COLR_COMPOSITE_DEST = 2,
|
|
727 |
+ FT_COLR_COMPOSITE_SRC_OVER = 3,
|
|
728 |
+ FT_COLR_COMPOSITE_DEST_OVER = 4,
|
|
729 |
+ FT_COLR_COMPOSITE_SRC_IN = 5,
|
|
730 |
+ FT_COLR_COMPOSITE_DEST_IN = 6,
|
|
731 |
+ FT_COLR_COMPOSITE_SRC_OUT = 7,
|
|
732 |
+ FT_COLR_COMPOSITE_DEST_OUT = 8,
|
|
733 |
+ FT_COLR_COMPOSITE_SRC_ATOP = 9,
|
|
734 |
+ FT_COLR_COMPOSITE_DEST_ATOP = 10,
|
|
735 |
+ FT_COLR_COMPOSITE_XOR = 11,
|
|
736 |
+ FT_COLR_COMPOSITE_SCREEN = 12,
|
|
737 |
+ FT_COLR_COMPOSITE_OVERLAY = 13,
|
|
738 |
+ FT_COLR_COMPOSITE_DARKEN = 14,
|
|
739 |
+ FT_COLR_COMPOSITE_LIGHTEN = 15,
|
|
740 |
+ FT_COLR_COMPOSITE_COLOR_DODGE = 16,
|
|
741 |
+ FT_COLR_COMPOSITE_COLOR_BURN = 17,
|
|
742 |
+ FT_COLR_COMPOSITE_HARD_LIGHT = 18,
|
|
743 |
+ FT_COLR_COMPOSITE_SOFT_LIGHT = 19,
|
|
744 |
+ FT_COLR_COMPOSITE_DIFFERENCE = 20,
|
|
745 |
+ FT_COLR_COMPOSITE_EXCLUSION = 21,
|
|
746 |
+ FT_COLR_COMPOSITE_MULTIPLY = 22,
|
|
747 |
+ FT_COLR_COMPOSITE_HSL_HUE = 23,
|
|
748 |
+ FT_COLR_COMPOSITE_HSL_SATURATION = 24,
|
|
749 |
+ FT_COLR_COMPOSITE_HSL_COLOR = 25,
|
|
750 |
+ FT_COLR_COMPOSITE_HSL_LUMINOSITY = 26,
|
|
751 |
+ FT_COLR_COMPOSITE_MAX = 27
|
|
752 |
+ |
|
753 |
+ } FT_Composite_Mode;
|
|
754 |
+ |
|
755 |
+ |
|
756 |
+ /**************************************************************************
|
|
757 |
+ *
|
|
758 |
+ * @struct:
|
|
759 |
+ * FT_OpaquePaint
|
|
760 |
+ *
|
|
761 |
+ * @description:
|
|
762 |
+ * A structure representing an offset to a `Paint` value stored in any
|
|
763 |
+ * of the paint tables of a 'COLR' v1 font. Compare Offset<24> there.
|
|
764 |
+ * When 'COLR' v1 paint tables represented by FreeType objects such as
|
|
765 |
+ * @FT_PaintColrLayers, @FT_PaintComposite, or @FT_PaintTransformed
|
|
766 |
+ * reference downstream nested paint tables, we do not immediately
|
|
767 |
+ * retrieve them but encapsulate their location in this type. Use
|
|
768 |
+ * @FT_Get_Paint to retrieve the actual @FT_COLR_Paint object that
|
|
769 |
+ * describes the details of the respective paint table.
|
|
770 |
+ *
|
|
771 |
+ * @fields:
|
|
772 |
+ * p ::
|
|
773 |
+ * An internal offset to a Paint table, needs to be set to NULL before
|
|
774 |
+ * passing this struct as an argument to @FT_Get_Paint.
|
|
775 |
+ *
|
|
776 |
+ * insert_root_transform ::
|
|
777 |
+ * An internal boolean to track whether an initial root transform is
|
|
778 |
+ * to be provided. Do not set this value.
|
|
779 |
+ *
|
|
780 |
+ * @since:
|
|
781 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
782 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
783 |
+ *
|
|
784 |
+ */
|
|
785 |
+ typedef struct FT_Opaque_Paint_
|
|
786 |
+ {
|
|
787 |
+ FT_Byte* p;
|
|
788 |
+ FT_Bool insert_root_transform;
|
|
789 |
+ } FT_OpaquePaint;
|
|
790 |
+ |
|
791 |
+ |
|
792 |
+ /**************************************************************************
|
|
793 |
+ *
|
|
794 |
+ * @struct:
|
|
795 |
+ * FT_PaintColrLayers
|
|
796 |
+ *
|
|
797 |
+ * @description:
|
|
798 |
+ * A structure representing a `PaintColrLayers` table of a 'COLR' v1
|
|
799 |
+ * font. This table describes a set of layers that are to be composited
|
|
800 |
+ * with composite mode `FT_COLR_COMPOSITE_SRC_OVER`. The return value
|
|
801 |
+ * of this function is an @FT_LayerIterator initialized so that it can
|
|
802 |
+ * be used with @FT_Get_Paint_Layers to retrieve the @FT_OpaquePaint
|
|
803 |
+ * objects as references to each layer.
|
|
804 |
+ *
|
|
805 |
+ * @fields:
|
|
806 |
+ * layer_iterator ::
|
|
807 |
+ * The layer iterator that describes the layers of this paint.
|
|
808 |
+ *
|
|
809 |
+ * @since:
|
|
810 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
811 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
812 |
+ *
|
|
813 |
+ */
|
|
814 |
+ typedef struct FT_PaintColrLayers_
|
|
815 |
+ {
|
|
816 |
+ FT_LayerIterator layer_iterator;
|
|
817 |
+ |
|
818 |
+ } FT_PaintColrLayers;
|
|
819 |
+ |
|
820 |
+ |
|
821 |
+ /**************************************************************************
|
|
822 |
+ *
|
|
823 |
+ * @struct:
|
|
824 |
+ * FT_PaintSolid
|
|
825 |
+ *
|
|
826 |
+ * @description:
|
|
827 |
+ * A structure representing a `PaintSolid` value of the 'COLR' v1
|
|
828 |
+ * extensions, see 'https://github.com/googlefonts/colr-gradients-spec'.
|
|
829 |
+ * Using a `PaintSolid` value means that the glyph layer filled with
|
|
830 |
+ * this paint is solid-colored and does not contain a gradient.
|
|
831 |
+ *
|
|
832 |
+ * @fields:
|
|
833 |
+ * color ::
|
|
834 |
+ * The color information for this solid paint, see @FT_ColorIndex.
|
|
835 |
+ *
|
|
836 |
+ * @since:
|
|
837 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
838 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
839 |
+ *
|
|
840 |
+ */
|
|
841 |
+ typedef struct FT_PaintSolid_
|
|
842 |
+ {
|
|
843 |
+ FT_ColorIndex color;
|
|
844 |
+ |
|
845 |
+ } FT_PaintSolid;
|
|
846 |
+ |
|
847 |
+ |
|
848 |
+ /**************************************************************************
|
|
849 |
+ *
|
|
850 |
+ * @struct:
|
|
851 |
+ * FT_PaintLinearGradient
|
|
852 |
+ *
|
|
853 |
+ * @description:
|
|
854 |
+ * A structure representing a `PaintLinearGradient` value of the 'COLR'
|
|
855 |
+ * v1 extensions, see
|
|
856 |
+ * 'https://github.com/googlefonts/colr-gradients-spec'. The glyph
|
|
857 |
+ * layer filled with this paint is drawn filled with a linear gradient.
|
|
858 |
+ *
|
|
859 |
+ * @fields:
|
|
860 |
+ * colorline ::
|
|
861 |
+ * The @FT_ColorLine information for this paint, i.e., the list of
|
|
862 |
+ * color stops along the gradient.
|
|
863 |
+ *
|
|
864 |
+ * p0 ::
|
|
865 |
+ * The starting point of the gradient definition (in font units).
|
|
866 |
+ *
|
|
867 |
+ * p1 ::
|
|
868 |
+ * The end point of the gradient definition (in font units).
|
|
869 |
+ *
|
|
870 |
+ * p2 ::
|
|
871 |
+ * Optional point~p2 to rotate the gradient (in font units).
|
|
872 |
+ * Otherwise equal to~p0.
|
|
873 |
+ *
|
|
874 |
+ * @since:
|
|
875 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
876 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
877 |
+ *
|
|
878 |
+ */
|
|
879 |
+ typedef struct FT_PaintLinearGradient_
|
|
880 |
+ {
|
|
881 |
+ FT_ColorLine colorline;
|
|
882 |
+ |
|
883 |
+ /* TODO: Potentially expose those as x0, y0 etc. */
|
|
884 |
+ FT_Vector p0;
|
|
885 |
+ FT_Vector p1;
|
|
886 |
+ FT_Vector p2;
|
|
887 |
+ |
|
888 |
+ } FT_PaintLinearGradient;
|
|
889 |
+ |
|
890 |
+ |
|
891 |
+ /**************************************************************************
|
|
892 |
+ *
|
|
893 |
+ * @struct:
|
|
894 |
+ * FT_PaintRadialGradient
|
|
895 |
+ *
|
|
896 |
+ * @description:
|
|
897 |
+ * A structure representing a `PaintRadialGradient` value of the 'COLR'
|
|
898 |
+ * v1 extensions, see
|
|
899 |
+ * 'https://github.com/googlefonts/colr-gradients-spec'. The glyph
|
|
900 |
+ * layer filled with this paint is drawn filled filled with a radial
|
|
901 |
+ * gradient.
|
|
902 |
+ *
|
|
903 |
+ * @fields:
|
|
904 |
+ * colorline ::
|
|
905 |
+ * The @FT_ColorLine information for this paint, i.e., the list of
|
|
906 |
+ * color stops along the gradient.
|
|
907 |
+ *
|
|
908 |
+ * c0 ::
|
|
909 |
+ * The center of the starting point of the radial gradient (in font
|
|
910 |
+ * units).
|
|
911 |
+ *
|
|
912 |
+ * r0 ::
|
|
913 |
+ * The radius of the starting circle of the radial gradient (in font
|
|
914 |
+ * units).
|
|
915 |
+ *
|
|
916 |
+ * c1 ::
|
|
917 |
+ * The center of the end point of the radial gradient (in font units).
|
|
918 |
+ *
|
|
919 |
+ * r1 ::
|
|
920 |
+ * The radius of the end circle of the radial gradient (in font
|
|
921 |
+ * units).
|
|
922 |
+ *
|
|
923 |
+ * @since:
|
|
924 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
925 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
926 |
+ *
|
|
927 |
+ */
|
|
928 |
+ typedef struct FT_PaintRadialGradient_
|
|
929 |
+ {
|
|
930 |
+ FT_ColorLine colorline;
|
|
931 |
+ |
|
932 |
+ FT_Vector c0;
|
|
933 |
+ FT_UShort r0;
|
|
934 |
+ FT_Vector c1;
|
|
935 |
+ FT_UShort r1;
|
|
936 |
+ |
|
937 |
+ } FT_PaintRadialGradient;
|
|
938 |
+ |
|
939 |
+ |
|
940 |
+ /**************************************************************************
|
|
941 |
+ *
|
|
942 |
+ * @struct:
|
|
943 |
+ * FT_PaintSweepGradient
|
|
944 |
+ *
|
|
945 |
+ * @description:
|
|
946 |
+ * A structure representing a `PaintSweepGradient` value of the 'COLR'
|
|
947 |
+ * v1 extensions, see
|
|
948 |
+ * 'https://github.com/googlefonts/colr-gradients-spec'. The glyph
|
|
949 |
+ * layer filled with this paint is drawn filled with a sweep gradient
|
|
950 |
+ * from `start_angle` to `end_angle`.
|
|
951 |
+ *
|
|
952 |
+ * @fields:
|
|
953 |
+ * colorline ::
|
|
954 |
+ * The @FT_ColorLine information for this paint, i.e., the list of
|
|
955 |
+ * color stops along the gradient.
|
|
956 |
+ *
|
|
957 |
+ * center ::
|
|
958 |
+ * The center of the sweep gradient (in font units).
|
|
959 |
+ *
|
|
960 |
+ * start_angle ::
|
|
961 |
+ * The start angle of the sweep gradient, in 16.16 fixed point format
|
|
962 |
+ * specifying degrees. Values are given counter-clockwise, starting
|
|
963 |
+ * from the (positive) y~axis.
|
|
964 |
+ *
|
|
965 |
+ * end_angle ::
|
|
966 |
+ * The end angle of the sweep gradient, in 16.16 fixed point format
|
|
967 |
+ * specifying degrees. Values are given counter-clockwise, starting
|
|
968 |
+ * from the (positive) y~axis.
|
|
969 |
+ *
|
|
970 |
+ * @since:
|
|
971 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
972 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
973 |
+ *
|
|
974 |
+ */
|
|
975 |
+ typedef struct FT_PaintSweepGradient_
|
|
976 |
+ {
|
|
977 |
+ FT_ColorLine colorline;
|
|
978 |
+ |
|
979 |
+ FT_Vector center;
|
|
980 |
+ FT_Fixed start_angle;
|
|
981 |
+ FT_Fixed end_angle;
|
|
982 |
+ |
|
983 |
+ } FT_PaintSweepGradient;
|
|
984 |
+ |
|
985 |
+ |
|
986 |
+ /**************************************************************************
|
|
987 |
+ *
|
|
988 |
+ * @struct:
|
|
989 |
+ * FT_PaintGlyph
|
|
990 |
+ *
|
|
991 |
+ * @description:
|
|
992 |
+ * A structure representing a 'COLR' v1 `PaintGlyph` paint table.
|
|
993 |
+ *
|
|
994 |
+ * @fields:
|
|
995 |
+ * paint ::
|
|
996 |
+ * An opaque paint object pointing to a `Paint` table that serves as
|
|
997 |
+ * the fill for the glyph ID.
|
|
998 |
+ *
|
|
999 |
+ * glyphID ::
|
|
1000 |
+ * The glyph ID from the 'glyf' table, which serves as the contour
|
|
1001 |
+ * information that is filled with paint.
|
|
1002 |
+ *
|
|
1003 |
+ * @since:
|
|
1004 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
1005 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
1006 |
+ *
|
|
1007 |
+ */
|
|
1008 |
+ typedef struct FT_PaintGlyph_
|
|
1009 |
+ {
|
|
1010 |
+ FT_OpaquePaint paint;
|
|
1011 |
+ FT_UInt glyphID;
|
|
1012 |
+ |
|
1013 |
+ } FT_PaintGlyph;
|
|
1014 |
+ |
|
1015 |
+ |
|
1016 |
+ /**************************************************************************
|
|
1017 |
+ *
|
|
1018 |
+ * @struct:
|
|
1019 |
+ * FT_PaintColrGlyph
|
|
1020 |
+ *
|
|
1021 |
+ * @description:
|
|
1022 |
+ * A structure representing a 'COLR' v1 `PaintColorGlyph` paint table.
|
|
1023 |
+ *
|
|
1024 |
+ * @fields:
|
|
1025 |
+ * glyphID ::
|
|
1026 |
+ * The glyph ID from the `BaseGlyphV1List` table that is drawn for
|
|
1027 |
+ * this paint.
|
|
1028 |
+ *
|
|
1029 |
+ * @since:
|
|
1030 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
1031 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
1032 |
+ *
|
|
1033 |
+ */
|
|
1034 |
+ typedef struct FT_PaintColrGlyph_
|
|
1035 |
+ {
|
|
1036 |
+ FT_UInt glyphID;
|
|
1037 |
+ |
|
1038 |
+ } FT_PaintColrGlyph;
|
|
1039 |
+ |
|
1040 |
+ |
|
1041 |
+ /**************************************************************************
|
|
1042 |
+ *
|
|
1043 |
+ * @struct:
|
|
1044 |
+ * FT_PaintTransformed
|
|
1045 |
+ *
|
|
1046 |
+ * @description:
|
|
1047 |
+ * A structure representing a 'COLR' v1 `PaintTransformed` paint table.
|
|
1048 |
+ *
|
|
1049 |
+ * @fields:
|
|
1050 |
+ * paint ::
|
|
1051 |
+ * An opaque paint that is subject to being transformed.
|
|
1052 |
+ *
|
|
1053 |
+ * affine ::
|
|
1054 |
+ * A 2x3 transformation matrix in @FT_Affine23 format.
|
|
1055 |
+ *
|
|
1056 |
+ * @since:
|
|
1057 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
1058 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
1059 |
+ *
|
|
1060 |
+ */
|
|
1061 |
+ typedef struct FT_PaintTransformed_
|
|
1062 |
+ {
|
|
1063 |
+ FT_OpaquePaint paint;
|
|
1064 |
+ FT_Affine23 affine;
|
|
1065 |
+ |
|
1066 |
+ } FT_PaintTransformed;
|
|
1067 |
+ |
|
1068 |
+ |
|
1069 |
+ /**************************************************************************
|
|
1070 |
+ *
|
|
1071 |
+ * @struct:
|
|
1072 |
+ * FT_PaintTranslate
|
|
1073 |
+ *
|
|
1074 |
+ * @description:
|
|
1075 |
+ * A structure representing a 'COLR' v1 `PaintTranslate` paint table.
|
|
1076 |
+ * Used for translating downstream paints by a given x and y~delta.
|
|
1077 |
+ *
|
|
1078 |
+ * @fields:
|
|
1079 |
+ * paint ::
|
|
1080 |
+ * An @FT_OpaquePaint object referencing the paint that is to be
|
|
1081 |
+ * rotated.
|
|
1082 |
+ *
|
|
1083 |
+ * dx ::
|
|
1084 |
+ * Translation in x~direction (in font units).
|
|
1085 |
+ *
|
|
1086 |
+ * dy ::
|
|
1087 |
+ * Translation in y~direction (in font units).
|
|
1088 |
+ *
|
|
1089 |
+ * @since:
|
|
1090 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
1091 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
1092 |
+ *
|
|
1093 |
+ */
|
|
1094 |
+ typedef struct FT_PaintTranslate_
|
|
1095 |
+ {
|
|
1096 |
+ FT_OpaquePaint paint;
|
|
1097 |
+ |
|
1098 |
+ FT_Fixed dx;
|
|
1099 |
+ FT_Fixed dy;
|
|
1100 |
+ |
|
1101 |
+ } FT_PaintTranslate;
|
|
1102 |
+ |
|
1103 |
+ |
|
1104 |
+ /**************************************************************************
|
|
1105 |
+ *
|
|
1106 |
+ * @struct:
|
|
1107 |
+ * FT_PaintRotate
|
|
1108 |
+ *
|
|
1109 |
+ * @description:
|
|
1110 |
+ * A structure representing a 'COLR' v1 `PaintRotate` paint table. Used
|
|
1111 |
+ * for rotating downstream paints with a given center and angle.
|
|
1112 |
+ *
|
|
1113 |
+ * @fields:
|
|
1114 |
+ * paint ::
|
|
1115 |
+ * An @FT_OpaquePaint object referencing the paint that is to be
|
|
1116 |
+ * rotated.
|
|
1117 |
+ *
|
|
1118 |
+ * angle ::
|
|
1119 |
+ * The rotation angle that is to be applied.
|
|
1120 |
+ *
|
|
1121 |
+ * center_x ::
|
|
1122 |
+ * The x~coordinate of the pivot point of the rotation (in font
|
|
1123 |
+ * units).
|
|
1124 |
+ *
|
|
1125 |
+ * center_y ::
|
|
1126 |
+ * The y~coordinate of the pivot point of the rotation (in font
|
|
1127 |
+ * units).
|
|
1128 |
+ *
|
|
1129 |
+ * @since:
|
|
1130 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
1131 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
1132 |
+ *
|
|
1133 |
+ */
|
|
1134 |
+ |
|
1135 |
+ typedef struct FT_PaintRotate_
|
|
1136 |
+ {
|
|
1137 |
+ FT_OpaquePaint paint;
|
|
1138 |
+ |
|
1139 |
+ FT_Fixed angle;
|
|
1140 |
+ |
|
1141 |
+ FT_Fixed center_x;
|
|
1142 |
+ FT_Fixed center_y;
|
|
1143 |
+ |
|
1144 |
+ } FT_PaintRotate;
|
|
1145 |
+ |
|
1146 |
+ |
|
1147 |
+ /**************************************************************************
|
|
1148 |
+ *
|
|
1149 |
+ * @struct:
|
|
1150 |
+ * FT_PaintSkew
|
|
1151 |
+ *
|
|
1152 |
+ * @description:
|
|
1153 |
+ * A structure representing a 'COLR' v1 `PaintSkew` paint table. Used
|
|
1154 |
+ * for skewing or shearing downstream paints by a given center and
|
|
1155 |
+ * angle.
|
|
1156 |
+ *
|
|
1157 |
+ * @fields:
|
|
1158 |
+ * paint ::
|
|
1159 |
+ * An @FT_OpaquePaint object referencing the paint that is to be
|
|
1160 |
+ * skewed.
|
|
1161 |
+ *
|
|
1162 |
+ * x_skew_angle ::
|
|
1163 |
+ * The skewing angle in x~direction.
|
|
1164 |
+ *
|
|
1165 |
+ * y_skew_angle ::
|
|
1166 |
+ * The skewing angle in y~direction.
|
|
1167 |
+ *
|
|
1168 |
+ * center_x ::
|
|
1169 |
+ * The x~coordinate of the pivot point of the skew (in font units).
|
|
1170 |
+ *
|
|
1171 |
+ * center_y ::
|
|
1172 |
+ * The y~coordinate of the pivot point of the skew (in font units).
|
|
1173 |
+ *
|
|
1174 |
+ * @since:
|
|
1175 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
1176 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
1177 |
+ *
|
|
1178 |
+ */
|
|
1179 |
+ typedef struct FT_PaintSkew_
|
|
1180 |
+ {
|
|
1181 |
+ FT_OpaquePaint paint;
|
|
1182 |
+ |
|
1183 |
+ FT_Fixed x_skew_angle;
|
|
1184 |
+ FT_Fixed y_skew_angle;
|
|
1185 |
+ |
|
1186 |
+ FT_Fixed center_x;
|
|
1187 |
+ FT_Fixed center_y;
|
|
1188 |
+ |
|
1189 |
+ } FT_PaintSkew;
|
|
1190 |
+ |
|
1191 |
+ |
|
1192 |
+ /**************************************************************************
|
|
1193 |
+ *
|
|
1194 |
+ * @struct:
|
|
1195 |
+ * FT_PaintComposite
|
|
1196 |
+ *
|
|
1197 |
+ * @description:
|
|
1198 |
+ * A structure representing a 'COLR'v1 `PaintComposite` paint table.
|
|
1199 |
+ * Used for compositing two paints in a 'COLR' v1 directed acycling
|
|
1200 |
+ * graph.
|
|
1201 |
+ *
|
|
1202 |
+ * @fields:
|
|
1203 |
+ * source_paint ::
|
|
1204 |
+ * An @FT_OpaquePaint object referencing the source that is to be
|
|
1205 |
+ * composited.
|
|
1206 |
+ *
|
|
1207 |
+ * composite_mode ::
|
|
1208 |
+ * An @FT_Composite_Mode enum value determining the composition
|
|
1209 |
+ * operation.
|
|
1210 |
+ *
|
|
1211 |
+ * backdrop_paint ::
|
|
1212 |
+ * An @FT_OpaquePaint object referencing the backdrop paint that
|
|
1213 |
+ * `source_paint` is composited onto.
|
|
1214 |
+ *
|
|
1215 |
+ * @since:
|
|
1216 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
1217 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
1218 |
+ *
|
|
1219 |
+ */
|
|
1220 |
+ typedef struct FT_PaintComposite_
|
|
1221 |
+ {
|
|
1222 |
+ FT_OpaquePaint source_paint;
|
|
1223 |
+ FT_Composite_Mode composite_mode;
|
|
1224 |
+ FT_OpaquePaint backdrop_paint;
|
|
1225 |
+ |
|
1226 |
+ } FT_PaintComposite;
|
|
1227 |
+ |
|
1228 |
+ |
|
1229 |
+ /**************************************************************************
|
|
1230 |
+ *
|
|
1231 |
+ * @union:
|
|
1232 |
+ * FT_COLR_Paint
|
|
1233 |
+ *
|
|
1234 |
+ * @description:
|
|
1235 |
+ * A union object representing format and details of a paint table of a
|
|
1236 |
+ * 'COLR' v1 font, see
|
|
1237 |
+ * 'https://github.com/googlefonts/colr-gradients-spec'. Use
|
|
1238 |
+ * @FT_Get_Paint to retrieve a @FT_COLR_Paint for an @FT_OpaquePaint
|
|
1239 |
+ * object.
|
|
1240 |
+ *
|
|
1241 |
+ * @fields:
|
|
1242 |
+ * format ::
|
|
1243 |
+ * The gradient format for this Paint structure.
|
|
1244 |
+ *
|
|
1245 |
+ * u ::
|
|
1246 |
+ * Union of all paint table types:
|
|
1247 |
+ *
|
|
1248 |
+ * * @FT_PaintColrLayers
|
|
1249 |
+ * * @FT_PaintGlyph
|
|
1250 |
+ * * @FT_PaintSolid
|
|
1251 |
+ * * @FT_PaintLinearGradient
|
|
1252 |
+ * * @FT_PaintRadialGradient
|
|
1253 |
+ * * @FT_PaintSweepGradient
|
|
1254 |
+ * * @FT_PaintTransformed
|
|
1255 |
+ * * @FT_PaintTranslate
|
|
1256 |
+ * * @FT_PaintRotate
|
|
1257 |
+ * * @FT_PaintSkew
|
|
1258 |
+ * * @FT_PaintComposite
|
|
1259 |
+ * * @FT_PaintColrGlyph
|
|
1260 |
+ *
|
|
1261 |
+ * @since:
|
|
1262 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
1263 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
1264 |
+ *
|
|
1265 |
+ */
|
|
1266 |
+ typedef struct FT_COLR_Paint_
|
|
1267 |
+ {
|
|
1268 |
+ FT_PaintFormat format;
|
|
1269 |
+ |
|
1270 |
+ union
|
|
1271 |
+ {
|
|
1272 |
+ FT_PaintColrLayers colr_layers;
|
|
1273 |
+ FT_PaintGlyph glyph;
|
|
1274 |
+ FT_PaintSolid solid;
|
|
1275 |
+ FT_PaintLinearGradient linear_gradient;
|
|
1276 |
+ FT_PaintRadialGradient radial_gradient;
|
|
1277 |
+ FT_PaintSweepGradient sweep_gradient;
|
|
1278 |
+ FT_PaintTransformed transformed;
|
|
1279 |
+ FT_PaintTranslate translate;
|
|
1280 |
+ FT_PaintRotate rotate;
|
|
1281 |
+ FT_PaintSkew skew;
|
|
1282 |
+ FT_PaintComposite composite;
|
|
1283 |
+ FT_PaintColrGlyph colr_glyph;
|
|
1284 |
+ |
|
1285 |
+ } u;
|
|
1286 |
+ |
|
1287 |
+ } FT_COLR_Paint;
|
|
1288 |
+ |
|
1289 |
+ |
|
1290 |
+ /**************************************************************************
|
|
1291 |
+ *
|
|
1292 |
+ * @enum:
|
|
1293 |
+ * FT_Color_Root_Transform
|
|
1294 |
+ *
|
|
1295 |
+ * @description:
|
|
1296 |
+ * An enumeration to specify whether @FT_Get_Color_Glyph_Paint is to
|
|
1297 |
+ * return a root transform to configure the client's graphics context
|
|
1298 |
+ * matrix.
|
|
1299 |
+ *
|
|
1300 |
+ * @values:
|
|
1301 |
+ * FT_COLOR_INCLUDE_ROOT_TRANSFORM ::
|
|
1302 |
+ * Do include the root transform as the initial @FT_COLR_Paint object.
|
|
1303 |
+ *
|
|
1304 |
+ * FT_COLOR_NO_ROOT_TRANSFORM ::
|
|
1305 |
+ * Do not output an initial root transform.
|
|
1306 |
+ *
|
|
1307 |
+ * @since:
|
|
1308 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
1309 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
1310 |
+ *
|
|
1311 |
+ */
|
|
1312 |
+ typedef enum FT_Color_Root_Transform_
|
|
1313 |
+ {
|
|
1314 |
+ FT_COLOR_INCLUDE_ROOT_TRANSFORM,
|
|
1315 |
+ FT_COLOR_NO_ROOT_TRANSFORM,
|
|
1316 |
+ |
|
1317 |
+ FT_COLOR_ROOT_TRANSFORM_MAX
|
|
1318 |
+ |
|
1319 |
+ } FT_Color_Root_Transform;
|
|
1320 |
+ |
|
1321 |
+ |
|
1322 |
+ /**************************************************************************
|
|
1323 |
+ *
|
|
1324 |
+ * @function:
|
|
1325 |
+ * FT_Get_Color_Glyph_Paint
|
|
1326 |
+ *
|
|
1327 |
+ * @description:
|
|
1328 |
+ * This is the starting point and interface to color gradient
|
|
1329 |
+ * information in a 'COLR' v1 table in OpenType fonts to recursively
|
|
1330 |
+ * retrieve the paint tables for the directed acyclic graph of a colored
|
|
1331 |
+ * glyph, given a glyph ID.
|
|
1332 |
+ *
|
|
1333 |
+ * https://github.com/googlefonts/colr-gradients-spec
|
|
1334 |
+ *
|
|
1335 |
+ * In a 'COLR' v1 font, each color glyph defines a directed acyclic
|
|
1336 |
+ * graph of nested paint tables, such as `PaintGlyph`, `PaintSolid`,
|
|
1337 |
+ * `PaintLinearGradient`, `PaintRadialGradient`, and so on. Using this
|
|
1338 |
+ * function and specifying a glyph ID, one retrieves the root paint
|
|
1339 |
+ * table for this glyph ID.
|
|
1340 |
+ *
|
|
1341 |
+ * This function allows control whether an initial root transform is
|
|
1342 |
+ * returned to configure scaling, transform, and translation correctly
|
|
1343 |
+ * on the client's graphics context. The initial root transform is
|
|
1344 |
+ * computed and returned according to the values configured for @FT_Size
|
|
1345 |
+ * and @FT_Set_Transform on the @FT_Face object, see below for details
|
|
1346 |
+ * of the `root_transform` parameter. This has implications for a
|
|
1347 |
+ * client 'COLR' v1 implementation: When this function returns an
|
|
1348 |
+ * initially computed root transform, at the time of executing the
|
|
1349 |
+ * @FT_PaintGlyph operation, the contours should be retrieved using
|
|
1350 |
+ * @FT_Load_Glyph at unscaled, untransformed size. This is because the
|
|
1351 |
+ * root transform applied to the graphics context will take care of
|
|
1352 |
+ * correct scaling.
|
|
1353 |
+ *
|
|
1354 |
+ * Alternatively, to allow hinting of contours, at the time of executing
|
|
1355 |
+ * @FT_Load_Glyph, the current graphics context transformation matrix
|
|
1356 |
+ * can be decomposed into a scaling matrix and a remainder, and
|
|
1357 |
+ * @FT_Load_Glyph can be used to retrieve the contours at scaled size.
|
|
1358 |
+ * Care must then be taken to blit or clip to the graphics context with
|
|
1359 |
+ * taking this remainder transformation into account.
|
|
1360 |
+ *
|
|
1361 |
+ * @input:
|
|
1362 |
+ * face ::
|
|
1363 |
+ * A handle to the parent face object.
|
|
1364 |
+ *
|
|
1365 |
+ * base_glyph ::
|
|
1366 |
+ * The glyph index for which to retrieve the root paint table.
|
|
1367 |
+ *
|
|
1368 |
+ * root_transform ::
|
|
1369 |
+ * Specifies whether an initially computed root is returned by the
|
|
1370 |
+ * @FT_PaintTransformed operation to account for the activated size
|
|
1371 |
+ * (see @FT_Activate_Size) and the configured transform and translate
|
|
1372 |
+ * (see @FT_Set_Transform).
|
|
1373 |
+ *
|
|
1374 |
+ * This root transform is returned before nodes of the glyph graph of
|
|
1375 |
+ * the font are returned. Subsequent @FT_COLR_Paint structures
|
|
1376 |
+ * contain unscaled and untransformed values. The inserted root
|
|
1377 |
+ * transform enables the client application to apply an initial
|
|
1378 |
+ * transform to its graphics context. When executing subsequent
|
|
1379 |
+ * FT_COLR_Paint operations, values from @FT_COLR_Paint operations
|
|
1380 |
+ * will ultimately be correctly scaled because of the root transform
|
|
1381 |
+ * applied to the graphics context. Use
|
|
1382 |
+ * @FT_COLOR_INCLUDE_ROOT_TRANSFORM to include the root transform, use
|
|
1383 |
+ * @FT_COLOR_NO_ROOT_TRANSFORM to not include it. The latter may be
|
|
1384 |
+ * useful when traversing the 'COLR' v1 glyph graph and reaching a
|
|
1385 |
+ * @FT_PaintColrGlyph. When recursing into @FT_PaintColrGlyph and
|
|
1386 |
+ * painting that inline, no additional root transform is needed as it
|
|
1387 |
+ * has already been applied to the graphics context at the beginning
|
|
1388 |
+ * of drawing this glyph.
|
|
1389 |
+ *
|
|
1390 |
+ * @output:
|
|
1391 |
+ * paint ::
|
|
1392 |
+ * The @FT_OpaquePaint object that references the actual paint table.
|
|
1393 |
+ *
|
|
1394 |
+ * The respective actual @FT_COLR_Paint object is retrieved via
|
|
1395 |
+ * @FT_Get_Paint.
|
|
1396 |
+ *
|
|
1397 |
+ * @return:
|
|
1398 |
+ * Value~1 if everything is OK. If no color glyph is found, or the root
|
|
1399 |
+ * paint could not be retrieved, value~0 gets returned. In case of an
|
|
1400 |
+ * error, value~0 is returned also.
|
|
1401 |
+ *
|
|
1402 |
+ * @since:
|
|
1403 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
1404 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
1405 |
+ *
|
|
1406 |
+ */
|
|
1407 |
+ FT_EXPORT( FT_Bool )
|
|
1408 |
+ FT_Get_Color_Glyph_Paint( FT_Face face,
|
|
1409 |
+ FT_UInt base_glyph,
|
|
1410 |
+ FT_Color_Root_Transform root_transform,
|
|
1411 |
+ FT_OpaquePaint* paint );
|
|
1412 |
+ |
|
1413 |
+ |
|
1414 |
+ /**************************************************************************
|
|
1415 |
+ *
|
|
1416 |
+ * @function:
|
|
1417 |
+ * FT_Get_Paint_Layers
|
|
1418 |
+ *
|
|
1419 |
+ * @description:
|
|
1420 |
+ * Access the layers of a `PaintColrLayers` table.
|
|
1421 |
+ *
|
|
1422 |
+ * If the root paint of a color glyph, or a nested paint of a 'COLR'
|
|
1423 |
+ * glyph is a `PaintColrLayers` table, this function retrieves the
|
|
1424 |
+ * layers of the `PaintColrLayers` table.
|
|
1425 |
+ *
|
|
1426 |
+ * The @FT_PaintColrLayers object contains an @FT_LayerIterator, which
|
|
1427 |
+ * is used here to iterate over the layers. Each layer is returned as
|
|
1428 |
+ * an @FT_OpaquePaint object, which then can be used with @FT_Get_Paint
|
|
1429 |
+ * to retrieve the actual paint object.
|
|
1430 |
+ *
|
|
1431 |
+ * @input:
|
|
1432 |
+ * face ::
|
|
1433 |
+ * A handle to the parent face object.
|
|
1434 |
+ *
|
|
1435 |
+ * @inout:
|
|
1436 |
+ * iterator ::
|
|
1437 |
+ * The @FT_LayerIterator from an @FT_PaintColrLayers object, for which
|
|
1438 |
+ * the layers are to be retrieved. The internal state of the iterator
|
|
1439 |
+ * is incremented after one call to this function for retrieving one
|
|
1440 |
+ * layer.
|
|
1441 |
+ *
|
|
1442 |
+ * @output:
|
|
1443 |
+ * paint ::
|
|
1444 |
+ * The @FT_OpaquePaint object that references the actual paint table.
|
|
1445 |
+ * The respective actual @FT_COLR_Paint object is retrieved via
|
|
1446 |
+ * @FT_Get_Paint.
|
|
1447 |
+ *
|
|
1448 |
+ * @return:
|
|
1449 |
+ * Value~1 if everything is OK. Value~0 gets returned when the paint
|
|
1450 |
+ * object can not be retrieved or any other error occurs.
|
|
1451 |
+ *
|
|
1452 |
+ * @since:
|
|
1453 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
1454 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
1455 |
+ *
|
|
1456 |
+ */
|
|
1457 |
+ FT_EXPORT( FT_Bool )
|
|
1458 |
+ FT_Get_Paint_Layers( FT_Face face,
|
|
1459 |
+ FT_LayerIterator* iterator,
|
|
1460 |
+ FT_OpaquePaint* paint );
|
|
1461 |
+ |
|
1462 |
+ |
|
1463 |
+ /**************************************************************************
|
|
1464 |
+ *
|
|
1465 |
+ * @function:
|
|
1466 |
+ * FT_Get_Colorline_Stops
|
|
1467 |
+ *
|
|
1468 |
+ * @description:
|
|
1469 |
+ * This is an interface to color gradient information in a 'COLR' v1
|
|
1470 |
+ * table in OpenType fonts to iteratively retrieve the gradient and
|
|
1471 |
+ * solid fill information for colored glyph layers for a specified glyph
|
|
1472 |
+ * ID.
|
|
1473 |
+ *
|
|
1474 |
+ * https://github.com/googlefonts/colr-gradients-spec
|
|
1475 |
+ *
|
|
1476 |
+ * @input:
|
|
1477 |
+ * face ::
|
|
1478 |
+ * A handle to the parent face object.
|
|
1479 |
+ *
|
|
1480 |
+ * @inout:
|
|
1481 |
+ * iterator ::
|
|
1482 |
+ * The retrieved @FT_ColorStopIterator, configured on an @FT_ColorLine,
|
|
1483 |
+ * which in turn got retrieved via paint information in
|
|
1484 |
+ * @FT_PaintLinearGradient or @FT_PaintRadialGradient.
|
|
1485 |
+ *
|
|
1486 |
+ * @output:
|
|
1487 |
+ * color_stop ::
|
|
1488 |
+ * Color index and alpha value for the retrieved color stop.
|
|
1489 |
+ *
|
|
1490 |
+ * @return:
|
|
1491 |
+ * Value~1 if everything is OK. If there are no more color stops,
|
|
1492 |
+ * value~0 gets returned. In case of an error, value~0 is returned
|
|
1493 |
+ * also.
|
|
1494 |
+ *
|
|
1495 |
+ * @since:
|
|
1496 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
1497 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
1498 |
+ *
|
|
1499 |
+ */
|
|
1500 |
+ FT_EXPORT( FT_Bool )
|
|
1501 |
+ FT_Get_Colorline_Stops( FT_Face face,
|
|
1502 |
+ FT_ColorStop* color_stop,
|
|
1503 |
+ FT_ColorStopIterator* iterator );
|
|
1504 |
+ |
|
1505 |
+ |
|
1506 |
+ /**************************************************************************
|
|
1507 |
+ *
|
|
1508 |
+ * @function:
|
|
1509 |
+ * FT_Get_Paint
|
|
1510 |
+ *
|
|
1511 |
+ * @description:
|
|
1512 |
+ * Access the details of a paint using an @FT_OpaquePaint opaque paint
|
|
1513 |
+ * object, which internally stores the offset to the respective `Paint`
|
|
1514 |
+ * object in the 'COLR' table.
|
|
1515 |
+ *
|
|
1516 |
+ * @input:
|
|
1517 |
+ * face ::
|
|
1518 |
+ * A handle to the parent face object.
|
|
1519 |
+ *
|
|
1520 |
+ * opaque_paint ::
|
|
1521 |
+ * The opaque paint object for which the underlying @FT_COLR_Paint
|
|
1522 |
+ * data is to be retrieved.
|
|
1523 |
+ *
|
|
1524 |
+ * @output:
|
|
1525 |
+ * paint ::
|
|
1526 |
+ * The specific @FT_COLR_Paint object containing information coming
|
|
1527 |
+ * from one of the font's `Paint*` tables.
|
|
1528 |
+ *
|
|
1529 |
+ * @return:
|
|
1530 |
+ * Value~1 if everything is OK. Value~0 if no details can be found for
|
|
1531 |
+ * this paint or any other error occured.
|
|
1532 |
+ *
|
|
1533 |
+ * @since:
|
|
1534 |
+ * 2.11 -- **currently experimental only!** There might be changes
|
|
1535 |
+ * without retaining backward-compatibility of both the API and ABI.
|
|
1536 |
+ *
|
|
1537 |
+ */
|
|
1538 |
+ FT_EXPORT( FT_Bool )
|
|
1539 |
+ FT_Get_Paint( FT_Face face,
|
|
1540 |
+ FT_OpaquePaint opaque_paint,
|
|
1541 |
+ FT_COLR_Paint* paint );
|
|
1542 |
+ |
|
305 | 1543 |
/* */
|
306 | 1544 |
|
307 | 1545 |
|