1#[allow(unused_imports)]
6use crate::codegen_prelude::*;
7
8#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash, bytemuck :: AnyBitPattern)]
10#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
11#[repr(transparent)]
12pub struct MacStyle {
13 bits: u16,
14}
15
16impl MacStyle {
17 pub const BOLD: Self = Self { bits: 0x0001 };
19
20 pub const ITALIC: Self = Self { bits: 0x0002 };
22
23 pub const UNDERLINE: Self = Self { bits: 0x0004 };
25
26 pub const OUTLINE: Self = Self { bits: 0x0008 };
28
29 pub const SHADOW: Self = Self { bits: 0x0010 };
31
32 pub const CONDENSED: Self = Self { bits: 0x0020 };
34
35 pub const EXTENDED: Self = Self { bits: 0x0040 };
37}
38
39impl MacStyle {
40 #[inline]
42 pub const fn empty() -> Self {
43 Self { bits: 0 }
44 }
45
46 #[inline]
48 pub const fn all() -> Self {
49 Self {
50 bits: Self::BOLD.bits
51 | Self::ITALIC.bits
52 | Self::UNDERLINE.bits
53 | Self::OUTLINE.bits
54 | Self::SHADOW.bits
55 | Self::CONDENSED.bits
56 | Self::EXTENDED.bits,
57 }
58 }
59
60 #[inline]
62 pub const fn bits(&self) -> u16 {
63 self.bits
64 }
65
66 #[inline]
69 pub const fn from_bits(bits: u16) -> Option<Self> {
70 if (bits & !Self::all().bits()) == 0 {
71 Some(Self { bits })
72 } else {
73 None
74 }
75 }
76
77 #[inline]
80 pub const fn from_bits_truncate(bits: u16) -> Self {
81 Self {
82 bits: bits & Self::all().bits,
83 }
84 }
85
86 #[inline]
88 pub const fn is_empty(&self) -> bool {
89 self.bits() == Self::empty().bits()
90 }
91
92 #[inline]
94 pub const fn intersects(&self, other: Self) -> bool {
95 !(Self {
96 bits: self.bits & other.bits,
97 })
98 .is_empty()
99 }
100
101 #[inline]
103 pub const fn contains(&self, other: Self) -> bool {
104 (self.bits & other.bits) == other.bits
105 }
106
107 #[inline]
109 pub fn insert(&mut self, other: Self) {
110 self.bits |= other.bits;
111 }
112
113 #[inline]
115 pub fn remove(&mut self, other: Self) {
116 self.bits &= !other.bits;
117 }
118
119 #[inline]
121 pub fn toggle(&mut self, other: Self) {
122 self.bits ^= other.bits;
123 }
124
125 #[inline]
136 #[must_use]
137 pub const fn intersection(self, other: Self) -> Self {
138 Self {
139 bits: self.bits & other.bits,
140 }
141 }
142
143 #[inline]
154 #[must_use]
155 pub const fn union(self, other: Self) -> Self {
156 Self {
157 bits: self.bits | other.bits,
158 }
159 }
160
161 #[inline]
174 #[must_use]
175 pub const fn difference(self, other: Self) -> Self {
176 Self {
177 bits: self.bits & !other.bits,
178 }
179 }
180}
181
182impl std::ops::BitOr for MacStyle {
183 type Output = Self;
184
185 #[inline]
187 fn bitor(self, other: MacStyle) -> Self {
188 Self {
189 bits: self.bits | other.bits,
190 }
191 }
192}
193
194impl std::ops::BitOrAssign for MacStyle {
195 #[inline]
197 fn bitor_assign(&mut self, other: Self) {
198 self.bits |= other.bits;
199 }
200}
201
202impl std::ops::BitXor for MacStyle {
203 type Output = Self;
204
205 #[inline]
207 fn bitxor(self, other: Self) -> Self {
208 Self {
209 bits: self.bits ^ other.bits,
210 }
211 }
212}
213
214impl std::ops::BitXorAssign for MacStyle {
215 #[inline]
217 fn bitxor_assign(&mut self, other: Self) {
218 self.bits ^= other.bits;
219 }
220}
221
222impl std::ops::BitAnd for MacStyle {
223 type Output = Self;
224
225 #[inline]
227 fn bitand(self, other: Self) -> Self {
228 Self {
229 bits: self.bits & other.bits,
230 }
231 }
232}
233
234impl std::ops::BitAndAssign for MacStyle {
235 #[inline]
237 fn bitand_assign(&mut self, other: Self) {
238 self.bits &= other.bits;
239 }
240}
241
242impl std::ops::Sub for MacStyle {
243 type Output = Self;
244
245 #[inline]
247 fn sub(self, other: Self) -> Self {
248 Self {
249 bits: self.bits & !other.bits,
250 }
251 }
252}
253
254impl std::ops::SubAssign for MacStyle {
255 #[inline]
257 fn sub_assign(&mut self, other: Self) {
258 self.bits &= !other.bits;
259 }
260}
261
262impl std::ops::Not for MacStyle {
263 type Output = Self;
264
265 #[inline]
267 fn not(self) -> Self {
268 Self { bits: !self.bits } & Self::all()
269 }
270}
271
272impl std::fmt::Debug for MacStyle {
273 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
274 let members: &[(&str, Self)] = &[
275 ("BOLD", Self::BOLD),
276 ("ITALIC", Self::ITALIC),
277 ("UNDERLINE", Self::UNDERLINE),
278 ("OUTLINE", Self::OUTLINE),
279 ("SHADOW", Self::SHADOW),
280 ("CONDENSED", Self::CONDENSED),
281 ("EXTENDED", Self::EXTENDED),
282 ];
283 let mut first = true;
284 for (name, value) in members {
285 if self.contains(*value) {
286 if !first {
287 f.write_str(" | ")?;
288 }
289 first = false;
290 f.write_str(name)?;
291 }
292 }
293 if first {
294 f.write_str("(empty)")?;
295 }
296 Ok(())
297 }
298}
299
300impl std::fmt::Binary for MacStyle {
301 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
302 std::fmt::Binary::fmt(&self.bits, f)
303 }
304}
305
306impl std::fmt::Octal for MacStyle {
307 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
308 std::fmt::Octal::fmt(&self.bits, f)
309 }
310}
311
312impl std::fmt::LowerHex for MacStyle {
313 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
314 std::fmt::LowerHex::fmt(&self.bits, f)
315 }
316}
317
318impl std::fmt::UpperHex for MacStyle {
319 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
320 std::fmt::UpperHex::fmt(&self.bits, f)
321 }
322}
323
324impl font_types::Scalar for MacStyle {
325 type Raw = <u16 as font_types::Scalar>::Raw;
326 fn to_raw(self) -> Self::Raw {
327 self.bits().to_raw()
328 }
329 fn from_raw(raw: Self::Raw) -> Self {
330 let t = <u16>::from_raw(raw);
331 Self::from_bits_truncate(t)
332 }
333}
334
335#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash, bytemuck :: AnyBitPattern)]
337#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
338#[repr(transparent)]
339pub struct Flags {
340 bits: u16,
341}
342
343impl Flags {
344 pub const BASELINE_AT_Y_0: Self = Self { bits: 0x0001 };
346
347 pub const LSB_AT_X_0: Self = Self { bits: 0x0002 };
349
350 pub const INSTRUCTIONS_MAY_DEPEND_ON_POINT_SIZE: Self = Self { bits: 0x0004 };
352
353 pub const FORCE_INTEGER_PPEM: Self = Self { bits: 0x0008 };
355
356 pub const INSTRUCTIONS_MAY_ALTER_ADVANCE_WIDTH: Self = Self { bits: 0x0010 };
358
359 pub const LOSSLESS_TRANSFORMED_FONT_DATA: Self = Self { bits: 0x0800 };
361
362 pub const CONVERTED_FONT: Self = Self { bits: 0x1000 };
364
365 pub const OPTIMIZED_FOR_CLEARTYPE: Self = Self { bits: 0x2000 };
367
368 pub const LAST_RESORT_FONT: Self = Self { bits: 0x4000 };
370}
371
372impl Flags {
373 #[inline]
375 pub const fn empty() -> Self {
376 Self { bits: 0 }
377 }
378
379 #[inline]
381 pub const fn all() -> Self {
382 Self {
383 bits: Self::BASELINE_AT_Y_0.bits
384 | Self::LSB_AT_X_0.bits
385 | Self::INSTRUCTIONS_MAY_DEPEND_ON_POINT_SIZE.bits
386 | Self::FORCE_INTEGER_PPEM.bits
387 | Self::INSTRUCTIONS_MAY_ALTER_ADVANCE_WIDTH.bits
388 | Self::LOSSLESS_TRANSFORMED_FONT_DATA.bits
389 | Self::CONVERTED_FONT.bits
390 | Self::OPTIMIZED_FOR_CLEARTYPE.bits
391 | Self::LAST_RESORT_FONT.bits,
392 }
393 }
394
395 #[inline]
397 pub const fn bits(&self) -> u16 {
398 self.bits
399 }
400
401 #[inline]
404 pub const fn from_bits(bits: u16) -> Option<Self> {
405 if (bits & !Self::all().bits()) == 0 {
406 Some(Self { bits })
407 } else {
408 None
409 }
410 }
411
412 #[inline]
415 pub const fn from_bits_truncate(bits: u16) -> Self {
416 Self {
417 bits: bits & Self::all().bits,
418 }
419 }
420
421 #[inline]
423 pub const fn is_empty(&self) -> bool {
424 self.bits() == Self::empty().bits()
425 }
426
427 #[inline]
429 pub const fn intersects(&self, other: Self) -> bool {
430 !(Self {
431 bits: self.bits & other.bits,
432 })
433 .is_empty()
434 }
435
436 #[inline]
438 pub const fn contains(&self, other: Self) -> bool {
439 (self.bits & other.bits) == other.bits
440 }
441
442 #[inline]
444 pub fn insert(&mut self, other: Self) {
445 self.bits |= other.bits;
446 }
447
448 #[inline]
450 pub fn remove(&mut self, other: Self) {
451 self.bits &= !other.bits;
452 }
453
454 #[inline]
456 pub fn toggle(&mut self, other: Self) {
457 self.bits ^= other.bits;
458 }
459
460 #[inline]
471 #[must_use]
472 pub const fn intersection(self, other: Self) -> Self {
473 Self {
474 bits: self.bits & other.bits,
475 }
476 }
477
478 #[inline]
489 #[must_use]
490 pub const fn union(self, other: Self) -> Self {
491 Self {
492 bits: self.bits | other.bits,
493 }
494 }
495
496 #[inline]
509 #[must_use]
510 pub const fn difference(self, other: Self) -> Self {
511 Self {
512 bits: self.bits & !other.bits,
513 }
514 }
515}
516
517impl std::ops::BitOr for Flags {
518 type Output = Self;
519
520 #[inline]
522 fn bitor(self, other: Flags) -> Self {
523 Self {
524 bits: self.bits | other.bits,
525 }
526 }
527}
528
529impl std::ops::BitOrAssign for Flags {
530 #[inline]
532 fn bitor_assign(&mut self, other: Self) {
533 self.bits |= other.bits;
534 }
535}
536
537impl std::ops::BitXor for Flags {
538 type Output = Self;
539
540 #[inline]
542 fn bitxor(self, other: Self) -> Self {
543 Self {
544 bits: self.bits ^ other.bits,
545 }
546 }
547}
548
549impl std::ops::BitXorAssign for Flags {
550 #[inline]
552 fn bitxor_assign(&mut self, other: Self) {
553 self.bits ^= other.bits;
554 }
555}
556
557impl std::ops::BitAnd for Flags {
558 type Output = Self;
559
560 #[inline]
562 fn bitand(self, other: Self) -> Self {
563 Self {
564 bits: self.bits & other.bits,
565 }
566 }
567}
568
569impl std::ops::BitAndAssign for Flags {
570 #[inline]
572 fn bitand_assign(&mut self, other: Self) {
573 self.bits &= other.bits;
574 }
575}
576
577impl std::ops::Sub for Flags {
578 type Output = Self;
579
580 #[inline]
582 fn sub(self, other: Self) -> Self {
583 Self {
584 bits: self.bits & !other.bits,
585 }
586 }
587}
588
589impl std::ops::SubAssign for Flags {
590 #[inline]
592 fn sub_assign(&mut self, other: Self) {
593 self.bits &= !other.bits;
594 }
595}
596
597impl std::ops::Not for Flags {
598 type Output = Self;
599
600 #[inline]
602 fn not(self) -> Self {
603 Self { bits: !self.bits } & Self::all()
604 }
605}
606
607impl std::fmt::Debug for Flags {
608 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
609 let members: &[(&str, Self)] = &[
610 ("BASELINE_AT_Y_0", Self::BASELINE_AT_Y_0),
611 ("LSB_AT_X_0", Self::LSB_AT_X_0),
612 (
613 "INSTRUCTIONS_MAY_DEPEND_ON_POINT_SIZE",
614 Self::INSTRUCTIONS_MAY_DEPEND_ON_POINT_SIZE,
615 ),
616 ("FORCE_INTEGER_PPEM", Self::FORCE_INTEGER_PPEM),
617 (
618 "INSTRUCTIONS_MAY_ALTER_ADVANCE_WIDTH",
619 Self::INSTRUCTIONS_MAY_ALTER_ADVANCE_WIDTH,
620 ),
621 (
622 "LOSSLESS_TRANSFORMED_FONT_DATA",
623 Self::LOSSLESS_TRANSFORMED_FONT_DATA,
624 ),
625 ("CONVERTED_FONT", Self::CONVERTED_FONT),
626 ("OPTIMIZED_FOR_CLEARTYPE", Self::OPTIMIZED_FOR_CLEARTYPE),
627 ("LAST_RESORT_FONT", Self::LAST_RESORT_FONT),
628 ];
629 let mut first = true;
630 for (name, value) in members {
631 if self.contains(*value) {
632 if !first {
633 f.write_str(" | ")?;
634 }
635 first = false;
636 f.write_str(name)?;
637 }
638 }
639 if first {
640 f.write_str("(empty)")?;
641 }
642 Ok(())
643 }
644}
645
646impl std::fmt::Binary for Flags {
647 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
648 std::fmt::Binary::fmt(&self.bits, f)
649 }
650}
651
652impl std::fmt::Octal for Flags {
653 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
654 std::fmt::Octal::fmt(&self.bits, f)
655 }
656}
657
658impl std::fmt::LowerHex for Flags {
659 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
660 std::fmt::LowerHex::fmt(&self.bits, f)
661 }
662}
663
664impl std::fmt::UpperHex for Flags {
665 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
666 std::fmt::UpperHex::fmt(&self.bits, f)
667 }
668}
669
670impl font_types::Scalar for Flags {
671 type Raw = <u16 as font_types::Scalar>::Raw;
672 fn to_raw(self) -> Self::Raw {
673 self.bits().to_raw()
674 }
675 fn from_raw(raw: Self::Raw) -> Self {
676 let t = <u16>::from_raw(raw);
677 Self::from_bits_truncate(t)
678 }
679}
680
681impl<'a> MinByteRange<'a> for Head<'a> {
682 fn min_byte_range(&self) -> Range<usize> {
683 0..self.glyph_data_format_byte_range().end
684 }
685 fn min_table_bytes(&self) -> &'a [u8] {
686 let range = self.min_byte_range();
687 self.offset_data().as_bytes().get(range).unwrap_or_default()
688 }
689}
690
691impl TopLevelTable for Head<'_> {
692 const TAG: Tag = Tag::new(b"head");
694}
695
696impl ReadArgs for Head<'_> {
697 type Args = ();
698}
699
700impl<'a> FontRead<'a> for Head<'a> {
701 fn read_with_args(data: FontData<'a>, _: ()) -> Result<Self, ReadError> {
702 #[allow(clippy::absurd_extreme_comparisons)]
703 if data.len() < Self::MIN_SIZE {
704 return Err(ReadError::OutOfBounds);
705 }
706 let Some(data) = TableDataRef::new(data.as_bytes()) else {
707 return Err(ReadError::OutOfBounds);
708 };
709 Ok(Self { data })
710 }
711}
712
713#[derive(Clone, Copy, bytemuck :: AnyBitPattern)]
715#[repr(C, packed)]
716#[doc(hidden)]
717pub struct HeadFixedHeader {
718 pub version: BigEndian<MajorMinor>,
719 pub font_revision: BigEndian<Fixed>,
720 pub checksum_adjustment: BigEndian<u32>,
721 pub magic_number: BigEndian<u32>,
722 pub flags: BigEndian<Flags>,
723 pub units_per_em: BigEndian<u16>,
724 pub created: BigEndian<LongDateTime>,
725 pub modified: BigEndian<LongDateTime>,
726 pub x_min: BigEndian<i16>,
727 pub y_min: BigEndian<i16>,
728 pub x_max: BigEndian<i16>,
729 pub y_max: BigEndian<i16>,
730 pub mac_style: BigEndian<MacStyle>,
731 pub lowest_rec_ppem: BigEndian<u16>,
732 pub font_direction_hint: BigEndian<i16>,
733 pub index_to_loc_format: BigEndian<i16>,
734 pub glyph_data_format: BigEndian<i16>,
735}
736
737#[allow(clippy::absurd_extreme_comparisons)]
738const _: () = assert!(std::mem::size_of::<HeadFixedHeader>() <= Head::MIN_SIZE);
739
740#[derive(Clone)]
743pub struct Head<'a> {
744 data: TableDataRef<'a, HeadFixedHeader>,
745}
746
747#[allow(clippy::needless_lifetimes)]
748impl<'a> Head<'a> {
749 pub const MIN_SIZE: usize = (MajorMinor::RAW_BYTE_LEN
750 + Fixed::RAW_BYTE_LEN
751 + u32::RAW_BYTE_LEN
752 + u32::RAW_BYTE_LEN
753 + Flags::RAW_BYTE_LEN
754 + u16::RAW_BYTE_LEN
755 + LongDateTime::RAW_BYTE_LEN
756 + LongDateTime::RAW_BYTE_LEN
757 + i16::RAW_BYTE_LEN
758 + i16::RAW_BYTE_LEN
759 + i16::RAW_BYTE_LEN
760 + i16::RAW_BYTE_LEN
761 + MacStyle::RAW_BYTE_LEN
762 + u16::RAW_BYTE_LEN
763 + i16::RAW_BYTE_LEN
764 + i16::RAW_BYTE_LEN
765 + i16::RAW_BYTE_LEN);
766 basic_table_impls!(impl_the_methods);
767
768 pub fn version(&self) -> MajorMinor {
770 self.data.header().version.get()
771 }
772
773 pub fn font_revision(&self) -> Fixed {
775 self.data.header().font_revision.get()
776 }
777
778 pub fn checksum_adjustment(&self) -> u32 {
784 self.data.header().checksum_adjustment.get()
785 }
786
787 pub fn magic_number(&self) -> u32 {
789 self.data.header().magic_number.get()
790 }
791
792 pub fn flags(&self) -> Flags {
794 self.data.header().flags.get()
795 }
796
797 pub fn units_per_em(&self) -> u16 {
802 self.data.header().units_per_em.get()
803 }
804
805 pub fn created(&self) -> LongDateTime {
808 self.data.header().created.get()
809 }
810
811 pub fn modified(&self) -> LongDateTime {
814 self.data.header().modified.get()
815 }
816
817 pub fn x_min(&self) -> i16 {
819 self.data.header().x_min.get()
820 }
821
822 pub fn y_min(&self) -> i16 {
824 self.data.header().y_min.get()
825 }
826
827 pub fn x_max(&self) -> i16 {
829 self.data.header().x_max.get()
830 }
831
832 pub fn y_max(&self) -> i16 {
834 self.data.header().y_max.get()
835 }
836
837 pub fn mac_style(&self) -> MacStyle {
839 self.data.header().mac_style.get()
840 }
841
842 pub fn lowest_rec_ppem(&self) -> u16 {
844 self.data.header().lowest_rec_ppem.get()
845 }
846
847 pub fn font_direction_hint(&self) -> i16 {
849 self.data.header().font_direction_hint.get()
850 }
851
852 pub fn index_to_loc_format(&self) -> i16 {
854 self.data.header().index_to_loc_format.get()
855 }
856
857 pub fn glyph_data_format(&self) -> i16 {
859 self.data.header().glyph_data_format.get()
860 }
861
862 pub fn version_byte_range(&self) -> Range<usize> {
863 let start = 0;
864 let end = start + MajorMinor::RAW_BYTE_LEN;
865 start..end
866 }
867
868 pub fn font_revision_byte_range(&self) -> Range<usize> {
869 let start = self.version_byte_range().end;
870 let end = start + Fixed::RAW_BYTE_LEN;
871 start..end
872 }
873
874 pub fn checksum_adjustment_byte_range(&self) -> Range<usize> {
875 let start = self.font_revision_byte_range().end;
876 let end = start + u32::RAW_BYTE_LEN;
877 start..end
878 }
879
880 pub fn magic_number_byte_range(&self) -> Range<usize> {
881 let start = self.checksum_adjustment_byte_range().end;
882 let end = start + u32::RAW_BYTE_LEN;
883 start..end
884 }
885
886 pub fn flags_byte_range(&self) -> Range<usize> {
887 let start = self.magic_number_byte_range().end;
888 let end = start + Flags::RAW_BYTE_LEN;
889 start..end
890 }
891
892 pub fn units_per_em_byte_range(&self) -> Range<usize> {
893 let start = self.flags_byte_range().end;
894 let end = start + u16::RAW_BYTE_LEN;
895 start..end
896 }
897
898 pub fn created_byte_range(&self) -> Range<usize> {
899 let start = self.units_per_em_byte_range().end;
900 let end = start + LongDateTime::RAW_BYTE_LEN;
901 start..end
902 }
903
904 pub fn modified_byte_range(&self) -> Range<usize> {
905 let start = self.created_byte_range().end;
906 let end = start + LongDateTime::RAW_BYTE_LEN;
907 start..end
908 }
909
910 pub fn x_min_byte_range(&self) -> Range<usize> {
911 let start = self.modified_byte_range().end;
912 let end = start + i16::RAW_BYTE_LEN;
913 start..end
914 }
915
916 pub fn y_min_byte_range(&self) -> Range<usize> {
917 let start = self.x_min_byte_range().end;
918 let end = start + i16::RAW_BYTE_LEN;
919 start..end
920 }
921
922 pub fn x_max_byte_range(&self) -> Range<usize> {
923 let start = self.y_min_byte_range().end;
924 let end = start + i16::RAW_BYTE_LEN;
925 start..end
926 }
927
928 pub fn y_max_byte_range(&self) -> Range<usize> {
929 let start = self.x_max_byte_range().end;
930 let end = start + i16::RAW_BYTE_LEN;
931 start..end
932 }
933
934 pub fn mac_style_byte_range(&self) -> Range<usize> {
935 let start = self.y_max_byte_range().end;
936 let end = start + MacStyle::RAW_BYTE_LEN;
937 start..end
938 }
939
940 pub fn lowest_rec_ppem_byte_range(&self) -> Range<usize> {
941 let start = self.mac_style_byte_range().end;
942 let end = start + u16::RAW_BYTE_LEN;
943 start..end
944 }
945
946 pub fn font_direction_hint_byte_range(&self) -> Range<usize> {
947 let start = self.lowest_rec_ppem_byte_range().end;
948 let end = start + i16::RAW_BYTE_LEN;
949 start..end
950 }
951
952 pub fn index_to_loc_format_byte_range(&self) -> Range<usize> {
953 let start = self.font_direction_hint_byte_range().end;
954 let end = start + i16::RAW_BYTE_LEN;
955 start..end
956 }
957
958 pub fn glyph_data_format_byte_range(&self) -> Range<usize> {
959 let start = self.index_to_loc_format_byte_range().end;
960 let end = start + i16::RAW_BYTE_LEN;
961 start..end
962 }
963}
964
965const _: () = assert!(FontData::default_data_long_enough(Head::MIN_SIZE));
966
967impl Default for Head<'_> {
968 fn default() -> Self {
969 Self {
970 data: TableDataRef::new(FontData::default_table_data().as_bytes())
971 .unwrap_or_else(|| unreachable!("the default data covers MIN_SIZE")),
972 }
973 }
974}