1//! Font types.
23use serde::{Deserialize, Serialize};
4use zng_unit::Px;
56use crate::{config::FontAntiAliasing, declare_id};
78declare_id! {
9/// Font resource in a renderer cache.
10 ///
11 /// The View Process defines the ID.
12pub struct FontFaceId(_);
1314/// Sized font in a renderer.
15 ///
16 /// The View Process defines the ID.
17pub struct FontId(_);
18}
1920/// Extra font options.
21#[derive(Default, Debug, PartialEq, Clone, Deserialize, Serialize)]
22pub struct FontOptions {
23/// Font render mode.
24 ///
25 /// Default value must be already resolved here, it falls back to Subpixel.
26pub aa: FontAntiAliasing,
2728/// If synthetic bold is enabled.
29pub synthetic_bold: bool,
30/// If synthetic skew is enabled.
31pub synthetic_oblique: bool,
32}
3334/// Extra font options send with text glyphs.
35pub type GlyphOptions = FontOptions;
3637/// Font feature name, `*b"hlig"` for example.
38pub type FontVariationName = [u8; 4];
3940/// Glyph index with position.
41#[repr(C)]
42#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
43pub struct GlyphInstance {
44/// Glyph id.
45pub index: GlyphIndex,
46/// Glyph position.
47pub point: euclid::Point2D<f32, Px>,
48}
4950/// Glyph index in a font.
51pub type GlyphIndex = u32;