1use serde::{Deserialize, Serialize};
4use zng_unit::Px;
5
6use crate::{config::FontAntiAliasing, declare_id};
7
8declare_id! {
9 pub struct FontFaceId(_);
13
14 pub struct FontId(_);
18}
19
20#[derive(Default, Debug, PartialEq, Clone, Deserialize, Serialize)]
22#[non_exhaustive]
23pub struct FontOptions {
24 pub aa: FontAntiAliasing,
28
29 pub synthetic_bold: bool,
31 pub synthetic_oblique: bool,
33}
34impl FontOptions {
35 pub fn new(aa: FontAntiAliasing, synthetic_bold: bool, synthetic_oblique: bool) -> Self {
37 Self {
38 aa,
39 synthetic_bold,
40 synthetic_oblique,
41 }
42 }
43}
44
45pub type GlyphOptions = FontOptions;
47
48pub type FontVariationName = [u8; 4];
50
51#[repr(C)]
53#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
54#[non_exhaustive]
55pub struct GlyphInstance {
56 pub index: GlyphIndex,
58 pub point: euclid::Point2D<f32, Px>,
60}
61impl GlyphInstance {
62 pub fn new(index: GlyphIndex, point: euclid::Point2D<f32, Px>) -> Self {
64 Self { index, point }
65 }
66}
67
68pub type GlyphIndex = u32;