/src/fontations/read-fonts/generated/generated_glyf.rs
Line | Count | Source (jump to first uncovered line) |
1 | | // THIS FILE IS AUTOGENERATED. |
2 | | // Any changes to this file will be overwritten. |
3 | | // For more information about how codegen works, see font-codegen/README.md |
4 | | |
5 | | #[allow(unused_imports)] |
6 | | use crate::codegen_prelude::*; |
7 | | |
8 | | /// The [glyf (Glyph Data)](https://docs.microsoft.com/en-us/typography/opentype/spec/glyf) table |
9 | | #[derive(Debug, Clone, Copy)] |
10 | | #[doc(hidden)] |
11 | | pub struct GlyfMarker {} |
12 | | |
13 | | impl GlyfMarker {} |
14 | | |
15 | | impl TopLevelTable for Glyf<'_> { |
16 | | /// `glyf` |
17 | | const TAG: Tag = Tag::new(b"glyf"); |
18 | | } |
19 | | |
20 | | impl<'a> FontRead<'a> for Glyf<'a> { |
21 | 2.17M | fn read(data: FontData<'a>) -> Result<Self, ReadError> { |
22 | 2.17M | let cursor = data.cursor(); |
23 | 2.17M | cursor.finish(GlyfMarker {}) |
24 | 2.17M | } |
25 | | } |
26 | | |
27 | | /// The [glyf (Glyph Data)](https://docs.microsoft.com/en-us/typography/opentype/spec/glyf) table |
28 | | pub type Glyf<'a> = TableRef<'a, GlyfMarker>; |
29 | | |
30 | | #[allow(clippy::needless_lifetimes)] |
31 | | impl<'a> Glyf<'a> {} |
32 | | |
33 | | #[cfg(feature = "experimental_traverse")] |
34 | | impl<'a> SomeTable<'a> for Glyf<'a> { |
35 | | fn type_name(&self) -> &str { |
36 | | "Glyf" |
37 | | } |
38 | | |
39 | | #[allow(unused_variables)] |
40 | | #[allow(clippy::match_single_binding)] |
41 | | fn get_field(&self, idx: usize) -> Option<Field<'a>> { |
42 | | match idx { |
43 | | _ => None, |
44 | | } |
45 | | } |
46 | | } |
47 | | |
48 | | #[cfg(feature = "experimental_traverse")] |
49 | | #[allow(clippy::needless_lifetimes)] |
50 | | impl<'a> std::fmt::Debug for Glyf<'a> { |
51 | | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
52 | | (self as &dyn SomeTable<'a>).fmt(f) |
53 | | } |
54 | | } |
55 | | |
56 | | /// The [Glyph Header](https://docs.microsoft.com/en-us/typography/opentype/spec/glyf#glyph-headers) |
57 | | #[derive(Debug, Clone, Copy)] |
58 | | #[doc(hidden)] |
59 | | pub struct SimpleGlyphMarker { |
60 | | end_pts_of_contours_byte_len: usize, |
61 | | instructions_byte_len: usize, |
62 | | glyph_data_byte_len: usize, |
63 | | } |
64 | | |
65 | | impl SimpleGlyphMarker { |
66 | 93.8M | pub fn number_of_contours_byte_range(&self) -> Range<usize> { |
67 | 93.8M | let start = 0; |
68 | 93.8M | start..start + i16::RAW_BYTE_LEN |
69 | 93.8M | } |
70 | | |
71 | 93.8M | pub fn x_min_byte_range(&self) -> Range<usize> { |
72 | 93.8M | let start = self.number_of_contours_byte_range().end; |
73 | 93.8M | start..start + i16::RAW_BYTE_LEN |
74 | 93.8M | } |
75 | | |
76 | 88.5M | pub fn y_min_byte_range(&self) -> Range<usize> { |
77 | 88.5M | let start = self.x_min_byte_range().end; |
78 | 88.5M | start..start + i16::RAW_BYTE_LEN |
79 | 88.5M | } |
80 | | |
81 | 83.2M | pub fn x_max_byte_range(&self) -> Range<usize> { |
82 | 83.2M | let start = self.y_min_byte_range().end; |
83 | 83.2M | start..start + i16::RAW_BYTE_LEN |
84 | 83.2M | } |
85 | | |
86 | 77.9M | pub fn y_max_byte_range(&self) -> Range<usize> { |
87 | 77.9M | let start = self.x_max_byte_range().end; |
88 | 77.9M | start..start + i16::RAW_BYTE_LEN |
89 | 77.9M | } |
90 | | |
91 | 72.6M | pub fn end_pts_of_contours_byte_range(&self) -> Range<usize> { |
92 | 72.6M | let start = self.y_max_byte_range().end; |
93 | 72.6M | start..start + self.end_pts_of_contours_byte_len |
94 | 72.6M | } |
95 | | |
96 | 35.9M | pub fn instruction_length_byte_range(&self) -> Range<usize> { |
97 | 35.9M | let start = self.end_pts_of_contours_byte_range().end; |
98 | 35.9M | start..start + u16::RAW_BYTE_LEN |
99 | 35.9M | } |
100 | | |
101 | 25.7M | pub fn instructions_byte_range(&self) -> Range<usize> { |
102 | 25.7M | let start = self.instruction_length_byte_range().end; |
103 | 25.7M | start..start + self.instructions_byte_len |
104 | 25.7M | } |
105 | | |
106 | 21.2M | pub fn glyph_data_byte_range(&self) -> Range<usize> { |
107 | 21.2M | let start = self.instructions_byte_range().end; |
108 | 21.2M | start..start + self.glyph_data_byte_len |
109 | 21.2M | } |
110 | | } |
111 | | |
112 | | impl MinByteRange for SimpleGlyphMarker { |
113 | 0 | fn min_byte_range(&self) -> Range<usize> { |
114 | 0 | 0..self.glyph_data_byte_range().end |
115 | 0 | } |
116 | | } |
117 | | |
118 | | impl<'a> FontRead<'a> for SimpleGlyph<'a> { |
119 | 33.6M | fn read(data: FontData<'a>) -> Result<Self, ReadError> { |
120 | 33.6M | let mut cursor = data.cursor(); |
121 | 33.6M | let number_of_contours: i16 = cursor.read()?; |
122 | 33.6M | cursor.advance::<i16>(); |
123 | 33.6M | cursor.advance::<i16>(); |
124 | 33.6M | cursor.advance::<i16>(); |
125 | 33.6M | cursor.advance::<i16>(); |
126 | 33.6M | let end_pts_of_contours_byte_len = (number_of_contours as usize) |
127 | 33.6M | .checked_mul(u16::RAW_BYTE_LEN) |
128 | 33.6M | .ok_or(ReadError::OutOfBounds)?; |
129 | 33.6M | cursor.advance_by(end_pts_of_contours_byte_len); |
130 | 33.6M | let instruction_length: u16 = cursor.read()?; |
131 | 14.4M | let instructions_byte_len = (instruction_length as usize) |
132 | 14.4M | .checked_mul(u8::RAW_BYTE_LEN) |
133 | 14.4M | .ok_or(ReadError::OutOfBounds)?; |
134 | 14.4M | cursor.advance_by(instructions_byte_len); |
135 | 14.4M | let glyph_data_byte_len = cursor.remaining_bytes() / u8::RAW_BYTE_LEN * u8::RAW_BYTE_LEN; |
136 | 14.4M | cursor.advance_by(glyph_data_byte_len); |
137 | 14.4M | cursor.finish(SimpleGlyphMarker { |
138 | 14.4M | end_pts_of_contours_byte_len, |
139 | 14.4M | instructions_byte_len, |
140 | 14.4M | glyph_data_byte_len, |
141 | 14.4M | }) |
142 | 33.6M | } |
143 | | } |
144 | | |
145 | | /// The [Glyph Header](https://docs.microsoft.com/en-us/typography/opentype/spec/glyf#glyph-headers) |
146 | | pub type SimpleGlyph<'a> = TableRef<'a, SimpleGlyphMarker>; |
147 | | |
148 | | #[allow(clippy::needless_lifetimes)] |
149 | | impl<'a> SimpleGlyph<'a> { |
150 | | /// If the number of contours is greater than or equal to zero, |
151 | | /// this is a simple glyph. If negative, this is a composite glyph |
152 | | /// — the value -1 should be used for composite glyphs. |
153 | 0 | pub fn number_of_contours(&self) -> i16 { |
154 | 0 | let range = self.shape.number_of_contours_byte_range(); |
155 | 0 | self.data.read_at(range.start).unwrap() |
156 | 0 | } |
157 | | |
158 | | /// Minimum x for coordinate data. |
159 | 5.30M | pub fn x_min(&self) -> i16 { |
160 | 5.30M | let range = self.shape.x_min_byte_range(); |
161 | 5.30M | self.data.read_at(range.start).unwrap() |
162 | 5.30M | } |
163 | | |
164 | | /// Minimum y for coordinate data. |
165 | 5.30M | pub fn y_min(&self) -> i16 { |
166 | 5.30M | let range = self.shape.y_min_byte_range(); |
167 | 5.30M | self.data.read_at(range.start).unwrap() |
168 | 5.30M | } |
169 | | |
170 | | /// Maximum x for coordinate data. |
171 | 5.30M | pub fn x_max(&self) -> i16 { |
172 | 5.30M | let range = self.shape.x_max_byte_range(); |
173 | 5.30M | self.data.read_at(range.start).unwrap() |
174 | 5.30M | } |
175 | | |
176 | | /// Maximum y for coordinate data. |
177 | 5.30M | pub fn y_max(&self) -> i16 { |
178 | 5.30M | let range = self.shape.y_max_byte_range(); |
179 | 5.30M | self.data.read_at(range.start).unwrap() |
180 | 5.30M | } |
181 | | |
182 | | /// Array of point indices for the last point of each contour, |
183 | | /// in increasing numeric order |
184 | 36.7M | pub fn end_pts_of_contours(&self) -> &'a [BigEndian<u16>] { |
185 | 36.7M | let range = self.shape.end_pts_of_contours_byte_range(); |
186 | 36.7M | self.data.read_array(range).unwrap() |
187 | 36.7M | } |
188 | | |
189 | | /// Total number of bytes for instructions. If instructionLength is |
190 | | /// zero, no instructions are present for this glyph, and this |
191 | | /// field is followed directly by the flags field. |
192 | 10.1M | pub fn instruction_length(&self) -> u16 { |
193 | 10.1M | let range = self.shape.instruction_length_byte_range(); |
194 | 10.1M | self.data.read_at(range.start).unwrap() |
195 | 10.1M | } |
196 | | |
197 | | /// Array of instruction byte code for the glyph. |
198 | 4.50M | pub fn instructions(&self) -> &'a [u8] { |
199 | 4.50M | let range = self.shape.instructions_byte_range(); |
200 | 4.50M | self.data.read_array(range).unwrap() |
201 | 4.50M | } |
202 | | |
203 | | /// the raw data for flags & x/y coordinates |
204 | 21.2M | pub fn glyph_data(&self) -> &'a [u8] { |
205 | 21.2M | let range = self.shape.glyph_data_byte_range(); |
206 | 21.2M | self.data.read_array(range).unwrap() |
207 | 21.2M | } |
208 | | } |
209 | | |
210 | | #[cfg(feature = "experimental_traverse")] |
211 | | impl<'a> SomeTable<'a> for SimpleGlyph<'a> { |
212 | | fn type_name(&self) -> &str { |
213 | | "SimpleGlyph" |
214 | | } |
215 | | fn get_field(&self, idx: usize) -> Option<Field<'a>> { |
216 | | match idx { |
217 | | 0usize => Some(Field::new("number_of_contours", self.number_of_contours())), |
218 | | 1usize => Some(Field::new("x_min", self.x_min())), |
219 | | 2usize => Some(Field::new("y_min", self.y_min())), |
220 | | 3usize => Some(Field::new("x_max", self.x_max())), |
221 | | 4usize => Some(Field::new("y_max", self.y_max())), |
222 | | 5usize => Some(Field::new( |
223 | | "end_pts_of_contours", |
224 | | self.end_pts_of_contours(), |
225 | | )), |
226 | | 6usize => Some(Field::new("instruction_length", self.instruction_length())), |
227 | | 7usize => Some(Field::new("instructions", self.instructions())), |
228 | | 8usize => Some(Field::new("glyph_data", self.glyph_data())), |
229 | | _ => None, |
230 | | } |
231 | | } |
232 | | } |
233 | | |
234 | | #[cfg(feature = "experimental_traverse")] |
235 | | #[allow(clippy::needless_lifetimes)] |
236 | | impl<'a> std::fmt::Debug for SimpleGlyph<'a> { |
237 | | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
238 | | (self as &dyn SomeTable<'a>).fmt(f) |
239 | | } |
240 | | } |
241 | | |
242 | | /// Flags used in [SimpleGlyph] |
243 | 0 | #[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash, bytemuck :: AnyBitPattern)] Unexecuted instantiation: read_fonts::tables::glyf::_::{closure#0} Unexecuted instantiation: read_fonts::tables::glyf::_::{closure#0}::check |
244 | | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] |
245 | | #[repr(transparent)] |
246 | | pub struct SimpleGlyphFlags { |
247 | | bits: u8, |
248 | | } |
249 | | |
250 | | impl SimpleGlyphFlags { |
251 | | /// Bit 0: If set, the point is on the curve; otherwise, it is off |
252 | | /// the curve. |
253 | | pub const ON_CURVE_POINT: Self = Self { bits: 0x01 }; |
254 | | |
255 | | /// Bit 1: If set, the corresponding x-coordinate is 1 byte long, |
256 | | /// and the sign is determined by the |
257 | | /// X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR flag. If not set, its |
258 | | /// interpretation depends on the |
259 | | /// X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR flag: If that other flag |
260 | | /// is set, the x-coordinate is the same as the previous |
261 | | /// x-coordinate, and no element is added to the xCoordinates |
262 | | /// array. If both flags are not set, the corresponding element in |
263 | | /// the xCoordinates array is two bytes and interpreted as a signed |
264 | | /// integer. See the description of the |
265 | | /// X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR flag for additional |
266 | | /// information. |
267 | | pub const X_SHORT_VECTOR: Self = Self { bits: 0x02 }; |
268 | | |
269 | | /// Bit 2: If set, the corresponding y-coordinate is 1 byte long, |
270 | | /// and the sign is determined by the |
271 | | /// Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR flag. If not set, its |
272 | | /// interpretation depends on the |
273 | | /// Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR flag: If that other flag |
274 | | /// is set, the y-coordinate is the same as the previous |
275 | | /// y-coordinate, and no element is added to the yCoordinates |
276 | | /// array. If both flags are not set, the corresponding element in |
277 | | /// the yCoordinates array is two bytes and interpreted as a signed |
278 | | /// integer. See the description of the |
279 | | /// Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR flag for additional |
280 | | /// information. |
281 | | pub const Y_SHORT_VECTOR: Self = Self { bits: 0x04 }; |
282 | | |
283 | | /// Bit 3: If set, the next byte (read as unsigned) specifies the |
284 | | /// number of additional times this flag byte is to be repeated in |
285 | | /// the logical flags array — that is, the number of additional |
286 | | /// logical flag entries inserted after this entry. (In the |
287 | | /// expanded logical array, this bit is ignored.) In this way, the |
288 | | /// number of flags listed can be smaller than the number of points |
289 | | /// in the glyph description. |
290 | | pub const REPEAT_FLAG: Self = Self { bits: 0x08 }; |
291 | | |
292 | | /// Bit 4: This flag has two meanings, depending on how the |
293 | | /// X_SHORT_VECTOR flag is set. If X_SHORT_VECTOR is set, this bit |
294 | | /// describes the sign of the value, with 1 equalling positive and |
295 | | /// 0 negative. If X_SHORT_VECTOR is not set and this bit is set, |
296 | | /// then the current x-coordinate is the same as the previous |
297 | | /// x-coordinate. If X_SHORT_VECTOR is not set and this bit is also |
298 | | /// not set, the current x-coordinate is a signed 16-bit delta |
299 | | /// vector. |
300 | | pub const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR: Self = Self { bits: 0x10 }; |
301 | | |
302 | | /// Bit 5: This flag has two meanings, depending on how the |
303 | | /// Y_SHORT_VECTOR flag is set. If Y_SHORT_VECTOR is set, this bit |
304 | | /// describes the sign of the value, with 1 equalling positive and |
305 | | /// 0 negative. If Y_SHORT_VECTOR is not set and this bit is set, |
306 | | /// then the current y-coordinate is the same as the previous |
307 | | /// y-coordinate. If Y_SHORT_VECTOR is not set and this bit is also |
308 | | /// not set, the current y-coordinate is a signed 16-bit delta |
309 | | /// vector. |
310 | | pub const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR: Self = Self { bits: 0x20 }; |
311 | | |
312 | | /// Bit 6: If set, contours in the glyph description may overlap. |
313 | | /// Use of this flag is not required in OpenType — that is, it is |
314 | | /// valid to have contours overlap without having this flag set. It |
315 | | /// may affect behaviors in some platforms, however. (See the |
316 | | /// discussion of “Overlapping contours” in Apple’s |
317 | | /// specification for details regarding behavior in Apple |
318 | | /// platforms.) When used, it must be set on the first flag byte |
319 | | /// for the glyph. See additional details below. |
320 | | pub const OVERLAP_SIMPLE: Self = Self { bits: 0x40 }; |
321 | | |
322 | | /// Bit 7: Off-curve point belongs to a cubic-Bezier segment |
323 | | /// |
324 | | /// * [Spec](https://github.com/harfbuzz/boring-expansion-spec/blob/main/glyf1-cubicOutlines.md) |
325 | | /// * [harfbuzz](https://github.com/harfbuzz/harfbuzz/blob/c1ca46e4ebb6457dfe00a5441d52a4a66134ac58/src/OT/glyf/SimpleGlyph.hh#L23) |
326 | | pub const CUBIC: Self = Self { bits: 0x80 }; |
327 | | } |
328 | | |
329 | | impl SimpleGlyphFlags { |
330 | | /// Returns an empty set of flags. |
331 | | #[inline] |
332 | 0 | pub const fn empty() -> Self { |
333 | 0 | Self { bits: 0 } |
334 | 0 | } Unexecuted instantiation: <read_fonts::tables::glyf::SimpleGlyphFlags>::empty Unexecuted instantiation: <read_fonts::tables::glyf::SimpleGlyphFlags>::empty |
335 | | |
336 | | /// Returns the set containing all flags. |
337 | | #[inline] |
338 | 3.98G | pub const fn all() -> Self { |
339 | 3.98G | Self { |
340 | 3.98G | bits: Self::ON_CURVE_POINT.bits |
341 | 3.98G | | Self::X_SHORT_VECTOR.bits |
342 | 3.98G | | Self::Y_SHORT_VECTOR.bits |
343 | 3.98G | | Self::REPEAT_FLAG.bits |
344 | 3.98G | | Self::X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR.bits |
345 | 3.98G | | Self::Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR.bits |
346 | 3.98G | | Self::OVERLAP_SIMPLE.bits |
347 | 3.98G | | Self::CUBIC.bits, |
348 | 3.98G | } |
349 | 3.98G | } <read_fonts::tables::glyf::SimpleGlyphFlags>::all Line | Count | Source | 338 | 3.97G | pub const fn all() -> Self { | 339 | 3.97G | Self { | 340 | 3.97G | bits: Self::ON_CURVE_POINT.bits | 341 | 3.97G | | Self::X_SHORT_VECTOR.bits | 342 | 3.97G | | Self::Y_SHORT_VECTOR.bits | 343 | 3.97G | | Self::REPEAT_FLAG.bits | 344 | 3.97G | | Self::X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR.bits | 345 | 3.97G | | Self::Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR.bits | 346 | 3.97G | | Self::OVERLAP_SIMPLE.bits | 347 | 3.97G | | Self::CUBIC.bits, | 348 | 3.97G | } | 349 | 3.97G | } |
<read_fonts::tables::glyf::SimpleGlyphFlags>::all Line | Count | Source | 338 | 10.6M | pub const fn all() -> Self { | 339 | 10.6M | Self { | 340 | 10.6M | bits: Self::ON_CURVE_POINT.bits | 341 | 10.6M | | Self::X_SHORT_VECTOR.bits | 342 | 10.6M | | Self::Y_SHORT_VECTOR.bits | 343 | 10.6M | | Self::REPEAT_FLAG.bits | 344 | 10.6M | | Self::X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR.bits | 345 | 10.6M | | Self::Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR.bits | 346 | 10.6M | | Self::OVERLAP_SIMPLE.bits | 347 | 10.6M | | Self::CUBIC.bits, | 348 | 10.6M | } | 349 | 10.6M | } |
Unexecuted instantiation: <read_fonts::tables::glyf::SimpleGlyphFlags>::all Unexecuted instantiation: <read_fonts::tables::glyf::SimpleGlyphFlags>::all |
350 | | |
351 | | /// Returns the raw value of the flags currently stored. |
352 | | #[inline] |
353 | 0 | pub const fn bits(&self) -> u8 { |
354 | 0 | self.bits |
355 | 0 | } Unexecuted instantiation: <read_fonts::tables::glyf::SimpleGlyphFlags>::bits Unexecuted instantiation: <read_fonts::tables::glyf::SimpleGlyphFlags>::bits Unexecuted instantiation: <read_fonts::tables::glyf::SimpleGlyphFlags>::bits |
356 | | |
357 | | /// Convert from underlying bit representation, unless that |
358 | | /// representation contains bits that do not correspond to a flag. |
359 | | #[inline] |
360 | 0 | pub const fn from_bits(bits: u8) -> Option<Self> { |
361 | 0 | if (bits & !Self::all().bits()) == 0 { |
362 | 0 | Some(Self { bits }) |
363 | | } else { |
364 | 0 | None |
365 | | } |
366 | 0 | } |
367 | | |
368 | | /// Convert from underlying bit representation, dropping any bits |
369 | | /// that do not correspond to flags. |
370 | | #[inline] |
371 | 3.98G | pub const fn from_bits_truncate(bits: u8) -> Self { |
372 | 3.98G | Self { |
373 | 3.98G | bits: bits & Self::all().bits, |
374 | 3.98G | } |
375 | 3.98G | } <read_fonts::tables::glyf::SimpleGlyphFlags>::from_bits_truncate Line | Count | Source | 371 | 3.97G | pub const fn from_bits_truncate(bits: u8) -> Self { | 372 | 3.97G | Self { | 373 | 3.97G | bits: bits & Self::all().bits, | 374 | 3.97G | } | 375 | 3.97G | } |
<read_fonts::tables::glyf::SimpleGlyphFlags>::from_bits_truncate Line | Count | Source | 371 | 10.6M | pub const fn from_bits_truncate(bits: u8) -> Self { | 372 | 10.6M | Self { | 373 | 10.6M | bits: bits & Self::all().bits, | 374 | 10.6M | } | 375 | 10.6M | } |
Unexecuted instantiation: <read_fonts::tables::glyf::SimpleGlyphFlags>::from_bits_truncate |
376 | | |
377 | | /// Returns `true` if no flags are currently stored. |
378 | | #[inline] |
379 | 0 | pub const fn is_empty(&self) -> bool { |
380 | 0 | self.bits() == Self::empty().bits() |
381 | 0 | } |
382 | | |
383 | | /// Returns `true` if there are flags common to both `self` and `other`. |
384 | | #[inline] |
385 | 0 | pub const fn intersects(&self, other: Self) -> bool { |
386 | 0 | !(Self { |
387 | 0 | bits: self.bits & other.bits, |
388 | 0 | }) |
389 | 0 | .is_empty() |
390 | 0 | } |
391 | | |
392 | | /// Returns `true` if all of the flags in `other` are contained within `self`. |
393 | | #[inline] |
394 | 7.59G | pub const fn contains(&self, other: Self) -> bool { |
395 | 7.59G | (self.bits & other.bits) == other.bits |
396 | 7.59G | } <read_fonts::tables::glyf::SimpleGlyphFlags>::contains Line | Count | Source | 394 | 7.58G | pub const fn contains(&self, other: Self) -> bool { | 395 | 7.58G | (self.bits & other.bits) == other.bits | 396 | 7.58G | } |
<read_fonts::tables::glyf::SimpleGlyphFlags>::contains Line | Count | Source | 394 | 10.6M | pub const fn contains(&self, other: Self) -> bool { | 395 | 10.6M | (self.bits & other.bits) == other.bits | 396 | 10.6M | } |
Unexecuted instantiation: <read_fonts::tables::glyf::SimpleGlyphFlags>::contains Unexecuted instantiation: <read_fonts::tables::glyf::SimpleGlyphFlags>::contains |
397 | | |
398 | | /// Inserts the specified flags in-place. |
399 | | #[inline] |
400 | 0 | pub fn insert(&mut self, other: Self) { |
401 | 0 | self.bits |= other.bits; |
402 | 0 | } |
403 | | |
404 | | /// Removes the specified flags in-place. |
405 | | #[inline] |
406 | 0 | pub fn remove(&mut self, other: Self) { |
407 | 0 | self.bits &= !other.bits; |
408 | 0 | } |
409 | | |
410 | | /// Toggles the specified flags in-place. |
411 | | #[inline] |
412 | 0 | pub fn toggle(&mut self, other: Self) { |
413 | 0 | self.bits ^= other.bits; |
414 | 0 | } |
415 | | |
416 | | /// Returns the intersection between the flags in `self` and |
417 | | /// `other`. |
418 | | /// |
419 | | /// Specifically, the returned set contains only the flags which are |
420 | | /// present in *both* `self` *and* `other`. |
421 | | /// |
422 | | /// This is equivalent to using the `&` operator (e.g. |
423 | | /// [`ops::BitAnd`]), as in `flags & other`. |
424 | | /// |
425 | | /// [`ops::BitAnd`]: https://doc.rust-lang.org/std/ops/trait.BitAnd.html |
426 | | #[inline] |
427 | | #[must_use] |
428 | 0 | pub const fn intersection(self, other: Self) -> Self { |
429 | 0 | Self { |
430 | 0 | bits: self.bits & other.bits, |
431 | 0 | } |
432 | 0 | } |
433 | | |
434 | | /// Returns the union of between the flags in `self` and `other`. |
435 | | /// |
436 | | /// Specifically, the returned set contains all flags which are |
437 | | /// present in *either* `self` *or* `other`, including any which are |
438 | | /// present in both. |
439 | | /// |
440 | | /// This is equivalent to using the `|` operator (e.g. |
441 | | /// [`ops::BitOr`]), as in `flags | other`. |
442 | | /// |
443 | | /// [`ops::BitOr`]: https://doc.rust-lang.org/std/ops/trait.BitOr.html |
444 | | #[inline] |
445 | | #[must_use] |
446 | 0 | pub const fn union(self, other: Self) -> Self { |
447 | 0 | Self { |
448 | 0 | bits: self.bits | other.bits, |
449 | 0 | } |
450 | 0 | } |
451 | | |
452 | | /// Returns the difference between the flags in `self` and `other`. |
453 | | /// |
454 | | /// Specifically, the returned set contains all flags present in |
455 | | /// `self`, except for the ones present in `other`. |
456 | | /// |
457 | | /// It is also conceptually equivalent to the "bit-clear" operation: |
458 | | /// `flags & !other` (and this syntax is also supported). |
459 | | /// |
460 | | /// This is equivalent to using the `-` operator (e.g. |
461 | | /// [`ops::Sub`]), as in `flags - other`. |
462 | | /// |
463 | | /// [`ops::Sub`]: https://doc.rust-lang.org/std/ops/trait.Sub.html |
464 | | #[inline] |
465 | | #[must_use] |
466 | 0 | pub const fn difference(self, other: Self) -> Self { |
467 | 0 | Self { |
468 | 0 | bits: self.bits & !other.bits, |
469 | 0 | } |
470 | 0 | } |
471 | | } |
472 | | |
473 | | impl std::ops::BitOr for SimpleGlyphFlags { |
474 | | type Output = Self; |
475 | | |
476 | | /// Returns the union of the two sets of flags. |
477 | | #[inline] |
478 | 0 | fn bitor(self, other: SimpleGlyphFlags) -> Self { |
479 | 0 | Self { |
480 | 0 | bits: self.bits | other.bits, |
481 | 0 | } |
482 | 0 | } Unexecuted instantiation: <read_fonts::tables::glyf::SimpleGlyphFlags as core::ops::bit::BitOr>::bitor Unexecuted instantiation: <read_fonts::tables::glyf::SimpleGlyphFlags as core::ops::bit::BitOr>::bitor |
483 | | } |
484 | | |
485 | | impl std::ops::BitOrAssign for SimpleGlyphFlags { |
486 | | /// Adds the set of flags. |
487 | | #[inline] |
488 | 0 | fn bitor_assign(&mut self, other: Self) { |
489 | 0 | self.bits |= other.bits; |
490 | 0 | } Unexecuted instantiation: <read_fonts::tables::glyf::SimpleGlyphFlags as core::ops::bit::BitOrAssign>::bitor_assign Unexecuted instantiation: <read_fonts::tables::glyf::SimpleGlyphFlags as core::ops::bit::BitOrAssign>::bitor_assign |
491 | | } |
492 | | |
493 | | impl std::ops::BitXor for SimpleGlyphFlags { |
494 | | type Output = Self; |
495 | | |
496 | | /// Returns the left flags, but with all the right flags toggled. |
497 | | #[inline] |
498 | 0 | fn bitxor(self, other: Self) -> Self { |
499 | 0 | Self { |
500 | 0 | bits: self.bits ^ other.bits, |
501 | 0 | } |
502 | 0 | } |
503 | | } |
504 | | |
505 | | impl std::ops::BitXorAssign for SimpleGlyphFlags { |
506 | | /// Toggles the set of flags. |
507 | | #[inline] |
508 | 0 | fn bitxor_assign(&mut self, other: Self) { |
509 | 0 | self.bits ^= other.bits; |
510 | 0 | } |
511 | | } |
512 | | |
513 | | impl std::ops::BitAnd for SimpleGlyphFlags { |
514 | | type Output = Self; |
515 | | |
516 | | /// Returns the intersection between the two sets of flags. |
517 | | #[inline] |
518 | 0 | fn bitand(self, other: Self) -> Self { |
519 | 0 | Self { |
520 | 0 | bits: self.bits & other.bits, |
521 | 0 | } |
522 | 0 | } Unexecuted instantiation: <read_fonts::tables::glyf::SimpleGlyphFlags as core::ops::bit::BitAnd>::bitand Unexecuted instantiation: <read_fonts::tables::glyf::SimpleGlyphFlags as core::ops::bit::BitAnd>::bitand |
523 | | } |
524 | | |
525 | | impl std::ops::BitAndAssign for SimpleGlyphFlags { |
526 | | /// Disables all flags disabled in the set. |
527 | | #[inline] |
528 | 0 | fn bitand_assign(&mut self, other: Self) { |
529 | 0 | self.bits &= other.bits; |
530 | 0 | } Unexecuted instantiation: <read_fonts::tables::glyf::SimpleGlyphFlags as core::ops::bit::BitAndAssign>::bitand_assign Unexecuted instantiation: <read_fonts::tables::glyf::SimpleGlyphFlags as core::ops::bit::BitAndAssign>::bitand_assign |
531 | | } |
532 | | |
533 | | impl std::ops::Sub for SimpleGlyphFlags { |
534 | | type Output = Self; |
535 | | |
536 | | /// Returns the set difference of the two sets of flags. |
537 | | #[inline] |
538 | 0 | fn sub(self, other: Self) -> Self { |
539 | 0 | Self { |
540 | 0 | bits: self.bits & !other.bits, |
541 | 0 | } |
542 | 0 | } |
543 | | } |
544 | | |
545 | | impl std::ops::SubAssign for SimpleGlyphFlags { |
546 | | /// Disables all flags enabled in the set. |
547 | | #[inline] |
548 | 0 | fn sub_assign(&mut self, other: Self) { |
549 | 0 | self.bits &= !other.bits; |
550 | 0 | } |
551 | | } |
552 | | |
553 | | impl std::ops::Not for SimpleGlyphFlags { |
554 | | type Output = Self; |
555 | | |
556 | | /// Returns the complement of this set of flags. |
557 | | #[inline] |
558 | 0 | fn not(self) -> Self { |
559 | 0 | Self { bits: !self.bits } & Self::all() |
560 | 0 | } Unexecuted instantiation: <read_fonts::tables::glyf::SimpleGlyphFlags as core::ops::bit::Not>::not Unexecuted instantiation: <read_fonts::tables::glyf::SimpleGlyphFlags as core::ops::bit::Not>::not |
561 | | } |
562 | | |
563 | | impl std::fmt::Debug for SimpleGlyphFlags { |
564 | 0 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
565 | 0 | let members: &[(&str, Self)] = &[ |
566 | 0 | ("ON_CURVE_POINT", Self::ON_CURVE_POINT), |
567 | 0 | ("X_SHORT_VECTOR", Self::X_SHORT_VECTOR), |
568 | 0 | ("Y_SHORT_VECTOR", Self::Y_SHORT_VECTOR), |
569 | 0 | ("REPEAT_FLAG", Self::REPEAT_FLAG), |
570 | 0 | ( |
571 | 0 | "X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR", |
572 | 0 | Self::X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR, |
573 | 0 | ), |
574 | 0 | ( |
575 | 0 | "Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR", |
576 | 0 | Self::Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR, |
577 | 0 | ), |
578 | 0 | ("OVERLAP_SIMPLE", Self::OVERLAP_SIMPLE), |
579 | 0 | ("CUBIC", Self::CUBIC), |
580 | 0 | ]; |
581 | 0 | let mut first = true; |
582 | 0 | for (name, value) in members { |
583 | 0 | if self.contains(*value) { |
584 | 0 | if !first { |
585 | 0 | f.write_str(" | ")?; |
586 | 0 | } |
587 | 0 | first = false; |
588 | 0 | f.write_str(name)?; |
589 | 0 | } |
590 | | } |
591 | 0 | if first { |
592 | 0 | f.write_str("(empty)")?; |
593 | 0 | } |
594 | 0 | Ok(()) |
595 | 0 | } |
596 | | } |
597 | | |
598 | | impl std::fmt::Binary for SimpleGlyphFlags { |
599 | 0 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
600 | 0 | std::fmt::Binary::fmt(&self.bits, f) |
601 | 0 | } |
602 | | } |
603 | | |
604 | | impl std::fmt::Octal for SimpleGlyphFlags { |
605 | 0 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
606 | 0 | std::fmt::Octal::fmt(&self.bits, f) |
607 | 0 | } |
608 | | } |
609 | | |
610 | | impl std::fmt::LowerHex for SimpleGlyphFlags { |
611 | 0 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
612 | 0 | std::fmt::LowerHex::fmt(&self.bits, f) |
613 | 0 | } |
614 | | } |
615 | | |
616 | | impl std::fmt::UpperHex for SimpleGlyphFlags { |
617 | 0 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
618 | 0 | std::fmt::UpperHex::fmt(&self.bits, f) |
619 | 0 | } |
620 | | } |
621 | | |
622 | | impl font_types::Scalar for SimpleGlyphFlags { |
623 | | type Raw = <u8 as font_types::Scalar>::Raw; |
624 | 0 | fn to_raw(self) -> Self::Raw { |
625 | 0 | self.bits().to_raw() |
626 | 0 | } |
627 | 10.6M | fn from_raw(raw: Self::Raw) -> Self { |
628 | 10.6M | let t = <u8>::from_raw(raw); |
629 | 10.6M | Self::from_bits_truncate(t) |
630 | 10.6M | } |
631 | | } |
632 | | |
633 | | #[cfg(feature = "experimental_traverse")] |
634 | | impl<'a> From<SimpleGlyphFlags> for FieldType<'a> { |
635 | | fn from(src: SimpleGlyphFlags) -> FieldType<'a> { |
636 | | src.bits().into() |
637 | | } |
638 | | } |
639 | | |
640 | | /// [CompositeGlyph](https://docs.microsoft.com/en-us/typography/opentype/spec/glyf#glyph-headers) |
641 | | #[derive(Debug, Clone, Copy)] |
642 | | #[doc(hidden)] |
643 | | pub struct CompositeGlyphMarker { |
644 | | component_data_byte_len: usize, |
645 | | } |
646 | | |
647 | | impl CompositeGlyphMarker { |
648 | 16.0M | pub fn number_of_contours_byte_range(&self) -> Range<usize> { |
649 | 16.0M | let start = 0; |
650 | 16.0M | start..start + i16::RAW_BYTE_LEN |
651 | 16.0M | } |
652 | | |
653 | 16.0M | pub fn x_min_byte_range(&self) -> Range<usize> { |
654 | 16.0M | let start = self.number_of_contours_byte_range().end; |
655 | 16.0M | start..start + i16::RAW_BYTE_LEN |
656 | 16.0M | } |
657 | | |
658 | 15.5M | pub fn y_min_byte_range(&self) -> Range<usize> { |
659 | 15.5M | let start = self.x_min_byte_range().end; |
660 | 15.5M | start..start + i16::RAW_BYTE_LEN |
661 | 15.5M | } |
662 | | |
663 | 15.0M | pub fn x_max_byte_range(&self) -> Range<usize> { |
664 | 15.0M | let start = self.y_min_byte_range().end; |
665 | 15.0M | start..start + i16::RAW_BYTE_LEN |
666 | 15.0M | } |
667 | | |
668 | 14.5M | pub fn y_max_byte_range(&self) -> Range<usize> { |
669 | 14.5M | let start = self.x_max_byte_range().end; |
670 | 14.5M | start..start + i16::RAW_BYTE_LEN |
671 | 14.5M | } |
672 | | |
673 | 14.0M | pub fn component_data_byte_range(&self) -> Range<usize> { |
674 | 14.0M | let start = self.y_max_byte_range().end; |
675 | 14.0M | start..start + self.component_data_byte_len |
676 | 14.0M | } |
677 | | } |
678 | | |
679 | | impl MinByteRange for CompositeGlyphMarker { |
680 | 0 | fn min_byte_range(&self) -> Range<usize> { |
681 | 0 | 0..self.component_data_byte_range().end |
682 | 0 | } |
683 | | } |
684 | | |
685 | | impl<'a> FontRead<'a> for CompositeGlyph<'a> { |
686 | 6.74M | fn read(data: FontData<'a>) -> Result<Self, ReadError> { |
687 | 6.74M | let mut cursor = data.cursor(); |
688 | 6.74M | cursor.advance::<i16>(); |
689 | 6.74M | cursor.advance::<i16>(); |
690 | 6.74M | cursor.advance::<i16>(); |
691 | 6.74M | cursor.advance::<i16>(); |
692 | 6.74M | cursor.advance::<i16>(); |
693 | 6.74M | let component_data_byte_len = |
694 | 6.74M | cursor.remaining_bytes() / u8::RAW_BYTE_LEN * u8::RAW_BYTE_LEN; |
695 | 6.74M | cursor.advance_by(component_data_byte_len); |
696 | 6.74M | cursor.finish(CompositeGlyphMarker { |
697 | 6.74M | component_data_byte_len, |
698 | 6.74M | }) |
699 | 6.74M | } |
700 | | } |
701 | | |
702 | | /// [CompositeGlyph](https://docs.microsoft.com/en-us/typography/opentype/spec/glyf#glyph-headers) |
703 | | pub type CompositeGlyph<'a> = TableRef<'a, CompositeGlyphMarker>; |
704 | | |
705 | | #[allow(clippy::needless_lifetimes)] |
706 | | impl<'a> CompositeGlyph<'a> { |
707 | | /// If the number of contours is greater than or equal to zero, |
708 | | /// this is a simple glyph. If negative, this is a composite glyph |
709 | | /// — the value -1 should be used for composite glyphs. |
710 | 0 | pub fn number_of_contours(&self) -> i16 { |
711 | 0 | let range = self.shape.number_of_contours_byte_range(); |
712 | 0 | self.data.read_at(range.start).unwrap() |
713 | 0 | } |
714 | | |
715 | | /// Minimum x for coordinate data. |
716 | 497k | pub fn x_min(&self) -> i16 { |
717 | 497k | let range = self.shape.x_min_byte_range(); |
718 | 497k | self.data.read_at(range.start).unwrap() |
719 | 497k | } |
720 | | |
721 | | /// Minimum y for coordinate data. |
722 | 497k | pub fn y_min(&self) -> i16 { |
723 | 497k | let range = self.shape.y_min_byte_range(); |
724 | 497k | self.data.read_at(range.start).unwrap() |
725 | 497k | } |
726 | | |
727 | | /// Maximum x for coordinate data. |
728 | 497k | pub fn x_max(&self) -> i16 { |
729 | 497k | let range = self.shape.x_max_byte_range(); |
730 | 497k | self.data.read_at(range.start).unwrap() |
731 | 497k | } |
732 | | |
733 | | /// Maximum y for coordinate data. |
734 | 497k | pub fn y_max(&self) -> i16 { |
735 | 497k | let range = self.shape.y_max_byte_range(); |
736 | 497k | self.data.read_at(range.start).unwrap() |
737 | 497k | } |
738 | | |
739 | | /// component flag |
740 | | /// glyph index of component |
741 | 14.0M | pub fn component_data(&self) -> &'a [u8] { |
742 | 14.0M | let range = self.shape.component_data_byte_range(); |
743 | 14.0M | self.data.read_array(range).unwrap() |
744 | 14.0M | } |
745 | | } |
746 | | |
747 | | #[cfg(feature = "experimental_traverse")] |
748 | | impl<'a> SomeTable<'a> for CompositeGlyph<'a> { |
749 | | fn type_name(&self) -> &str { |
750 | | "CompositeGlyph" |
751 | | } |
752 | | fn get_field(&self, idx: usize) -> Option<Field<'a>> { |
753 | | match idx { |
754 | | 0usize => Some(Field::new("number_of_contours", self.number_of_contours())), |
755 | | 1usize => Some(Field::new("x_min", self.x_min())), |
756 | | 2usize => Some(Field::new("y_min", self.y_min())), |
757 | | 3usize => Some(Field::new("x_max", self.x_max())), |
758 | | 4usize => Some(Field::new("y_max", self.y_max())), |
759 | | 5usize => Some(Field::new("component_data", self.component_data())), |
760 | | _ => None, |
761 | | } |
762 | | } |
763 | | } |
764 | | |
765 | | #[cfg(feature = "experimental_traverse")] |
766 | | #[allow(clippy::needless_lifetimes)] |
767 | | impl<'a> std::fmt::Debug for CompositeGlyph<'a> { |
768 | | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
769 | | (self as &dyn SomeTable<'a>).fmt(f) |
770 | | } |
771 | | } |
772 | | |
773 | | /// Flags used in [CompositeGlyph] |
774 | 0 | #[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash, bytemuck :: AnyBitPattern)] Unexecuted instantiation: read_fonts::tables::glyf::_::{closure#0} Unexecuted instantiation: read_fonts::tables::glyf::_::{closure#0}::check |
775 | | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] |
776 | | #[repr(transparent)] |
777 | | pub struct CompositeGlyphFlags { |
778 | | bits: u16, |
779 | | } |
780 | | |
781 | | impl CompositeGlyphFlags { |
782 | | /// Bit 0: If this is set, the arguments are 16-bit (uint16 or |
783 | | /// int16); otherwise, they are bytes (uint8 or int8). |
784 | | pub const ARG_1_AND_2_ARE_WORDS: Self = Self { bits: 0x0001 }; |
785 | | |
786 | | /// Bit 1: If this is set, the arguments are signed xy values, |
787 | | /// otherwise, they are unsigned point numbers. |
788 | | pub const ARGS_ARE_XY_VALUES: Self = Self { bits: 0x0002 }; |
789 | | |
790 | | /// Bit 2: If set and ARGS_ARE_XY_VALUES is also set, the xy values |
791 | | /// are rounded to the nearest grid line. Ignored if |
792 | | /// ARGS_ARE_XY_VALUES is not set. |
793 | | pub const ROUND_XY_TO_GRID: Self = Self { bits: 0x0004 }; |
794 | | |
795 | | /// Bit 3: This indicates that there is a simple scale for the |
796 | | /// component. Otherwise, scale = 1.0. |
797 | | pub const WE_HAVE_A_SCALE: Self = Self { bits: 0x0008 }; |
798 | | |
799 | | /// Bit 5: Indicates at least one more glyph after this one. |
800 | | pub const MORE_COMPONENTS: Self = Self { bits: 0x0020 }; |
801 | | |
802 | | /// Bit 6: The x direction will use a different scale from the y |
803 | | /// direction. |
804 | | pub const WE_HAVE_AN_X_AND_Y_SCALE: Self = Self { bits: 0x0040 }; |
805 | | |
806 | | /// Bit 7: There is a 2 by 2 transformation that will be used to |
807 | | /// scale the component. |
808 | | pub const WE_HAVE_A_TWO_BY_TWO: Self = Self { bits: 0x0080 }; |
809 | | |
810 | | /// Bit 8: Following the last component are instructions for the |
811 | | /// composite character. |
812 | | pub const WE_HAVE_INSTRUCTIONS: Self = Self { bits: 0x0100 }; |
813 | | |
814 | | /// Bit 9: If set, this forces the aw and lsb (and rsb) for the |
815 | | /// composite to be equal to those from this component glyph. This |
816 | | /// works for hinted and unhinted glyphs. |
817 | | pub const USE_MY_METRICS: Self = Self { bits: 0x0200 }; |
818 | | |
819 | | /// Bit 10: If set, the components of the compound glyph overlap. |
820 | | /// Use of this flag is not required in OpenType — that is, it is |
821 | | /// valid to have components overlap without having this flag set. |
822 | | /// It may affect behaviors in some platforms, however. (See |
823 | | /// Apple’s specification for details regarding behavior in Apple |
824 | | /// platforms.) When used, it must be set on the flag word for the |
825 | | /// first component. See additional remarks, above, for the similar |
826 | | /// OVERLAP_SIMPLE flag used in simple-glyph descriptions. |
827 | | pub const OVERLAP_COMPOUND: Self = Self { bits: 0x0400 }; |
828 | | |
829 | | /// Bit 11: The composite is designed to have the component offset |
830 | | /// scaled. Ignored if ARGS_ARE_XY_VALUES is not set. |
831 | | pub const SCALED_COMPONENT_OFFSET: Self = Self { bits: 0x0800 }; |
832 | | |
833 | | /// Bit 12: The composite is designed not to have the component |
834 | | /// offset scaled. Ignored if ARGS_ARE_XY_VALUES is not set. |
835 | | pub const UNSCALED_COMPONENT_OFFSET: Self = Self { bits: 0x1000 }; |
836 | | } |
837 | | |
838 | | impl CompositeGlyphFlags { |
839 | | /// Returns an empty set of flags. |
840 | | #[inline] |
841 | 14.8M | pub const fn empty() -> Self { |
842 | 14.8M | Self { bits: 0 } |
843 | 14.8M | } <read_fonts::tables::glyf::CompositeGlyphFlags>::empty Line | Count | Source | 841 | 778k | pub const fn empty() -> Self { | 842 | 778k | Self { bits: 0 } | 843 | 778k | } |
<read_fonts::tables::glyf::CompositeGlyphFlags>::empty Line | Count | Source | 841 | 14.0M | pub const fn empty() -> Self { | 842 | 14.0M | Self { bits: 0 } | 843 | 14.0M | } |
Unexecuted instantiation: <read_fonts::tables::glyf::CompositeGlyphFlags>::empty |
844 | | |
845 | | /// Returns the set containing all flags. |
846 | | #[inline] |
847 | 20.3M | pub const fn all() -> Self { |
848 | 20.3M | Self { |
849 | 20.3M | bits: Self::ARG_1_AND_2_ARE_WORDS.bits |
850 | 20.3M | | Self::ARGS_ARE_XY_VALUES.bits |
851 | 20.3M | | Self::ROUND_XY_TO_GRID.bits |
852 | 20.3M | | Self::WE_HAVE_A_SCALE.bits |
853 | 20.3M | | Self::MORE_COMPONENTS.bits |
854 | 20.3M | | Self::WE_HAVE_AN_X_AND_Y_SCALE.bits |
855 | 20.3M | | Self::WE_HAVE_A_TWO_BY_TWO.bits |
856 | 20.3M | | Self::WE_HAVE_INSTRUCTIONS.bits |
857 | 20.3M | | Self::USE_MY_METRICS.bits |
858 | 20.3M | | Self::OVERLAP_COMPOUND.bits |
859 | 20.3M | | Self::SCALED_COMPONENT_OFFSET.bits |
860 | 20.3M | | Self::UNSCALED_COMPONENT_OFFSET.bits, |
861 | 20.3M | } |
862 | 20.3M | } <read_fonts::tables::glyf::CompositeGlyphFlags>::all Line | Count | Source | 847 | 20.3M | pub const fn all() -> Self { | 848 | 20.3M | Self { | 849 | 20.3M | bits: Self::ARG_1_AND_2_ARE_WORDS.bits | 850 | 20.3M | | Self::ARGS_ARE_XY_VALUES.bits | 851 | 20.3M | | Self::ROUND_XY_TO_GRID.bits | 852 | 20.3M | | Self::WE_HAVE_A_SCALE.bits | 853 | 20.3M | | Self::MORE_COMPONENTS.bits | 854 | 20.3M | | Self::WE_HAVE_AN_X_AND_Y_SCALE.bits | 855 | 20.3M | | Self::WE_HAVE_A_TWO_BY_TWO.bits | 856 | 20.3M | | Self::WE_HAVE_INSTRUCTIONS.bits | 857 | 20.3M | | Self::USE_MY_METRICS.bits | 858 | 20.3M | | Self::OVERLAP_COMPOUND.bits | 859 | 20.3M | | Self::SCALED_COMPONENT_OFFSET.bits | 860 | 20.3M | | Self::UNSCALED_COMPONENT_OFFSET.bits, | 861 | 20.3M | } | 862 | 20.3M | } |
Unexecuted instantiation: <read_fonts::tables::glyf::CompositeGlyphFlags>::all |
863 | | |
864 | | /// Returns the raw value of the flags currently stored. |
865 | | #[inline] |
866 | 1.55M | pub const fn bits(&self) -> u16 { |
867 | 1.55M | self.bits |
868 | 1.55M | } <read_fonts::tables::glyf::CompositeGlyphFlags>::bits Line | Count | Source | 866 | 1.55M | pub const fn bits(&self) -> u16 { | 867 | 1.55M | self.bits | 868 | 1.55M | } |
Unexecuted instantiation: <read_fonts::tables::glyf::CompositeGlyphFlags>::bits Unexecuted instantiation: <read_fonts::tables::glyf::CompositeGlyphFlags>::bits Unexecuted instantiation: <read_fonts::tables::glyf::CompositeGlyphFlags>::bits |
869 | | |
870 | | /// Convert from underlying bit representation, unless that |
871 | | /// representation contains bits that do not correspond to a flag. |
872 | | #[inline] |
873 | 0 | pub const fn from_bits(bits: u16) -> Option<Self> { |
874 | 0 | if (bits & !Self::all().bits()) == 0 { |
875 | 0 | Some(Self { bits }) |
876 | | } else { |
877 | 0 | None |
878 | | } |
879 | 0 | } |
880 | | |
881 | | /// Convert from underlying bit representation, dropping any bits |
882 | | /// that do not correspond to flags. |
883 | | #[inline] |
884 | 20.3M | pub const fn from_bits_truncate(bits: u16) -> Self { |
885 | 20.3M | Self { |
886 | 20.3M | bits: bits & Self::all().bits, |
887 | 20.3M | } |
888 | 20.3M | } <read_fonts::tables::glyf::CompositeGlyphFlags>::from_bits_truncate Line | Count | Source | 884 | 20.3M | pub const fn from_bits_truncate(bits: u16) -> Self { | 885 | 20.3M | Self { | 886 | 20.3M | bits: bits & Self::all().bits, | 887 | 20.3M | } | 888 | 20.3M | } |
Unexecuted instantiation: <read_fonts::tables::glyf::CompositeGlyphFlags>::from_bits_truncate |
889 | | |
890 | | /// Returns `true` if no flags are currently stored. |
891 | | #[inline] |
892 | 778k | pub const fn is_empty(&self) -> bool { |
893 | 778k | self.bits() == Self::empty().bits() |
894 | 778k | } <read_fonts::tables::glyf::CompositeGlyphFlags>::is_empty Line | Count | Source | 892 | 778k | pub const fn is_empty(&self) -> bool { | 893 | 778k | self.bits() == Self::empty().bits() | 894 | 778k | } |
Unexecuted instantiation: <read_fonts::tables::glyf::CompositeGlyphFlags>::is_empty |
895 | | |
896 | | /// Returns `true` if there are flags common to both `self` and `other`. |
897 | | #[inline] |
898 | 778k | pub const fn intersects(&self, other: Self) -> bool { |
899 | 778k | !(Self { |
900 | 778k | bits: self.bits & other.bits, |
901 | 778k | }) |
902 | 778k | .is_empty() |
903 | 778k | } <read_fonts::tables::glyf::CompositeGlyphFlags>::intersects Line | Count | Source | 898 | 778k | pub const fn intersects(&self, other: Self) -> bool { | 899 | 778k | !(Self { | 900 | 778k | bits: self.bits & other.bits, | 901 | 778k | }) | 902 | 778k | .is_empty() | 903 | 778k | } |
Unexecuted instantiation: <read_fonts::tables::glyf::CompositeGlyphFlags>::intersects |
904 | | |
905 | | /// Returns `true` if all of the flags in `other` are contained within `self`. |
906 | | #[inline] |
907 | 105M | pub const fn contains(&self, other: Self) -> bool { |
908 | 105M | (self.bits & other.bits) == other.bits |
909 | 105M | } <read_fonts::tables::glyf::CompositeGlyphFlags>::contains Line | Count | Source | 907 | 8.84M | pub const fn contains(&self, other: Self) -> bool { | 908 | 8.84M | (self.bits & other.bits) == other.bits | 909 | 8.84M | } |
<read_fonts::tables::glyf::CompositeGlyphFlags>::contains Line | Count | Source | 907 | 97.0M | pub const fn contains(&self, other: Self) -> bool { | 908 | 97.0M | (self.bits & other.bits) == other.bits | 909 | 97.0M | } |
Unexecuted instantiation: <read_fonts::tables::glyf::CompositeGlyphFlags>::contains Unexecuted instantiation: <read_fonts::tables::glyf::CompositeGlyphFlags>::contains |
910 | | |
911 | | /// Inserts the specified flags in-place. |
912 | | #[inline] |
913 | 0 | pub fn insert(&mut self, other: Self) { |
914 | 0 | self.bits |= other.bits; |
915 | 0 | } Unexecuted instantiation: <read_fonts::tables::glyf::CompositeGlyphFlags>::insert Unexecuted instantiation: <read_fonts::tables::glyf::CompositeGlyphFlags>::insert |
916 | | |
917 | | /// Removes the specified flags in-place. |
918 | | #[inline] |
919 | 0 | pub fn remove(&mut self, other: Self) { |
920 | 0 | self.bits &= !other.bits; |
921 | 0 | } Unexecuted instantiation: <read_fonts::tables::glyf::CompositeGlyphFlags>::remove Unexecuted instantiation: <read_fonts::tables::glyf::CompositeGlyphFlags>::remove |
922 | | |
923 | | /// Toggles the specified flags in-place. |
924 | | #[inline] |
925 | 0 | pub fn toggle(&mut self, other: Self) { |
926 | 0 | self.bits ^= other.bits; |
927 | 0 | } |
928 | | |
929 | | /// Returns the intersection between the flags in `self` and |
930 | | /// `other`. |
931 | | /// |
932 | | /// Specifically, the returned set contains only the flags which are |
933 | | /// present in *both* `self` *and* `other`. |
934 | | /// |
935 | | /// This is equivalent to using the `&` operator (e.g. |
936 | | /// [`ops::BitAnd`]), as in `flags & other`. |
937 | | /// |
938 | | /// [`ops::BitAnd`]: https://doc.rust-lang.org/std/ops/trait.BitAnd.html |
939 | | #[inline] |
940 | | #[must_use] |
941 | 0 | pub const fn intersection(self, other: Self) -> Self { |
942 | 0 | Self { |
943 | 0 | bits: self.bits & other.bits, |
944 | 0 | } |
945 | 0 | } |
946 | | |
947 | | /// Returns the union of between the flags in `self` and `other`. |
948 | | /// |
949 | | /// Specifically, the returned set contains all flags which are |
950 | | /// present in *either* `self` *or* `other`, including any which are |
951 | | /// present in both. |
952 | | /// |
953 | | /// This is equivalent to using the `|` operator (e.g. |
954 | | /// [`ops::BitOr`]), as in `flags | other`. |
955 | | /// |
956 | | /// [`ops::BitOr`]: https://doc.rust-lang.org/std/ops/trait.BitOr.html |
957 | | #[inline] |
958 | | #[must_use] |
959 | 0 | pub const fn union(self, other: Self) -> Self { |
960 | 0 | Self { |
961 | 0 | bits: self.bits | other.bits, |
962 | 0 | } |
963 | 0 | } |
964 | | |
965 | | /// Returns the difference between the flags in `self` and `other`. |
966 | | /// |
967 | | /// Specifically, the returned set contains all flags present in |
968 | | /// `self`, except for the ones present in `other`. |
969 | | /// |
970 | | /// It is also conceptually equivalent to the "bit-clear" operation: |
971 | | /// `flags & !other` (and this syntax is also supported). |
972 | | /// |
973 | | /// This is equivalent to using the `-` operator (e.g. |
974 | | /// [`ops::Sub`]), as in `flags - other`. |
975 | | /// |
976 | | /// [`ops::Sub`]: https://doc.rust-lang.org/std/ops/trait.Sub.html |
977 | | #[inline] |
978 | | #[must_use] |
979 | 0 | pub const fn difference(self, other: Self) -> Self { |
980 | 0 | Self { |
981 | 0 | bits: self.bits & !other.bits, |
982 | 0 | } |
983 | 0 | } |
984 | | } |
985 | | |
986 | | impl std::ops::BitOr for CompositeGlyphFlags { |
987 | | type Output = Self; |
988 | | |
989 | | /// Returns the union of the two sets of flags. |
990 | | #[inline] |
991 | 1.58M | fn bitor(self, other: CompositeGlyphFlags) -> Self { |
992 | 1.58M | Self { |
993 | 1.58M | bits: self.bits | other.bits, |
994 | 1.58M | } |
995 | 1.58M | } <read_fonts::tables::glyf::CompositeGlyphFlags as core::ops::bit::BitOr>::bitor Line | Count | Source | 991 | 1.58M | fn bitor(self, other: CompositeGlyphFlags) -> Self { | 992 | 1.58M | Self { | 993 | 1.58M | bits: self.bits | other.bits, | 994 | 1.58M | } | 995 | 1.58M | } |
Unexecuted instantiation: <read_fonts::tables::glyf::CompositeGlyphFlags as core::ops::bit::BitOr>::bitor Unexecuted instantiation: <read_fonts::tables::glyf::CompositeGlyphFlags as core::ops::bit::BitOr>::bitor |
996 | | } |
997 | | |
998 | | impl std::ops::BitOrAssign for CompositeGlyphFlags { |
999 | | /// Adds the set of flags. |
1000 | | #[inline] |
1001 | 0 | fn bitor_assign(&mut self, other: Self) { |
1002 | 0 | self.bits |= other.bits; |
1003 | 0 | } |
1004 | | } |
1005 | | |
1006 | | impl std::ops::BitXor for CompositeGlyphFlags { |
1007 | | type Output = Self; |
1008 | | |
1009 | | /// Returns the left flags, but with all the right flags toggled. |
1010 | | #[inline] |
1011 | 0 | fn bitxor(self, other: Self) -> Self { |
1012 | 0 | Self { |
1013 | 0 | bits: self.bits ^ other.bits, |
1014 | 0 | } |
1015 | 0 | } |
1016 | | } |
1017 | | |
1018 | | impl std::ops::BitXorAssign for CompositeGlyphFlags { |
1019 | | /// Toggles the set of flags. |
1020 | | #[inline] |
1021 | 0 | fn bitxor_assign(&mut self, other: Self) { |
1022 | 0 | self.bits ^= other.bits; |
1023 | 0 | } |
1024 | | } |
1025 | | |
1026 | | impl std::ops::BitAnd for CompositeGlyphFlags { |
1027 | | type Output = Self; |
1028 | | |
1029 | | /// Returns the intersection between the two sets of flags. |
1030 | | #[inline] |
1031 | 31.5k | fn bitand(self, other: Self) -> Self { |
1032 | 31.5k | Self { |
1033 | 31.5k | bits: self.bits & other.bits, |
1034 | 31.5k | } |
1035 | 31.5k | } <read_fonts::tables::glyf::CompositeGlyphFlags as core::ops::bit::BitAnd>::bitand Line | Count | Source | 1031 | 31.5k | fn bitand(self, other: Self) -> Self { | 1032 | 31.5k | Self { | 1033 | 31.5k | bits: self.bits & other.bits, | 1034 | 31.5k | } | 1035 | 31.5k | } |
Unexecuted instantiation: <read_fonts::tables::glyf::CompositeGlyphFlags as core::ops::bit::BitAnd>::bitand |
1036 | | } |
1037 | | |
1038 | | impl std::ops::BitAndAssign for CompositeGlyphFlags { |
1039 | | /// Disables all flags disabled in the set. |
1040 | | #[inline] |
1041 | 0 | fn bitand_assign(&mut self, other: Self) { |
1042 | 0 | self.bits &= other.bits; |
1043 | 0 | } |
1044 | | } |
1045 | | |
1046 | | impl std::ops::Sub for CompositeGlyphFlags { |
1047 | | type Output = Self; |
1048 | | |
1049 | | /// Returns the set difference of the two sets of flags. |
1050 | | #[inline] |
1051 | 0 | fn sub(self, other: Self) -> Self { |
1052 | 0 | Self { |
1053 | 0 | bits: self.bits & !other.bits, |
1054 | 0 | } |
1055 | 0 | } |
1056 | | } |
1057 | | |
1058 | | impl std::ops::SubAssign for CompositeGlyphFlags { |
1059 | | /// Disables all flags enabled in the set. |
1060 | | #[inline] |
1061 | 0 | fn sub_assign(&mut self, other: Self) { |
1062 | 0 | self.bits &= !other.bits; |
1063 | 0 | } |
1064 | | } |
1065 | | |
1066 | | impl std::ops::Not for CompositeGlyphFlags { |
1067 | | type Output = Self; |
1068 | | |
1069 | | /// Returns the complement of this set of flags. |
1070 | | #[inline] |
1071 | 0 | fn not(self) -> Self { |
1072 | 0 | Self { bits: !self.bits } & Self::all() |
1073 | 0 | } |
1074 | | } |
1075 | | |
1076 | | impl std::fmt::Debug for CompositeGlyphFlags { |
1077 | 0 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
1078 | 0 | let members: &[(&str, Self)] = &[ |
1079 | 0 | ("ARG_1_AND_2_ARE_WORDS", Self::ARG_1_AND_2_ARE_WORDS), |
1080 | 0 | ("ARGS_ARE_XY_VALUES", Self::ARGS_ARE_XY_VALUES), |
1081 | 0 | ("ROUND_XY_TO_GRID", Self::ROUND_XY_TO_GRID), |
1082 | 0 | ("WE_HAVE_A_SCALE", Self::WE_HAVE_A_SCALE), |
1083 | 0 | ("MORE_COMPONENTS", Self::MORE_COMPONENTS), |
1084 | 0 | ("WE_HAVE_AN_X_AND_Y_SCALE", Self::WE_HAVE_AN_X_AND_Y_SCALE), |
1085 | 0 | ("WE_HAVE_A_TWO_BY_TWO", Self::WE_HAVE_A_TWO_BY_TWO), |
1086 | 0 | ("WE_HAVE_INSTRUCTIONS", Self::WE_HAVE_INSTRUCTIONS), |
1087 | 0 | ("USE_MY_METRICS", Self::USE_MY_METRICS), |
1088 | 0 | ("OVERLAP_COMPOUND", Self::OVERLAP_COMPOUND), |
1089 | 0 | ("SCALED_COMPONENT_OFFSET", Self::SCALED_COMPONENT_OFFSET), |
1090 | 0 | ("UNSCALED_COMPONENT_OFFSET", Self::UNSCALED_COMPONENT_OFFSET), |
1091 | 0 | ]; |
1092 | 0 | let mut first = true; |
1093 | 0 | for (name, value) in members { |
1094 | 0 | if self.contains(*value) { |
1095 | 0 | if !first { |
1096 | 0 | f.write_str(" | ")?; |
1097 | 0 | } |
1098 | 0 | first = false; |
1099 | 0 | f.write_str(name)?; |
1100 | 0 | } |
1101 | | } |
1102 | 0 | if first { |
1103 | 0 | f.write_str("(empty)")?; |
1104 | 0 | } |
1105 | 0 | Ok(()) |
1106 | 0 | } |
1107 | | } |
1108 | | |
1109 | | impl std::fmt::Binary for CompositeGlyphFlags { |
1110 | 0 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
1111 | 0 | std::fmt::Binary::fmt(&self.bits, f) |
1112 | 0 | } |
1113 | | } |
1114 | | |
1115 | | impl std::fmt::Octal for CompositeGlyphFlags { |
1116 | 0 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
1117 | 0 | std::fmt::Octal::fmt(&self.bits, f) |
1118 | 0 | } |
1119 | | } |
1120 | | |
1121 | | impl std::fmt::LowerHex for CompositeGlyphFlags { |
1122 | 0 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
1123 | 0 | std::fmt::LowerHex::fmt(&self.bits, f) |
1124 | 0 | } |
1125 | | } |
1126 | | |
1127 | | impl std::fmt::UpperHex for CompositeGlyphFlags { |
1128 | 0 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
1129 | 0 | std::fmt::UpperHex::fmt(&self.bits, f) |
1130 | 0 | } |
1131 | | } |
1132 | | |
1133 | | impl font_types::Scalar for CompositeGlyphFlags { |
1134 | | type Raw = <u16 as font_types::Scalar>::Raw; |
1135 | 0 | fn to_raw(self) -> Self::Raw { |
1136 | 0 | self.bits().to_raw() |
1137 | 0 | } |
1138 | 20.3M | fn from_raw(raw: Self::Raw) -> Self { |
1139 | 20.3M | let t = <u16>::from_raw(raw); |
1140 | 20.3M | Self::from_bits_truncate(t) |
1141 | 20.3M | } |
1142 | | } |
1143 | | |
1144 | | #[cfg(feature = "experimental_traverse")] |
1145 | | impl<'a> From<CompositeGlyphFlags> for FieldType<'a> { |
1146 | | fn from(src: CompositeGlyphFlags) -> FieldType<'a> { |
1147 | | src.bits().into() |
1148 | | } |
1149 | | } |
1150 | | |
1151 | | /// Simple or composite glyph. |
1152 | | #[derive(Clone)] |
1153 | | pub enum Glyph<'a> { |
1154 | | Simple(SimpleGlyph<'a>), |
1155 | | Composite(CompositeGlyph<'a>), |
1156 | | } |
1157 | | |
1158 | | impl<'a> Glyph<'a> { |
1159 | | ///Return the `FontData` used to resolve offsets for this table. |
1160 | 0 | pub fn offset_data(&self) -> FontData<'a> { |
1161 | 0 | match self { |
1162 | 0 | Self::Simple(item) => item.offset_data(), |
1163 | 0 | Self::Composite(item) => item.offset_data(), |
1164 | | } |
1165 | 0 | } |
1166 | | |
1167 | | /// If the number of contours is greater than or equal to zero, |
1168 | | /// this is a simple glyph. If negative, this is a composite glyph |
1169 | | /// — the value -1 should be used for composite glyphs. |
1170 | 0 | pub fn number_of_contours(&self) -> i16 { |
1171 | 0 | match self { |
1172 | 0 | Self::Simple(item) => item.number_of_contours(), |
1173 | 0 | Self::Composite(item) => item.number_of_contours(), |
1174 | | } |
1175 | 0 | } |
1176 | | |
1177 | | /// Minimum x for coordinate data. |
1178 | 5.80M | pub fn x_min(&self) -> i16 { |
1179 | 5.80M | match self { |
1180 | 5.30M | Self::Simple(item) => item.x_min(), |
1181 | 497k | Self::Composite(item) => item.x_min(), |
1182 | | } |
1183 | 5.80M | } |
1184 | | |
1185 | | /// Minimum y for coordinate data. |
1186 | 5.80M | pub fn y_min(&self) -> i16 { |
1187 | 5.80M | match self { |
1188 | 5.30M | Self::Simple(item) => item.y_min(), |
1189 | 497k | Self::Composite(item) => item.y_min(), |
1190 | | } |
1191 | 5.80M | } |
1192 | | |
1193 | | /// Maximum x for coordinate data. |
1194 | 5.80M | pub fn x_max(&self) -> i16 { |
1195 | 5.80M | match self { |
1196 | 5.30M | Self::Simple(item) => item.x_max(), |
1197 | 497k | Self::Composite(item) => item.x_max(), |
1198 | | } |
1199 | 5.80M | } |
1200 | | |
1201 | | /// Maximum y for coordinate data. |
1202 | 5.80M | pub fn y_max(&self) -> i16 { |
1203 | 5.80M | match self { |
1204 | 5.30M | Self::Simple(item) => item.y_max(), |
1205 | 497k | Self::Composite(item) => item.y_max(), |
1206 | | } |
1207 | 5.80M | } |
1208 | | } |
1209 | | |
1210 | | impl<'a> FontRead<'a> for Glyph<'a> { |
1211 | 40.4M | fn read(data: FontData<'a>) -> Result<Self, ReadError> { |
1212 | 40.4M | let format: i16 = data.read_at(0usize)?; |
1213 | | |
1214 | | #[allow(clippy::redundant_guards)] |
1215 | 40.4M | match format { |
1216 | 40.4M | format if format >= 0 => Ok(Self::Simple(FontRead::read(data)?)), |
1217 | 6.74M | format if format < 0 => Ok(Self::Composite(FontRead::read(data)?)), |
1218 | 0 | other => Err(ReadError::InvalidFormat(other.into())), |
1219 | | } |
1220 | 40.4M | } |
1221 | | } |
1222 | | |
1223 | | impl MinByteRange for Glyph<'_> { |
1224 | 0 | fn min_byte_range(&self) -> Range<usize> { |
1225 | 0 | match self { |
1226 | 0 | Self::Simple(item) => item.min_byte_range(), |
1227 | 0 | Self::Composite(item) => item.min_byte_range(), |
1228 | | } |
1229 | 0 | } |
1230 | | } |
1231 | | |
1232 | | #[cfg(feature = "experimental_traverse")] |
1233 | | impl<'a> Glyph<'a> { |
1234 | | fn dyn_inner<'b>(&'b self) -> &'b dyn SomeTable<'a> { |
1235 | | match self { |
1236 | | Self::Simple(table) => table, |
1237 | | Self::Composite(table) => table, |
1238 | | } |
1239 | | } |
1240 | | } |
1241 | | |
1242 | | #[cfg(feature = "experimental_traverse")] |
1243 | | impl std::fmt::Debug for Glyph<'_> { |
1244 | | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
1245 | | self.dyn_inner().fmt(f) |
1246 | | } |
1247 | | } |
1248 | | |
1249 | | #[cfg(feature = "experimental_traverse")] |
1250 | | impl<'a> SomeTable<'a> for Glyph<'a> { |
1251 | | fn type_name(&self) -> &str { |
1252 | | self.dyn_inner().type_name() |
1253 | | } |
1254 | | fn get_field(&self, idx: usize) -> Option<Field<'a>> { |
1255 | | self.dyn_inner().get_field(idx) |
1256 | | } |
1257 | | } |