Skip to content

Commit

Permalink
Meta: cleanup visualize.py
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed Sep 7, 2020
1 parent bd50cc4 commit 5c42982
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions visualize.py
Expand Up @@ -68,7 +68,7 @@

def classify(code_point):
if code_point < 0x80:
raise Error()
raise Exception()
if code_point < 0x800:
return "mid"
if code_point > 0xFFFF:
Expand Down Expand Up @@ -118,10 +118,7 @@ def format_code_point(code_point):
# HTML prohibits C1 controls
# TODO draw some fancy SVG hex inside the square
return "<svg width=16 height=16><rect x=1 y=1 width=14 height=14 stroke=black stroke-width=2 fill=none /></svg>"
# Big5's Plane 2 stuff is non-combining, so let's deal with it first,
# since it need special treatment in narrow Python.
if code_point > 0xFFFF:
return chr(code_point)

as_str = chr(code_point)
if unicodedata.combining(as_str) == 0:
return as_str
Expand Down

0 comments on commit 5c42982

Please sign in to comment.