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

View File

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