{"record":{"id":"180b32be46425059","repo":"slint-ui/slint","slug":"large-glyph-y-coordinate","errorCode":null,"errorMessage":"large glyph y coordinate","messagePattern":"large glyph y coordinate","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/compiler/passes/embed_glyphs.rs","lineNumber":493,"sourceCode":"                        let font_ref = swash_font_ref(font_to_use);\n                        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                    })","sourceCodeStart":475,"sourceCodeEnd":511,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/internal/compiler/passes/embed_glyphs.rs#L475-L511","documentation":"Same embed-glyphs pass as the x-coordinate variant: the bitmap glyph's y offset, computed as `(p.top - p.height) * 64` (26.6 fixed-point), must fit into i16 for the compiled glyph table. Panics via `.expect(\"large glyph y coordinate\")` when it does not.","triggerScenarios":"Compiling a .slint file with an embedded bitmap font whose glyph y placement `(top - height) * 64` overflows i16 (beyond roughly ±512 px).","commonSituations":"Malformed or unusually generated bitmap/emoji fonts with glyph bitmaps positioned far from the baseline origin.","solutions":["Regenerate or replace the bitmap font so vertical glyph placement stays within ±512 px","Avoid embedding the offending bitmap glyphs (use a different font or drop the bitmap tables)","File an upstream issue if the range is genuinely needed"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let fits_i16 = ((p.top - p.height as i32) as i64 * 64).abs() <= i16::MAX as i64;\nassert!(fits_i16, \"bitmap glyph y placement too large for embedding\");","typeGuard":"fn glyph_y_fits(top: i32, height: u32) -> bool { let v = (top - height as i32) as i64 * 64; v >= i16::MIN as i64 && v <= i16::MAX as i64 }","tryCatchPattern":null,"preventionTips":["Validate glyph metrics (top/height) during font-generation tooling","Keep bitmap glyph bitmaps near the baseline origin","Add a font-metrics CI check before embedding fonts into Slint builds"],"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"}