/// Creates a new [`Face`] from [`ttf_parser::Face`].
///
/// Data will be referenced, not owned.
///
/// Returns `None` when face's units per EM is `None`.
pub fn from_face(face: ttf_parser::Face<'a>) -> Option<Self> {
Some(Face {
units_per_em: face.units_per_em(),
pixels_per_em: None,
points_per_em: None,
prefered_cmap_encoding_subtable: find_best_cmap_subtable(&face),
gsub: face.tables().gsub.map(SubstitutionTable::new),
gpos: face.tables().gpos.map(PositioningTable::new),
ttfp_face: face,
})
}
This function always returns Some and I believe the docs are invalid, as face.units_per_em() returns u16.
The
Face::from_face
is defined as:This function always returns
Some
and I believe the docs are invalid, asface.units_per_em()
returnsu16
.