{"record":{"id":"26a6a978d4c31272","repo":"unoplatform/uno","slug":"cmap-format-format-not-supported-only-4-and-12","errorCode":null,"errorMessage":"cmap format {format} not supported (only 4 and 12)","messagePattern":"cmap format (.+?) not supported \\(only 4 and 12\\)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/FontFallbackPreprocessor/Program.cs","lineNumber":335,"sourceCode":"\t\t\tthrow new Exception(\"No supported cmap subtable found (Platform 3/Encoding 1 or 10, or Platform 0)\");\n\n\t\t// 4. Parse subtable\n\t\t// The offset in the encoding record is relative to the beginning of the cmap table.\n\t\tlong subtablePosition = cmapOffset + selectedSubtableOffset;\n\t\tfs.Seek(subtablePosition, SeekOrigin.Begin);\n\t\tushort format = ReadUInt16Be(reader);\n\n\t\tif (format == 4)\n\t\t{\n\t\t\treturn ReadFormat4(reader);\n\t\t}\n\t\telse if (format == 12)\n\t\t{\n\t\t\treturn ReadFormat12(reader);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthrow new Exception($\"cmap format {format} not supported (only 4 and 12)\");\n\t\t}\n\t}\n\n\tprivate static List<int> ReadFormat4(BinaryReader reader)\n\t{\n\t\t// Format 4 Header\n\t\t// length(2), language(2)\n\t\t_ = ReadUInt16Be(reader); // length\n\t\t_ = ReadUInt16Be(reader); // language\n\n\t\t// segCountX2(2), searchRange(2), entrySelector(2), rangeShift(2)\n\t\tushort segCountX2 = ReadUInt16Be(reader);\n\t\tushort segCount = (ushort)(segCountX2 / 2);\n\t\treader.ReadBytes(6); // Skip searchRange, entrySelector, rangeShift\n\n\t\t// Arrays\n\t\tushort[] endCounts = new ushort[segCount];\n\t\tfor (int i = 0; i < segCount; i++) endCounts[i] = ReadUInt16Be(reader);","sourceCodeStart":317,"sourceCodeEnd":353,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/FontFallbackPreprocessor/Program.cs#L317-L353","documentation":"After selecting a cmap subtable, the tool reads its format word and only handles format 4 (segment mapping, BMP) and format 12 (segmented coverage, supplementary planes). Any other format (0, 2, 6, 13, 14) throws a bare Exception. Formats 4 and 12 cover the Unicode use cases Uno needs; other formats are legacy/rare and unsupported by this tool intentionally.","triggerScenarios":"A selected Unicode cmap subtable whose format is not 4 or 12 — e.g. a font exposing only format 0 (byte encoding) or format 6 (trimmed table) subtables that happened to be selected, or a format-14 variation-selector subtable selected by the platform-0 fallback path.","commonSituations":"Legacy bitmap/symbol fonts whose only subtables are format 0/2/6; a font whose selected subtable is a Unicode Variation Sequences (format 14) record; exotic or minimal fonts in the notofonts tree.","solutions":["Prefer fonts that expose format 4 and/or format 12 cmap subtables (all Noto fonts do).","Extend the selector to skip subtables whose format is not 4 or 12 and continue scanning for a supported one before throwing.","Exclude the offending font from the fallback-map generation input set."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (format != 4 && format != 12) { Log.Warn($\"{path} cmap format {format} unsupported; skipping.\"); return null; }","typeGuard":"static bool IsSupportedCmapFormat(ushort format) => format == 4 || format == 12;","tryCatchPattern":"try { ReadCmap(path); }\ncatch (Exception ex) when (ex.Message.Contains(\"cmap format\")) { Log.Warn($\"{path} unsupported cmap format; skipping.\"); }","preventionTips":["Use fonts that expose format 4 and/or format 12 cmap subtables.","Continue scanning encoding records for a supported format before throwing.","Exclude exotic fonts with only format 0/2/6/14 subtables from the input set."],"tags":["font","build-tool","fontfallbackpreprocessor","truetype","cmap"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}