diff options
Diffstat (limited to 'src/data')
| -rw-r--r-- | src/data/charwidth.nim | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/src/data/charwidth.nim b/src/data/charwidth.nim deleted file mode 100644 index c19647f0..00000000 --- a/src/data/charwidth.nim +++ /dev/null @@ -1,42 +0,0 @@ -import strutils - -const ( - DoubleWidthRanges*, - DoubleWidthAmbiguousRanges*, - HalfWidthRanges* -) = (func(): ( - seq[(uint32, uint32)], - seq[(uint32, uint32)], - seq[(uint32, uint32)] - ) = - template add(firstcol: string, res: var seq[(uint32, uint32)]) = - if firstcol.contains(".."): - let fcs = firstcol.split("..") - let rstart = uint32(parseHexInt(fcs[0])) - let rend = uint32(parseHexInt(fcs[1])) - res.add((rstart, rend)) - else: - let cp = uint32(parseHexInt(firstcol)) - res.add((cp, cp)) - const map = staticRead"res/map/EastAsianWidth.txt" - for line in map.split('\n'): - if line.len == 0 or line[0] == '#': - continue - var i = 0 - var firstcol = "" - var status = "" - while i < line.len and line[i] notin {'#', ';'}: - if line[i] != ' ': - firstcol &= line[i] - inc i - if line[i] != '#': - inc i - while i < line.len and line[i] notin {'#', ';'}: - if line[i] != ' ': - status &= line[i] - inc i - case status - of "W", "F": add(firstcol, result[0]) - of "A": add(firstcol, result[1]) - of "H": add(firstcol, result[2]) -)() |