/rust/registry/src/index.crates.io-1949cf8c6b5b557f/read-fonts-0.47.0/generated/generated_dsig.rs
Line | Count | Source |
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 | | impl<'a> MinByteRange<'a> for Dsig<'a> { |
9 | 0 | fn min_byte_range(&self) -> Range<usize> { |
10 | 0 | 0..self.signature_records_byte_range().end |
11 | 0 | } |
12 | 0 | fn min_table_bytes(&self) -> &'a [u8] { |
13 | 0 | let range = self.min_byte_range(); |
14 | 0 | self.offset_data().as_bytes().get(range).unwrap_or_default() |
15 | 0 | } |
16 | | } |
17 | | |
18 | | impl TopLevelTable for Dsig<'_> { |
19 | | /// `DSIG` |
20 | | const TAG: Tag = Tag::new(b"DSIG"); |
21 | | } |
22 | | |
23 | | impl ReadArgs for Dsig<'_> { |
24 | | type Args = (); |
25 | | } |
26 | | |
27 | | impl<'a> FontRead<'a> for Dsig<'a> { |
28 | 0 | fn read_with_args(data: FontData<'a>, _: ()) -> Result<Self, ReadError> { |
29 | | #[allow(clippy::absurd_extreme_comparisons)] |
30 | 0 | if data.len() < Self::MIN_SIZE { |
31 | 0 | return Err(ReadError::OutOfBounds); |
32 | 0 | } |
33 | 0 | let Some(data) = TableDataRef::new(data.as_bytes()) else { |
34 | 0 | return Err(ReadError::OutOfBounds); |
35 | | }; |
36 | 0 | Ok(Self { data }) |
37 | 0 | } |
38 | | } |
39 | | |
40 | | /// The fields at the start of the table, which are read directly. |
41 | | #[derive(Clone, Copy, bytemuck :: AnyBitPattern)] |
42 | | #[repr(C, packed)] |
43 | | #[doc(hidden)] |
44 | | pub struct DsigFixedHeader { |
45 | | pub version: BigEndian<u32>, |
46 | | pub num_signatures: BigEndian<u16>, |
47 | | pub flags: BigEndian<PermissionFlags>, |
48 | | } |
49 | | |
50 | | #[allow(clippy::absurd_extreme_comparisons)] |
51 | | const _: () = assert!(std::mem::size_of::<DsigFixedHeader>() <= Dsig::MIN_SIZE); |
52 | | |
53 | | /// [DSIG (Digital Signature Table)](https://docs.microsoft.com/en-us/typography/opentype/spec/dsig#table-structure) table |
54 | | #[derive(Clone)] |
55 | | pub struct Dsig<'a> { |
56 | | data: TableDataRef<'a, DsigFixedHeader>, |
57 | | } |
58 | | |
59 | | #[allow(clippy::needless_lifetimes)] |
60 | | impl<'a> Dsig<'a> { |
61 | | pub const MIN_SIZE: usize = |
62 | | (u32::RAW_BYTE_LEN + u16::RAW_BYTE_LEN + PermissionFlags::RAW_BYTE_LEN); |
63 | | basic_table_impls!(impl_the_methods); |
64 | | |
65 | | /// Version number of the DSIG table (0x00000001) |
66 | 0 | pub fn version(&self) -> u32 { |
67 | 0 | self.data.header().version.get() |
68 | 0 | } |
69 | | |
70 | | /// Number of signatures in the table |
71 | 0 | pub fn num_signatures(&self) -> u16 { |
72 | 0 | self.data.header().num_signatures.get() |
73 | 0 | } |
74 | | |
75 | | /// Permission flags |
76 | 0 | pub fn flags(&self) -> PermissionFlags { |
77 | 0 | self.data.header().flags.get() |
78 | 0 | } |
79 | | |
80 | | /// Array of signature records |
81 | 0 | pub fn signature_records(&self) -> &'a [SignatureRecord] { |
82 | 0 | let range = self.signature_records_byte_range(); |
83 | 0 | self.offset_data() |
84 | 0 | .read_array(range) |
85 | 0 | .ok() |
86 | 0 | .unwrap_or_default() |
87 | 0 | } |
88 | | |
89 | 0 | pub fn version_byte_range(&self) -> Range<usize> { |
90 | 0 | let start = 0usize; |
91 | 0 | let end = start.saturating_add(u32::RAW_BYTE_LEN); |
92 | 0 | start..end |
93 | 0 | } |
94 | | |
95 | 0 | pub fn num_signatures_byte_range(&self) -> Range<usize> { |
96 | 0 | let start = self.version_byte_range().end; |
97 | 0 | let end = start.saturating_add(u16::RAW_BYTE_LEN); |
98 | 0 | start..end |
99 | 0 | } |
100 | | |
101 | 0 | pub fn flags_byte_range(&self) -> Range<usize> { |
102 | 0 | let start = self.num_signatures_byte_range().end; |
103 | 0 | let end = start.saturating_add(PermissionFlags::RAW_BYTE_LEN); |
104 | 0 | start..end |
105 | 0 | } |
106 | | |
107 | 0 | pub fn signature_records_byte_range(&self) -> Range<usize> { |
108 | 0 | let num_signatures = self.num_signatures(); |
109 | 0 | let start = self.flags_byte_range().end; |
110 | 0 | let end = start.saturating_add( |
111 | 0 | (transforms::to_usize(num_signatures)).saturating_mul(SignatureRecord::RAW_BYTE_LEN), |
112 | | ); |
113 | 0 | start..end |
114 | 0 | } |
115 | | } |
116 | | |
117 | | const _: () = assert!(FontData::default_data_long_enough(Dsig::MIN_SIZE)); |
118 | | |
119 | | impl Default for Dsig<'_> { |
120 | 0 | fn default() -> Self { |
121 | | Self { |
122 | 0 | data: TableDataRef::new(FontData::default_table_data().as_bytes()) |
123 | 0 | .unwrap_or_else(|| unreachable!("the default data covers MIN_SIZE")), |
124 | | } |
125 | 0 | } |
126 | | } |
127 | | |
128 | | /// [Permission flags](https://learn.microsoft.com/en-us/typography/opentype/spec/dsig#table-structure) |
129 | | #[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash, bytemuck :: AnyBitPattern)] |
130 | | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] |
131 | | #[repr(transparent)] |
132 | | pub struct PermissionFlags { |
133 | | bits: u16, |
134 | | } |
135 | | |
136 | | impl PermissionFlags { |
137 | | /// Bit 0: Cannot be resigned |
138 | | pub const CANNOT_BE_RESIGNED: Self = Self { |
139 | | bits: 0b0000_0000_0000_0001, |
140 | | }; |
141 | | } |
142 | | |
143 | | impl PermissionFlags { |
144 | | /// Returns an empty set of flags. |
145 | | #[inline] |
146 | 0 | pub const fn empty() -> Self { |
147 | 0 | Self { bits: 0 } |
148 | 0 | } |
149 | | |
150 | | /// Returns the set containing all flags. |
151 | | #[inline] |
152 | 0 | pub const fn all() -> Self { |
153 | 0 | Self { |
154 | 0 | bits: Self::CANNOT_BE_RESIGNED.bits, |
155 | 0 | } |
156 | 0 | } |
157 | | |
158 | | /// Returns the raw value of the flags currently stored. |
159 | | #[inline] |
160 | 0 | pub const fn bits(&self) -> u16 { |
161 | 0 | self.bits |
162 | 0 | } |
163 | | |
164 | | /// Convert from underlying bit representation, unless that |
165 | | /// representation contains bits that do not correspond to a flag. |
166 | | #[inline] |
167 | 0 | pub const fn from_bits(bits: u16) -> Option<Self> { |
168 | 0 | if (bits & !Self::all().bits()) == 0 { |
169 | 0 | Some(Self { bits }) |
170 | | } else { |
171 | 0 | None |
172 | | } |
173 | 0 | } |
174 | | |
175 | | /// Convert from underlying bit representation, dropping any bits |
176 | | /// that do not correspond to flags. |
177 | | #[inline] |
178 | 0 | pub const fn from_bits_truncate(bits: u16) -> Self { |
179 | 0 | Self { |
180 | 0 | bits: bits & Self::all().bits, |
181 | 0 | } |
182 | 0 | } |
183 | | |
184 | | /// Returns `true` if no flags are currently stored. |
185 | | #[inline] |
186 | 0 | pub const fn is_empty(&self) -> bool { |
187 | 0 | self.bits() == Self::empty().bits() |
188 | 0 | } |
189 | | |
190 | | /// Returns `true` if there are flags common to both `self` and `other`. |
191 | | #[inline] |
192 | 0 | pub const fn intersects(&self, other: Self) -> bool { |
193 | 0 | !(Self { |
194 | 0 | bits: self.bits & other.bits, |
195 | 0 | }) |
196 | 0 | .is_empty() |
197 | 0 | } |
198 | | |
199 | | /// Returns `true` if all of the flags in `other` are contained within `self`. |
200 | | #[inline] |
201 | 0 | pub const fn contains(&self, other: Self) -> bool { |
202 | 0 | (self.bits & other.bits) == other.bits |
203 | 0 | } |
204 | | |
205 | | /// Inserts the specified flags in-place. |
206 | | #[inline] |
207 | 0 | pub fn insert(&mut self, other: Self) { |
208 | 0 | self.bits |= other.bits; |
209 | 0 | } |
210 | | |
211 | | /// Removes the specified flags in-place. |
212 | | #[inline] |
213 | 0 | pub fn remove(&mut self, other: Self) { |
214 | 0 | self.bits &= !other.bits; |
215 | 0 | } |
216 | | |
217 | | /// Toggles the specified flags in-place. |
218 | | #[inline] |
219 | 0 | pub fn toggle(&mut self, other: Self) { |
220 | 0 | self.bits ^= other.bits; |
221 | 0 | } |
222 | | |
223 | | /// Returns the intersection between the flags in `self` and |
224 | | /// `other`. |
225 | | /// |
226 | | /// Specifically, the returned set contains only the flags which are |
227 | | /// present in *both* `self` *and* `other`. |
228 | | /// |
229 | | /// This is equivalent to using the `&` operator (e.g. |
230 | | /// [`ops::BitAnd`]), as in `flags & other`. |
231 | | /// |
232 | | /// [`ops::BitAnd`]: https://doc.rust-lang.org/std/ops/trait.BitAnd.html |
233 | | #[inline] |
234 | | #[must_use] |
235 | 0 | pub const fn intersection(self, other: Self) -> Self { |
236 | 0 | Self { |
237 | 0 | bits: self.bits & other.bits, |
238 | 0 | } |
239 | 0 | } |
240 | | |
241 | | /// Returns the union of between the flags in `self` and `other`. |
242 | | /// |
243 | | /// Specifically, the returned set contains all flags which are |
244 | | /// present in *either* `self` *or* `other`, including any which are |
245 | | /// present in both. |
246 | | /// |
247 | | /// This is equivalent to using the `|` operator (e.g. |
248 | | /// [`ops::BitOr`]), as in `flags | other`. |
249 | | /// |
250 | | /// [`ops::BitOr`]: https://doc.rust-lang.org/std/ops/trait.BitOr.html |
251 | | #[inline] |
252 | | #[must_use] |
253 | 0 | pub const fn union(self, other: Self) -> Self { |
254 | 0 | Self { |
255 | 0 | bits: self.bits | other.bits, |
256 | 0 | } |
257 | 0 | } |
258 | | |
259 | | /// Returns the difference between the flags in `self` and `other`. |
260 | | /// |
261 | | /// Specifically, the returned set contains all flags present in |
262 | | /// `self`, except for the ones present in `other`. |
263 | | /// |
264 | | /// It is also conceptually equivalent to the "bit-clear" operation: |
265 | | /// `flags & !other` (and this syntax is also supported). |
266 | | /// |
267 | | /// This is equivalent to using the `-` operator (e.g. |
268 | | /// [`ops::Sub`]), as in `flags - other`. |
269 | | /// |
270 | | /// [`ops::Sub`]: https://doc.rust-lang.org/std/ops/trait.Sub.html |
271 | | #[inline] |
272 | | #[must_use] |
273 | 0 | pub const fn difference(self, other: Self) -> Self { |
274 | 0 | Self { |
275 | 0 | bits: self.bits & !other.bits, |
276 | 0 | } |
277 | 0 | } |
278 | | } |
279 | | |
280 | | impl std::ops::BitOr for PermissionFlags { |
281 | | type Output = Self; |
282 | | |
283 | | /// Returns the union of the two sets of flags. |
284 | | #[inline] |
285 | 0 | fn bitor(self, other: PermissionFlags) -> Self { |
286 | 0 | Self { |
287 | 0 | bits: self.bits | other.bits, |
288 | 0 | } |
289 | 0 | } |
290 | | } |
291 | | |
292 | | impl std::ops::BitOrAssign for PermissionFlags { |
293 | | /// Adds the set of flags. |
294 | | #[inline] |
295 | 0 | fn bitor_assign(&mut self, other: Self) { |
296 | 0 | self.bits |= other.bits; |
297 | 0 | } |
298 | | } |
299 | | |
300 | | impl std::ops::BitXor for PermissionFlags { |
301 | | type Output = Self; |
302 | | |
303 | | /// Returns the left flags, but with all the right flags toggled. |
304 | | #[inline] |
305 | 0 | fn bitxor(self, other: Self) -> Self { |
306 | 0 | Self { |
307 | 0 | bits: self.bits ^ other.bits, |
308 | 0 | } |
309 | 0 | } |
310 | | } |
311 | | |
312 | | impl std::ops::BitXorAssign for PermissionFlags { |
313 | | /// Toggles the set of flags. |
314 | | #[inline] |
315 | 0 | fn bitxor_assign(&mut self, other: Self) { |
316 | 0 | self.bits ^= other.bits; |
317 | 0 | } |
318 | | } |
319 | | |
320 | | impl std::ops::BitAnd for PermissionFlags { |
321 | | type Output = Self; |
322 | | |
323 | | /// Returns the intersection between the two sets of flags. |
324 | | #[inline] |
325 | 0 | fn bitand(self, other: Self) -> Self { |
326 | 0 | Self { |
327 | 0 | bits: self.bits & other.bits, |
328 | 0 | } |
329 | 0 | } |
330 | | } |
331 | | |
332 | | impl std::ops::BitAndAssign for PermissionFlags { |
333 | | /// Disables all flags disabled in the set. |
334 | | #[inline] |
335 | 0 | fn bitand_assign(&mut self, other: Self) { |
336 | 0 | self.bits &= other.bits; |
337 | 0 | } |
338 | | } |
339 | | |
340 | | impl std::ops::Sub for PermissionFlags { |
341 | | type Output = Self; |
342 | | |
343 | | /// Returns the set difference of the two sets of flags. |
344 | | #[inline] |
345 | 0 | fn sub(self, other: Self) -> Self { |
346 | 0 | Self { |
347 | 0 | bits: self.bits & !other.bits, |
348 | 0 | } |
349 | 0 | } |
350 | | } |
351 | | |
352 | | impl std::ops::SubAssign for PermissionFlags { |
353 | | /// Disables all flags enabled in the set. |
354 | | #[inline] |
355 | 0 | fn sub_assign(&mut self, other: Self) { |
356 | 0 | self.bits &= !other.bits; |
357 | 0 | } |
358 | | } |
359 | | |
360 | | impl std::ops::Not for PermissionFlags { |
361 | | type Output = Self; |
362 | | |
363 | | /// Returns the complement of this set of flags. |
364 | | #[inline] |
365 | 0 | fn not(self) -> Self { |
366 | 0 | Self { bits: !self.bits } & Self::all() |
367 | 0 | } |
368 | | } |
369 | | |
370 | | impl std::fmt::Debug for PermissionFlags { |
371 | 0 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
372 | 0 | let members: &[(&str, Self)] = &[("CANNOT_BE_RESIGNED", Self::CANNOT_BE_RESIGNED)]; |
373 | 0 | let mut first = true; |
374 | 0 | for (name, value) in members { |
375 | 0 | if self.contains(*value) { |
376 | 0 | if !first { |
377 | 0 | f.write_str(" | ")?; |
378 | 0 | } |
379 | 0 | first = false; |
380 | 0 | f.write_str(name)?; |
381 | 0 | } |
382 | | } |
383 | 0 | if first { |
384 | 0 | f.write_str("(empty)")?; |
385 | 0 | } |
386 | 0 | Ok(()) |
387 | 0 | } |
388 | | } |
389 | | |
390 | | impl std::fmt::Binary for PermissionFlags { |
391 | 0 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
392 | 0 | std::fmt::Binary::fmt(&self.bits, f) |
393 | 0 | } |
394 | | } |
395 | | |
396 | | impl std::fmt::Octal for PermissionFlags { |
397 | 0 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
398 | 0 | std::fmt::Octal::fmt(&self.bits, f) |
399 | 0 | } |
400 | | } |
401 | | |
402 | | impl std::fmt::LowerHex for PermissionFlags { |
403 | 0 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
404 | 0 | std::fmt::LowerHex::fmt(&self.bits, f) |
405 | 0 | } |
406 | | } |
407 | | |
408 | | impl std::fmt::UpperHex for PermissionFlags { |
409 | 0 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
410 | 0 | std::fmt::UpperHex::fmt(&self.bits, f) |
411 | 0 | } |
412 | | } |
413 | | |
414 | | impl font_types::Scalar for PermissionFlags { |
415 | | type Raw = <u16 as font_types::Scalar>::Raw; |
416 | 0 | fn to_raw(self) -> Self::Raw { |
417 | 0 | self.bits().to_raw() |
418 | 0 | } |
419 | 0 | fn from_raw(raw: Self::Raw) -> Self { |
420 | 0 | let t = <u16>::from_raw(raw); |
421 | 0 | Self::from_bits_truncate(t) |
422 | 0 | } |
423 | | } |
424 | | |
425 | | /// [Signature Record](https://learn.microsoft.com/en-us/typography/opentype/spec/dsig#table-structure) |
426 | | #[derive(Clone, Debug, Copy, bytemuck :: AnyBitPattern)] |
427 | | #[repr(C)] |
428 | | #[repr(packed)] |
429 | | pub struct SignatureRecord { |
430 | | /// Format of the signature |
431 | | pub format: BigEndian<u32>, |
432 | | /// Length of signature in bytes |
433 | | pub length: BigEndian<u32>, |
434 | | /// Offset to the signature block from the beginning of the table |
435 | | pub signature_block_offset: BigEndian<Offset32>, |
436 | | } |
437 | | |
438 | | impl SignatureRecord { |
439 | | /// Format of the signature |
440 | 0 | pub fn format(&self) -> u32 { |
441 | 0 | self.format.get() |
442 | 0 | } |
443 | | |
444 | | /// Length of signature in bytes |
445 | 0 | pub fn length(&self) -> u32 { |
446 | 0 | self.length.get() |
447 | 0 | } |
448 | | |
449 | | /// Offset to the signature block from the beginning of the table |
450 | 0 | pub fn signature_block_offset(&self) -> Offset32 { |
451 | 0 | self.signature_block_offset.get() |
452 | 0 | } |
453 | | } |
454 | | |
455 | | impl FixedSize for SignatureRecord { |
456 | | const RAW_BYTE_LEN: usize = u32::RAW_BYTE_LEN + u32::RAW_BYTE_LEN + Offset32::RAW_BYTE_LEN; |
457 | | } |
458 | | |
459 | | impl<'a> MinByteRange<'a> for SignatureBlockFormat1<'a> { |
460 | 0 | fn min_byte_range(&self) -> Range<usize> { |
461 | 0 | 0..self.signature_byte_range().end |
462 | 0 | } |
463 | 0 | fn min_table_bytes(&self) -> &'a [u8] { |
464 | 0 | let range = self.min_byte_range(); |
465 | 0 | self.offset_data().as_bytes().get(range).unwrap_or_default() |
466 | 0 | } |
467 | | } |
468 | | |
469 | | impl ReadArgs for SignatureBlockFormat1<'_> { |
470 | | type Args = (); |
471 | | } |
472 | | |
473 | | impl<'a> FontRead<'a> for SignatureBlockFormat1<'a> { |
474 | 0 | fn read_with_args(data: FontData<'a>, _: ()) -> Result<Self, ReadError> { |
475 | | #[allow(clippy::absurd_extreme_comparisons)] |
476 | 0 | if data.len() < Self::MIN_SIZE { |
477 | 0 | return Err(ReadError::OutOfBounds); |
478 | 0 | } |
479 | 0 | let Some(data) = TableDataRef::new(data.as_bytes()) else { |
480 | 0 | return Err(ReadError::OutOfBounds); |
481 | | }; |
482 | 0 | Ok(Self { data }) |
483 | 0 | } |
484 | | } |
485 | | |
486 | | /// The fields at the start of the table, which are read directly. |
487 | | #[derive(Clone, Copy, bytemuck :: AnyBitPattern)] |
488 | | #[repr(C, packed)] |
489 | | #[doc(hidden)] |
490 | | pub struct SignatureBlockFormat1FixedHeader { |
491 | | pub _reserved1: BigEndian<u16>, |
492 | | pub _reserved2: BigEndian<u16>, |
493 | | pub signature_length: BigEndian<u32>, |
494 | | } |
495 | | |
496 | | #[allow(clippy::absurd_extreme_comparisons)] |
497 | | const _: () = assert!( |
498 | | std::mem::size_of::<SignatureBlockFormat1FixedHeader>() <= SignatureBlockFormat1::MIN_SIZE |
499 | | ); |
500 | | |
501 | | /// [Signature Block Format 1](https://learn.microsoft.com/en-us/typography/opentype/spec/dsig#table-structure) |
502 | | #[derive(Clone)] |
503 | | pub struct SignatureBlockFormat1<'a> { |
504 | | data: TableDataRef<'a, SignatureBlockFormat1FixedHeader>, |
505 | | } |
506 | | |
507 | | #[allow(clippy::needless_lifetimes)] |
508 | | impl<'a> SignatureBlockFormat1<'a> { |
509 | | pub const MIN_SIZE: usize = (u16::RAW_BYTE_LEN + u16::RAW_BYTE_LEN + u32::RAW_BYTE_LEN); |
510 | | basic_table_impls!(impl_the_methods); |
511 | | |
512 | | /// Length (in bytes) of the PKCS#7 packet in the signature field. |
513 | 0 | pub fn signature_length(&self) -> u32 { |
514 | 0 | self.data.header().signature_length.get() |
515 | 0 | } |
516 | | |
517 | | /// PKCS#7 packet |
518 | 0 | pub fn signature(&self) -> &'a [u8] { |
519 | 0 | let range = self.signature_byte_range(); |
520 | 0 | self.offset_data() |
521 | 0 | .read_array(range) |
522 | 0 | .ok() |
523 | 0 | .unwrap_or_default() |
524 | 0 | } |
525 | | |
526 | 0 | pub fn _reserved1_byte_range(&self) -> Range<usize> { |
527 | 0 | let start = 0usize; |
528 | 0 | let end = start.saturating_add(u16::RAW_BYTE_LEN); |
529 | 0 | start..end |
530 | 0 | } |
531 | | |
532 | 0 | pub fn _reserved2_byte_range(&self) -> Range<usize> { |
533 | 0 | let start = self._reserved1_byte_range().end; |
534 | 0 | let end = start.saturating_add(u16::RAW_BYTE_LEN); |
535 | 0 | start..end |
536 | 0 | } |
537 | | |
538 | 0 | pub fn signature_length_byte_range(&self) -> Range<usize> { |
539 | 0 | let start = self._reserved2_byte_range().end; |
540 | 0 | let end = start.saturating_add(u32::RAW_BYTE_LEN); |
541 | 0 | start..end |
542 | 0 | } |
543 | | |
544 | 0 | pub fn signature_byte_range(&self) -> Range<usize> { |
545 | 0 | let signature_length = self.signature_length(); |
546 | 0 | let start = self.signature_length_byte_range().end; |
547 | 0 | let end = start.saturating_add( |
548 | 0 | (transforms::to_usize(signature_length)).saturating_mul(u8::RAW_BYTE_LEN), |
549 | | ); |
550 | 0 | start..end |
551 | 0 | } |
552 | | } |
553 | | |
554 | | const _: () = assert!(FontData::default_data_long_enough( |
555 | | SignatureBlockFormat1::MIN_SIZE |
556 | | )); |
557 | | |
558 | | impl Default for SignatureBlockFormat1<'_> { |
559 | 0 | fn default() -> Self { |
560 | | Self { |
561 | 0 | data: TableDataRef::new(FontData::default_table_data().as_bytes()) |
562 | 0 | .unwrap_or_else(|| unreachable!("the default data covers MIN_SIZE")), |
563 | | } |
564 | 0 | } |
565 | | } |