unoplatform/uno · error · Exception

cmap format {format} not supported (only 4 and 12)

Error message

cmap format {format} not supported (only 4 and 12)

What it means

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.

Source

Thrown at src/FontFallbackPreprocessor/Program.cs:335

			throw new Exception("No supported cmap subtable found (Platform 3/Encoding 1 or 10, or Platform 0)");

		// 4. Parse subtable
		// The offset in the encoding record is relative to the beginning of the cmap table.
		long subtablePosition = cmapOffset + selectedSubtableOffset;
		fs.Seek(subtablePosition, SeekOrigin.Begin);
		ushort format = ReadUInt16Be(reader);

		if (format == 4)
		{
			return ReadFormat4(reader);
		}
		else if (format == 12)
		{
			return ReadFormat12(reader);
		}
		else
		{
			throw new Exception($"cmap format {format} not supported (only 4 and 12)");
		}
	}

	private static List<int> ReadFormat4(BinaryReader reader)
	{
		// Format 4 Header
		// length(2), language(2)
		_ = ReadUInt16Be(reader); // length
		_ = ReadUInt16Be(reader); // language

		// segCountX2(2), searchRange(2), entrySelector(2), rangeShift(2)
		ushort segCountX2 = ReadUInt16Be(reader);
		ushort segCount = (ushort)(segCountX2 / 2);
		reader.ReadBytes(6); // Skip searchRange, entrySelector, rangeShift

		// Arrays
		ushort[] endCounts = new ushort[segCount];
		for (int i = 0; i < segCount; i++) endCounts[i] = ReadUInt16Be(reader);

View on GitHub (pinned to 0418340488)

Solutions

  1. Prefer fonts that expose format 4 and/or format 12 cmap subtables (all Noto fonts do).
  2. Extend the selector to skip subtables whose format is not 4 or 12 and continue scanning for a supported one before throwing.
  3. Exclude the offending font from the fallback-map generation input set.
Defensive patterns

Strategy: validation

Validate before calling

if (format != 4 && format != 12) { Log.Warn($"{path} cmap format {format} unsupported; skipping."); return null; }

Type guard

static bool IsSupportedCmapFormat(ushort format) => format == 4 || format == 12;

Try / catch

try { ReadCmap(path); }
catch (Exception ex) when (ex.Message.Contains("cmap format")) { Log.Warn($"{path} unsupported cmap format; skipping."); }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of unoplatform/uno@0418340488 (2026-08-13). Data as JSON: /api/errors/26a6a978d4c31272. Report an issue: GitHub.