Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/unicode10'
Browse files Browse the repository at this point in the history
  • Loading branch information
LettError committed Sep 26, 2017
2 parents a6cd17d + c833a06 commit 7383f03
Show file tree
Hide file tree
Showing 45 changed files with 359,480 additions and 295,096 deletions.
12 changes: 11 additions & 1 deletion Lib/glyphNameFormatter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from tools import unicodeToChar


__version__ = "0.1"
__version__ = "0.28"


def debug(uniNumber):
Expand Down Expand Up @@ -243,6 +243,16 @@ def compress(self):
# remove the spaces from the name
self.uniNameProcessed = self.uniNameProcessed.replace(" ", "")

def camelCase(self):
# whole name camelcased to lowercase
parts = self.uniNameProcessed.split(" ")
if len(parts) < 2:
self.lower()
return
casedParts = [a[0].upper()+a[1:].lower() for a in parts]
self.uniNameProcessed = "".join(casedParts)
self.uniNameProcessed = self.uniNameProcessed[0].lower() + self.uniNameProcessed[1:]

def lower(self):
# whole name to lowercase
self.uniNameProcessed = self.uniNameProcessed.lower()
Expand Down
4 changes: 3 additions & 1 deletion Lib/glyphNameFormatter/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
# ================

unicodelist = {}
unicodeCategories = {}

flatUnicodePath = os.path.join(path, "flatUnicode.txt")

Expand All @@ -92,9 +93,10 @@
if not line:
# empty line
continue
uniNumber, uniName = line.split("\t")
uniNumber, uniName, uniCategory = line.split("\t")
uniNumber = int(uniNumber, 16)
unicodelist[uniNumber] = uniName
unicodeCategories[uniNumber] = uniCategory

unicodeVersion = lines[0].replace("#", "").strip()

Expand Down
15 changes: 11 additions & 4 deletions Lib/glyphNameFormatter/data/buildFlatUnicodeList.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
from urllib.request import urlopen

__doc__ = """
This will parse the large ucd xml into a simple list that is workable and
is fair enough for download and embeding.
This will parse the large ucd xml from unicode.org
into a simple list that is workable and
is fair enough for download and embedding.
starts with the # unicode description/version
Expand All @@ -21,6 +22,8 @@
"""

URL = "http://www.unicode.org/Public/{version}/ucdxml/ucd.all.flat.zip"

UNICODE_VERSION = "10.0.0"
UCD_ZIP_FILE = "ucd.all.flat.zip"
UCD_FILE = UCD_ZIP_FILE[:-3] + "xml"
FLAT_FILE = "flatUnicode.txt"
Expand All @@ -42,7 +45,11 @@
tempdir = tempfile.mkdtemp()
filename = os.path.join(tempdir, UCD_ZIP_FILE)
print(">> Downloading {} to {}".format(UCD_ZIP_FILE, filename))
url = urlopen(URL.format(version=options.unicode_version))
if options.unicode_version:
version = options.unicode_version
else:
version = UNICODE_VERSION
url = urlopen(URL.format(version=version))
with open(filename, "wb") as fp:
blocksize = 8192
while True:
Expand All @@ -66,7 +73,7 @@
if i.tag.endswith("char"):
n = i.attrib.get("na")
if n:
flat.append("%s\t%s" % (i.attrib.get("cp"), n))
flat.append("%s\t%s\t%s" % (i.attrib.get("cp"), n, i.attrib.get("gc")))


f = open(FLAT_FILE, "w")
Expand Down
360,930 changes: 194,514 additions & 166,416 deletions Lib/glyphNameFormatter/data/conflict.txt

Large diffs are not rendered by default.

Loading

0 comments on commit 7383f03

Please sign in to comment.