mirrorSymbol function
Returns the horizontal mirror of an FSW symbol key (e.g. S2e748).
Symbols that don't exist in the font — and the handful with no representable ISWA mirror — pass through unchanged.
Implementation
String mirrorSymbol(String symbol) {
final override = _specialMirrorOverrides[symbol];
if (override != null) return override;
final reverse = _specialMirrorReverse[symbol];
if (reverse != null) return reverse;
if (_noMirrorSymbols.contains(symbol)) return symbol;
if (!_exists(symbol)) return symbol;
final base = symbol.substring(0, 4);
final fill = symbol[4];
final rotation = int.parse(symbol[5], radix: 16);
final section = _section(base);
final Tuple2<String, int> mirrored;
switch (section) {
case 'hand':
mirrored = _mirrorHand(fill, rotation);
break;
case 'contact':
mirrored = _mirrorContact(base, fill, rotation);
break;
case 'movement':
mirrored = _mirrorMovement(base, fill, rotation);
break;
default:
mirrored = _mirrorFace(base, fill, rotation);
}
final candidate = '$base${mirrored.item1}${mirrored.item2.toRadixString(16)}';
return _exists(candidate) ? candidate : symbol;
}