fn lookup_width(c: char, is_cjk: bool) -> usize
Expand description

Returns the UAX #11 based width of c by consulting a multi-level lookup table. If is_cjk == true, ambiguous width characters are treated as double width; otherwise, they’re treated as single width.

Maintenance

The tables themselves are autogenerated but this function is hardcoded. You should have nothing to worry about if you re-run unicode.py (for example, when updating Unicode.) However, if you change the actual structure of the lookup tables (perhaps by editing the TABLE_CFGS global in unicode.py) you must ensure that this code reflects those changes.