1use super::*;
2
3#[derive(Clone, Debug, Eq, Getter, New, PartialEq)]
5pub struct SystemFontInfo {
6 #[get(type(copy))]
8 pub(crate) backend: FontRenderBackend,
9 pub(crate) family_name: String,
11 #[get(type(copy))]
13 pub(crate) supports_unicode: bool,
14 #[get(type(copy))]
16 pub(crate) supports_antialiasing: bool,
17}
18
19#[derive(Clone, Debug, Getter)]
21pub struct NativeSystemFont {
22 pub(crate) info: SystemFontInfo,
24 #[get(type(copy))]
26 pub(crate) deterministic_only: bool,
27}
28
29#[derive(Clone, Debug, Getter, New)]
31pub struct PackedGlyphAtlas {
32 #[get(type(copy))]
34 pub(crate) width: u32,
35 #[get(type(copy))]
37 pub(crate) height: u32,
38 pub(crate) pixels: Vec<u8>,
40 pub(crate) regions: HashMap<GlyphKey, (u32, u32, u32, u32)>,
42 #[get(type(copy))]
44 pub(crate) revision: u64,
45}
46
47#[cfg(any(target_os = "macos", target_os = "ios"))]
48#[repr(C)]
49#[derive(Clone, Copy)]
50pub(crate) struct CtRange {
51 pub(crate) location: isize,
52 pub(crate) length: isize,
53}
54
55#[cfg(any(target_os = "macos", target_os = "ios"))]
56#[repr(C)]
57#[derive(Clone, Copy)]
58pub(crate) struct CtPoint {
59 pub(crate) x: f64,
60 pub(crate) y: f64,
61}
62
63#[cfg(any(target_os = "macos", target_os = "ios"))]
64#[repr(C)]
65#[derive(Clone, Copy)]
66pub(crate) struct CtSize {
67 pub(crate) width: f64,
68 pub(crate) height: f64,
69}
70
71#[cfg(any(target_os = "macos", target_os = "ios"))]
73#[derive(Clone, Copy)]
74pub(crate) struct CoreTextFontCacheEntry {
75 pub(crate) style_sig: u32,
77 pub(crate) font: *mut c_void,
79 pub(crate) ascent: f64,
81 pub(crate) descent: f64,
83}
84
85#[cfg(any(target_os = "macos", target_os = "ios"))]
87pub(crate) struct CoreTextFontCache {
88 pub(crate) gray_space: *mut c_void,
90 pub(crate) fonts: Vec<CoreTextFontCacheEntry>,
92}
93
94#[cfg(target_os = "windows")]
96#[derive(Clone, Copy)]
97pub(crate) struct Win32FontCacheEntry {
98 pub(crate) style_sig: u32,
100 pub(crate) hfont: *mut c_void,
102 pub(crate) ascent: i32,
104 pub(crate) descent: i32,
106}
107
108#[cfg(target_os = "windows")]
110pub(crate) struct Win32FontCache {
111 pub(crate) hdc: *mut c_void,
113 pub(crate) fonts: Vec<Win32FontCacheEntry>,
115 pub(crate) raw_buf: Vec<u8>,
117}
118
119#[cfg(target_os = "windows")]
120#[repr(C)]
121#[derive(Clone, Copy, Default)]
122pub(crate) struct WinFixed {
123 pub(crate) fract: u16,
124 pub(crate) value: i16,
125}
126
127#[cfg(target_os = "windows")]
128#[repr(C)]
129#[derive(Clone, Copy, Default)]
130pub(crate) struct WinMat2 {
131 pub(crate) em11: WinFixed,
132 pub(crate) em12: WinFixed,
133 pub(crate) em21: WinFixed,
134 pub(crate) em22: WinFixed,
135}
136
137#[cfg(target_os = "windows")]
138#[repr(C)]
139#[derive(Clone, Copy, Default)]
140pub(crate) struct WinGlyphMetrics {
141 pub(crate) black_box_x: u32,
142 pub(crate) black_box_y: u32,
143 pub(crate) glyph_origin_x: i32,
144 pub(crate) glyph_origin_y: i32,
145 pub(crate) cell_inc_x: i16,
146 pub(crate) cell_inc_y: i16,
147}
148
149#[cfg(target_os = "windows")]
150#[repr(C)]
151#[derive(Clone, Copy, Default)]
152pub(crate) struct WinTextMetricW {
153 pub(crate) tm_height: i32,
154 pub(crate) tm_ascent: i32,
155 pub(crate) tm_descent: i32,
156 pub(crate) tm_internal_leading: i32,
157 pub(crate) tm_external_leading: i32,
158 pub(crate) tm_ave_char_width: i32,
159 pub(crate) tm_max_char_width: i32,
160 pub(crate) tm_weight: i32,
161 pub(crate) tm_overhang: i32,
162 pub(crate) tm_digitized_aspect_x: i32,
163 pub(crate) tm_digitized_aspect_y: i32,
164 pub(crate) tm_first_char: u16,
165 pub(crate) tm_last_char: u16,
166 pub(crate) tm_default_char: u16,
167 pub(crate) tm_break_char: u16,
168 pub(crate) tm_italic: u8,
169 pub(crate) tm_underlined: u8,
170 pub(crate) tm_struck_out: u8,
171 pub(crate) tm_pitch_and_family: u8,
172 pub(crate) tm_char_set: u8,
173}
174
175#[cfg(any(target_os = "linux", target_os = "android"))]
176#[repr(C)]
177#[derive(Clone, Copy)]
178pub(crate) struct FtBitmap {
179 pub(crate) rows: u32,
180 pub(crate) width: u32,
181 pub(crate) pitch: i32,
182 pub(crate) buffer: *const u8,
183 pub(crate) num_grays: u16,
184 pub(crate) pixel_mode: u8,
185 pub(crate) palette_mode: u8,
186 pub(crate) palette: *mut c_void,
187}
188
189#[cfg(any(target_os = "linux", target_os = "android"))]
190#[repr(C)]
191#[derive(Clone, Copy)]
192pub(crate) struct FtVector {
193 pub(crate) x: isize,
194 pub(crate) y: isize,
195}
196
197#[cfg(any(target_os = "linux", target_os = "android"))]
198#[repr(C)]
199#[derive(Clone, Copy)]
200pub(crate) struct FtGeneric {
201 pub(crate) data: *mut c_void,
202 pub(crate) finalizer: *mut c_void,
203}
204
205#[cfg(any(target_os = "linux", target_os = "android"))]
206#[repr(C)]
207#[derive(Clone, Copy)]
208pub(crate) struct FtBBox {
209 pub(crate) x_min: isize,
210 pub(crate) y_min: isize,
211 pub(crate) x_max: isize,
212 pub(crate) y_max: isize,
213}
214
215#[cfg(any(target_os = "linux", target_os = "android"))]
216#[repr(C)]
217#[derive(Clone, Copy)]
218pub(crate) struct FtGlyphMetrics {
219 pub(crate) width: isize,
220 pub(crate) height: isize,
221 pub(crate) hori_bearing_x: isize,
222 pub(crate) hori_bearing_y: isize,
223 pub(crate) hori_advance: isize,
224 pub(crate) vert_bearing_x: isize,
225 pub(crate) vert_bearing_y: isize,
226 pub(crate) vert_advance: isize,
227}
228
229#[cfg(any(target_os = "linux", target_os = "android"))]
230#[repr(C)]
231#[derive(Clone, Copy)]
232pub(crate) struct FtSizeMetrics {
233 pub(crate) x_ppem: u16,
234 pub(crate) y_ppem: u16,
235 pub(crate) x_scale: isize,
236 pub(crate) y_scale: isize,
237 pub(crate) ascender: isize,
238 pub(crate) descender: isize,
239 pub(crate) height: isize,
240 pub(crate) max_advance: isize,
241}
242
243#[cfg(any(target_os = "linux", target_os = "android"))]
244#[repr(C)]
245#[derive(Clone, Copy)]
246pub(crate) struct FtSizeRec {
247 pub(crate) face: *mut c_void,
248 pub(crate) generic: FtGeneric,
249 pub(crate) metrics: FtSizeMetrics,
250 pub(crate) internal: *mut c_void,
251}
252
253#[cfg(any(target_os = "linux", target_os = "android"))]
254#[repr(C)]
255#[derive(Clone, Copy)]
256pub(crate) struct FtGlyphSlotRec {
257 pub(crate) library: *mut c_void,
258 pub(crate) face: *mut c_void,
259 pub(crate) next: *mut c_void,
260 pub(crate) glyph_index: u32,
261 pub(crate) generic: FtGeneric,
262 pub(crate) metrics: FtGlyphMetrics,
263 pub(crate) linear_hori_advance: isize,
264 pub(crate) linear_vert_advance: isize,
265 pub(crate) advance: FtVector,
266 pub(crate) format: u32,
267 pub(crate) bitmap: FtBitmap,
268 pub(crate) bitmap_left: i32,
269 pub(crate) bitmap_top: i32,
270}
271
272#[cfg(any(target_os = "linux", target_os = "android"))]
273#[repr(C)]
274#[derive(Clone, Copy)]
275pub(crate) struct FtFaceRec {
276 pub(crate) num_faces: isize,
277 pub(crate) face_index: isize,
278 pub(crate) face_flags: isize,
279 pub(crate) style_flags: isize,
280 pub(crate) num_glyphs: isize,
281 pub(crate) family_name: *const c_char,
282 pub(crate) style_name: *const c_char,
283 pub(crate) num_fixed_sizes: i32,
284 pub(crate) available_sizes: *mut c_void,
285 pub(crate) num_charmaps: i32,
286 pub(crate) charmaps: *mut c_void,
287 pub(crate) generic: FtGeneric,
288 pub(crate) bbox: FtBBox,
289 pub(crate) units_per_em: u16,
290 pub(crate) ascender: i16,
291 pub(crate) descender: i16,
292 pub(crate) height: i16,
293 pub(crate) max_advance_width: i16,
294 pub(crate) max_advance_height: i16,
295 pub(crate) underline_position: i16,
296 pub(crate) underline_thickness: i16,
297 pub(crate) glyph: *const FtGlyphSlotRec,
298 pub(crate) size: *const FtSizeRec,
299}
300
301#[cfg(any(target_os = "linux", target_os = "android"))]
302pub(crate) struct FreeTypeRuntime {
303 pub(crate) regular_face: *mut FtFaceRec,
304 pub(crate) bold_face: *mut FtFaceRec,
305 pub(crate) mono_face: *mut FtFaceRec,
306 pub(crate) mono_bold_face: *mut FtFaceRec,
307 pub(crate) cjk_face: *mut FtFaceRec,
308 pub(crate) set_pixel_sizes: FtSetPixelSizesFn,
309 pub(crate) get_char_index: FtGetCharIndexFn,
310 pub(crate) load_glyph: FtLoadGlyphFn,
311}