Enum read_fonts::traversal::FieldType
source · pub enum FieldType<'a> {
Show 25 variants
I8(i8),
U8(u8),
I16(i16),
U16(u16),
I32(i32),
U32(u32),
I24(Int24),
U24(Uint24),
Tag(Tag),
FWord(FWord),
UfWord(UfWord),
MajorMinor(MajorMinor),
Version16Dot16(Version16Dot16),
F2Dot14(F2Dot14),
Fixed(Fixed),
LongDateTime(LongDateTime),
GlyphId16(GlyphId16),
NameId(NameId),
BareOffset(OffsetType),
ResolvedOffset(ResolvedOffset<'a>),
StringOffset(StringOffset<'a>),
ArrayOffset(ArrayOffset<'a>),
Record(RecordResolver<'a>),
Array(Box<dyn SomeArray<'a> + 'a>),
Unknown,
}
Expand description
Types of fields in font tables.
Fields can either be scalars, offsets to tables, or arrays.
Variants§
I8(i8)
U8(u8)
I16(i16)
U16(u16)
I32(i32)
U32(u32)
I24(Int24)
U24(Uint24)
Tag(Tag)
FWord(FWord)
UfWord(UfWord)
MajorMinor(MajorMinor)
Version16Dot16(Version16Dot16)
F2Dot14(F2Dot14)
Fixed(Fixed)
LongDateTime(LongDateTime)
GlyphId16(GlyphId16)
NameId(NameId)
BareOffset(OffsetType)
ResolvedOffset(ResolvedOffset<'a>)
StringOffset(StringOffset<'a>)
Used in tables like name/post so we can actually print the strings
ArrayOffset(ArrayOffset<'a>)
Used in COLR/CPAL
Record(RecordResolver<'a>)
Array(Box<dyn SomeArray<'a> + 'a>)
Unknown
Implementations§
source§impl<'a> FieldType<'a>
impl<'a> FieldType<'a>
sourcepub fn array_of_records<T>(
type_name: &'static str,
records: &'a [T],
data: FontData<'a>,
) -> FieldType<'a>where
T: Clone + SomeRecord<'a> + 'a,
pub fn array_of_records<T>(
type_name: &'static str,
records: &'a [T],
data: FontData<'a>,
) -> FieldType<'a>where
T: Clone + SomeRecord<'a> + 'a,
makes a field, handling the case where this array may not be present in all versions
pub fn computed_array<T>( type_name: &'static str, array: ComputedArray<'a, T>, data: FontData<'a>, ) -> FieldType<'a>
pub fn var_array<T>( type_name: &'static str, array: VarLenArray<'a, T>, data: FontData<'a>, ) -> FieldType<'a>
sourcepub fn array_of_offsets<O>(
type_name: &'static str,
offsets: &'a [O],
resolver: impl Fn(&O) -> FieldType<'a> + 'a,
) -> Self
pub fn array_of_offsets<O>( type_name: &'static str, offsets: &'a [O], resolver: impl Fn(&O) -> FieldType<'a> + 'a, ) -> Self
Convenience method for creating a FieldType
from an array of offsets.
The resolver
argument is a function that takes an offset and resolves
it.
sourcepub fn offset_to_array_of_scalars<T: SomeArray<'a> + 'a>(
offset: impl Into<OffsetType>,
result: impl Into<Option<Result<T, ReadError>>>,
) -> Self
pub fn offset_to_array_of_scalars<T: SomeArray<'a> + 'a>( offset: impl Into<OffsetType>, result: impl Into<Option<Result<T, ReadError>>>, ) -> Self
Convenience method for creating a FieldType
from an offset to an array.
sourcepub fn offset_to_array_of_records<T: Clone + SomeRecord<'a> + 'a>(
offset: impl Into<OffsetType>,
result: impl Into<Option<Result<&'a [T], ReadError>>>,
type_name: &'static str,
data: FontData<'a>,
) -> Self
pub fn offset_to_array_of_records<T: Clone + SomeRecord<'a> + 'a>( offset: impl Into<OffsetType>, result: impl Into<Option<Result<&'a [T], ReadError>>>, type_name: &'static str, data: FontData<'a>, ) -> Self
Convenience method for creating a FieldType
from an offset to an array.
sourcepub fn offset<T: SomeTable<'a> + 'a>(
offset: impl Into<OffsetType>,
result: impl Into<Option<Result<T, ReadError>>>,
) -> Self
pub fn offset<T: SomeTable<'a> + 'a>( offset: impl Into<OffsetType>, result: impl Into<Option<Result<T, ReadError>>>, ) -> Self
Convenience method for creating a FieldType
for a resolved offset.
This handles cases where offsets are nullable, in which case the result
argument may be None
.
sourcepub fn unknown_offset(offset: impl Into<OffsetType>) -> Self
pub fn unknown_offset(offset: impl Into<OffsetType>) -> Self
Convenience method for creating a FieldType
from an unknown offset.