{"record":{"id":"eb9450e4562a744d","repo":"slint-ui/slint","slug":"more-than-65535-glyphs-are-not-supported","errorCode":null,"errorMessage":"more than 65535 glyphs are not supported","messagePattern":"more than 65535 glyphs are not supported","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/compiler/passes/embed_glyphs.rs","lineNumber":400,"sourceCode":"    fallback_fonts: &[Font],\n    _compiler_config: &CompilerConfiguration,\n    normalized_coords: &[skrifa::instance::NormalizedCoord],\n    _variations: &[(skrifa::Tag, f32)],\n    override_weight: Option<u16>,\n) -> BitmapFont {\n    let coords_i16: Vec<i16> = normalized_coords.iter().map(|c| c.to_bits()).collect();\n\n    let mut character_map: Vec<CharacterMapEntry> = character_coverage\n        .filter(|code_point| {\n            core::iter::once(&font)\n                .chain(fallback_fonts.iter())\n                .any(|font| swash_font_ref(font).charmap().map(*code_point) != 0)\n        })\n        .enumerate()\n        .map(|(glyph_index, code_point)| CharacterMapEntry {\n            code_point,\n            glyph_index: u16::try_from(glyph_index)\n                .expect(\"more than 65535 glyphs are not supported\"),\n        })\n        .collect();\n\n    #[cfg(feature = \"sdf-fonts\")]\n    let glyphs = if _compiler_config.use_sdf_fonts {\n        embed_sdf_glyphs(pixel_sizes, &character_map, &font, fallback_fonts, _variations)\n    } else {\n        embed_alpha_map_glyphs(pixel_sizes, &character_map, &font, fallback_fonts, &coords_i16)\n    };\n    #[cfg(not(feature = \"sdf-fonts\"))]\n    let glyphs =\n        embed_alpha_map_glyphs(pixel_sizes, &character_map, &font, fallback_fonts, &coords_i16);\n\n    character_map.sort_by_key(|entry| entry.code_point);\n\n    let font_ref = skrifa::FontRef::from_index(font.font.blob.data(), font.font.index).unwrap();\n    let location = skrifa::instance::LocationRef::new(normalized_coords);\n    let metrics =","sourceCodeStart":382,"sourceCodeEnd":418,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/internal/compiler/passes/embed_glyphs.rs#L382-L418","documentation":"This panic fires in the glyph-embedding pass (internal/compiler/passes/embed_glyphs.rs:400) while building the character map for embedded fonts. Glyph indices are stored as `u16` (matching font formats' 16-bit glyph ids), so if the accumulated `glyph_index` exceeds 65535 the `u16::try_from` fails and the `expect` panics. It means the font set being embedded produces more glyphs than the 16-bit glyph id space supports.","triggerScenarios":"Compiling with `embed_glyphs` (font glyph embedding enabled in `CompilerConfiguration`) on a font (or font + fallback fonts chain) where the enumerated glyph index passed 65535 — very large fonts, many merged fallback fonts, or fonts with malformed/oversized glyph tables.","commonSituations":"Embedded firmware builds with big CJK/emoji fonts embedded as glyphs; accidentally including multiple huge fallback fonts; using a broken/subsetted font with an inflated glyph table.","solutions":["Subset the font before embedding: use tools like pyftsubset/fonttools to reduce the glyph count below 65535 and limit to needed code points.","Use `EmbedResources::EmbedTextures` (SDF textures) or `DoNotEmbed` instead of glyph embedding for very large fonts.","Remove unnecessary fallback fonts from the font chain so the combined glyph count stays within 16 bits.","Split text across multiple smaller fonts if coverage requires more than 65535 glyphs."],"exampleFix":"// before (shell)\npyftsubset big.ttf # keeps too many glyphs\n// after\npyftsubset big.ttf --unicodes=U+0020-007E,U+4E00-9FFF --glyph-names --layout-features='*'","handlingStrategy":"validation","validationCode":"#!/bin/sh\n# check glyph count of fonts before enabling embed_glyphs\npython3 -c \"from fontTools.ttLib import TTFont; import sys; f=TTFont(sys.argv[1]); n=f['maxp'].numGlyphs; sys.exit(1 if n>65535 else 0)\" myfont.ttf || echo \"subset the font first\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Subset large fonts (CJK/emoji) with fonttools/pyftsubset before embedding.","Keep the fallback font chain short; each extra font adds glyphs.","For huge coverage needs, switch to EmbedTextures/SDF or runtime font loading instead of glyph embedding."],"tags":["rust","compiler","fonts","glyphs","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"}