diff options
| author | bptato <nincsnevem662@gmail.com> | 2024-01-04 18:54:08 +0100 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2024-01-04 18:56:48 +0100 |
| commit | d4409baee1a510bf3361820cbdf4118ed09baffd (patch) | |
| tree | a579e85083fcdee24b262a9ff1b328921c2a3290 /src/data | |
| parent | c9337674db699951918225cddc56fcf75f313a15 (diff) | |
| download | chawan-d4409baee1a510bf3361820cbdf4118ed09baffd.tar.gz | |
charwidth: use pre-generated map file
Also for reducing compilation time.
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]) -)() |