Do not store reference to font in shape or layout glyphs
This commit is contained in:
parent
3c573df261
commit
42de42d59e
5 changed files with 68 additions and 47 deletions
|
|
@ -57,7 +57,6 @@ impl<'a> FontMatches<'a> {
|
|||
missing.push(start_word + info.cluster as usize);
|
||||
}
|
||||
|
||||
let inner = info.glyph_id as swash::GlyphId;
|
||||
glyphs.push(FontShapeGlyph {
|
||||
start: start_word + info.cluster as usize,
|
||||
end: end_word, // Set later
|
||||
|
|
@ -65,8 +64,8 @@ impl<'a> FontMatches<'a> {
|
|||
y_advance,
|
||||
x_offset,
|
||||
y_offset,
|
||||
font,
|
||||
inner,
|
||||
font_id: font.info.id,
|
||||
glyph_id: info.glyph_id.try_into().unwrap(),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -325,4 +324,13 @@ impl<'a> FontMatches<'a> {
|
|||
|
||||
FontShapeLine { rtl, spans }
|
||||
}
|
||||
|
||||
pub fn get_font(&self, id: &fontdb::ID) -> Option<&Font> {
|
||||
for font in self.fonts.iter() {
|
||||
if &font.info.id == id {
|
||||
return Some(font);
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue