glyphNameToUnicode property

Map<String, int> get glyphNameToUnicode

Implementation

static Map<String, int> get glyphNameToUnicode {
  final Map<String, int>? cached = _unicodeCache;
  if (cached != null) return cached;
  final Map<String, int> map = <String, int>{};
  final List<String> win = winAnsiEncoding;
  for (int code = 32; code <= 126; code++) {
    if (win[code].isNotEmpty) map.putIfAbsent(win[code], () => code);
  }
  for (int code = 160; code <= 255; code++) {
    if (win[code].isNotEmpty) map.putIfAbsent(win[code], () => code);
  }
  final List<String> pairs = _extraUnicode.split(" ").where((String value) => value.isNotEmpty).toList();
  for (int i = 0; i + 1 < pairs.length; i += 2) {
    final int? value = int.tryParse(pairs[i + 1], radix: 16);
    if (value != null) map[pairs[i]] = value;
  }
  _unicodeCache = map;
  return map;
}