core: Font::from_swf_tag is currently infallible, remove error path

This commit is contained in:
= 2022-08-18 20:45:42 +02:00 committed by Nathan Adams
parent 1df8de5bac
commit 2d2869f44f
3 changed files with 7 additions and 12 deletions

View File

@ -2898,8 +2898,7 @@ impl<'gc, 'a> MovieClipData<'gc> {
context.renderer,
font,
reader.encoding(),
)
.unwrap();
);
context
.library
.library_for_movie_mut(self.movie())
@ -2920,8 +2919,7 @@ impl<'gc, 'a> MovieClipData<'gc> {
context.renderer,
font,
reader.encoding(),
)
.unwrap();
);
context
.library
.library_for_movie_mut(self.movie())
@ -2942,8 +2940,7 @@ impl<'gc, 'a> MovieClipData<'gc> {
context.renderer,
font,
reader.encoding(),
)
.unwrap();
);
context
.library
.library_for_movie_mut(self.movie())

View File

@ -13,8 +13,6 @@ pub fn round_down_to_pixel(t: Twips) -> Twips {
Twips::from_pixels(t.to_pixels().floor())
}
type Error = Box<dyn std::error::Error>;
/// Parameters necessary to evaluate a font.
#[derive(Copy, Clone, Debug, Collect)]
#[collect(require_static)]
@ -107,7 +105,7 @@ impl<'gc> Font<'gc> {
renderer: &mut dyn RenderBackend,
tag: swf::Font,
encoding: &'static swf::Encoding,
) -> Result<Font<'gc>, Error> {
) -> Font<'gc> {
let mut glyphs = vec![];
let mut code_point_to_glyph = fnv::FnvHashMap::default();
@ -147,7 +145,7 @@ impl<'gc> Font<'gc> {
fnv::FnvHashMap::default()
};
Ok(Font(Gc::allocate(
Font(Gc::allocate(
gc_context,
FontData {
glyphs,
@ -162,7 +160,7 @@ impl<'gc> Font<'gc> {
leading,
descriptor,
},
)))
))
}
/// Returns whether this font contains glyph shapes.

View File

@ -1584,7 +1584,7 @@ impl Player {
renderer,
reader.read_define_font_2(3)?,
reader.encoding(),
)?;
);
Ok(device_font)
}