{"record":{"id":"17f10c9d346e8187","repo":"slint-ui/slint","slug":"large-width","errorCode":null,"errorMessage":"large width","messagePattern":"large width","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/compiler/passes/embed_glyphs.rs","lineNumber":494,"sourceCode":"                        let mut ctx = ctx.borrow_mut();\n                        let mut scaler = ctx\n                            .builder(font_ref)\n                            .size(*pixel_size as f32)\n                            .normalized_coords(normalized_coords)\n                            .build();\n                        let image = swash::scale::Render::new(&[swash::scale::Source::Outline])\n                            .format(swash::zeno::Format::Alpha)\n                            .render(&mut scaler, glyph_id);\n\n                        match image {\n                            Some(image) => {\n                                let p = image.placement;\n                                BitmapGlyph {\n                                    x: i16::try_from(p.left * 64)\n                                        .expect(\"large glyph x coordinate\"),\n                                    y: i16::try_from((p.top - p.height as i32) * 64)\n                                        .expect(\"large glyph y coordinate\"),\n                                    width: i16::try_from(p.width).expect(\"large width\"),\n                                    height: i16::try_from(p.height).expect(\"large height\"),\n                                    x_advance: i16::try_from((advance_width * 64.) as i64)\n                                        .expect(\"large advance width\"),\n                                    data: image.data,\n                                }\n                            }\n                            None => BitmapGlyph {\n                                x: 0,\n                                y: 0,\n                                width: 0,\n                                height: 0,\n                                x_advance: i16::try_from((advance_width * 64.) as i64)\n                                    .expect(\"large advance width\"),\n                                data: vec![],\n                            },\n                        }\n                    })\n                })","sourceCodeStart":476,"sourceCodeEnd":512,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/internal/compiler/passes/embed_glyphs.rs#L476-L512","documentation":"In the embed-glyphs pass, the bitmap glyph's width (`image.placement.width`) must fit in i16 because that is the field width in the compiled glyph structure. Panics when a glyph bitmap is wider than 32767 pixels.","triggerScenarios":"Embedding a font whose bitmap glyph `placement.width` exceeds i16::MAX — practically only possible with a corrupt or absurdly generated bitmap font.","commonSituations":"Corrupted font files; font-generation tools producing giant bitmap strikes.","solutions":["Validate the font file (e.g. with fonttools/ots-sanitize) and fix or replace it","Regenerate the bitmap font with sane glyph dimensions (< 32768 px wide)","Exclude the font from embedding or drop its bitmap tables"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"assert!(p.width <= i16::MAX as u32, \"bitmap glyph wider than i16\");","typeGuard":"fn glyph_width_fits(width: u32) -> bool { width <= i16::MAX as u32 }","tryCatchPattern":null,"preventionTips":["Run ots-sanitize/fonttools validation on every font asset","Reject oversized bitmap strikes at font-generation time","Pin known-good font versions instead of ad-hoc downloads"],"tags":["rust","panic","compiler","fonts","value-out-of-range"],"backgroundTag":"value-out-of-range","analyzedSha":"bb937076de3f7919766c1f25e2e969367cf77e9a","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}