Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: experimental/tools/generate-unicode-test-txt

Issue 2142023002: tools/SkShaper: SkStream->blob (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-07-12 (Tuesday) 11:34:35 EDT Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/SkShaper.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright 2016 Google Inc. 3 # Copyright 2016 Google Inc.
4 # 4 #
5 # Use of this source code is governed by a BSD-style license that can be 5 # Use of this source code is governed by a BSD-style license that can be
6 # found in the LICENSE file. 6 # found in the LICENSE file.
7 7
8 import array, zlib, base64, sys 8 import array, zlib, base64, sys
9 9
10 ## Source: http://www.unicode.org/Public/9.0.0/ucd/UnicodeData.txt 10 ## Source: http://www.unicode.org/Public/9.0.0/ucd/UnicodeData.txt
(...skipping 23 matching lines...) Expand all
34 4U8AAAAAAGDC/uKCSgAAgGu/n5EHAAAgP5L3GTW9bm1/ve6lUDy7rtvjtJ9x+aI81A0bPu/n+S3X 34 4U8AAAAAAGDC/uKCSgAAgGu/n5EHAAAgP5L3GTW9bm1/ve6lUDy7rtvjtJ9x+aI81A0bPu/n+S3X
35 Tr4i5fNCfTy7/vGL173b1AMAAAAgRcfn//37nAvekuGyxjdZypvukw3d4+mrW5QRkJsp7wVrigcF 35 Tr4i5fNCfTy7/vGL173b1AMAAAAgRcfn//37nAvekuGyxjdZypvukw3d4+mrW5QRkJsp7wVrigcF
36 e4ssaPUHWRCMr+es/EhWesftm4fzRs+6n8ehHL5TUR5WdVKPqMNKOO6q4zNz6gAAsOYHQH8EAAAA 36 e4ssaPUHWRCMr+es/EhWesftm4fzRs+6n8ehHL5TUR5WdVKPqMNKOO6q4zNz6gAAsOYHQH8EAAAA
37 ZKTt9kpj9jqf9Jzg5GMPtW+e3veM7L+XlDXgc837PllozPS8z/21xE8r/32nqcN+VFuE3fY72+61 37 ZKTt9kpj9jqf9Jzg5GMPtW+e3veM7L+XlDXgc837PllozPS8z/21xE8r/32nqcN+VFuE3fY72+61
38 uEqXmr36W2tbWKrls2pm9zuvMoybS7rGlr8KFMYnV/+eJPZjZUX3MClboTFFCR0biss5t5KX7Zd2 38 uEqXmr36W2tbWKrls2pm9zuvMoybS7rGlr8KFMYnV/+eJPZjZUX3MClboTFFCR0biss5t5KX7Zd2
39 jkOJ/c5nAmEeZ1gv9svJXxkuAAAAAACw4rJP0LdfdkSWZmVLFnj3wPLzue+Zrgw/t8gkHb59PeJY 39 jkOJ/c5nAmEeZ1gv9svJXxkuAAAAAACw4rJP0LdfdkSWZmVLFnj3wPLzue+Zrgw/t8gkHb59PeJY
40 ZZAm7fk7fdZvX49j+fDF69Fz+iYAABDHP/Vm9jbZIOpfwWoh0w== 40 ZZAm7fk7fdZvX49j+fDF69Fz+iYAABDHP/Vm9jbZIOpfwWoh0w==
41 ''' 41 '''
42 if sys.version_info[0] < 3: 42 if sys.version_info[0] < 3:
43 def to_unicode(i): 43 def to_unicode(i):
44 return unichr(i).encode('UTF-8') 44 return ('\U%08x' % i).decode('unicode-escape').encode('UTF-8')
45 else: 45 else:
46 def to_unicode(i): 46 def to_unicode(i):
47 return chr(i) 47 return chr(i)
48 o = sys.stdout 48 o = sys.stdout
49 o.write(to_unicode(0xFEFF)) 49 o.write(to_unicode(0xFEFF))
50 pack = array.array('I', zlib.decompress( 50 pack = array.array('I', zlib.decompress(
51 base64.b64decode(valid_codepoint_data))) 51 base64.b64decode(valid_codepoint_data)))
52 i = 0 52 i = 0
53 last_row = -1 53 last_row = -1
54 plist = pack.tolist() 54 plist = pack.tolist()
55 for increment in plist: 55 for increment in plist:
56 i += increment + 1 56 i += increment + 1
57 row = i - (i & 63) 57 row = i - (i & 63)
58 if last_row != row: 58 if last_row != row:
59 if row: 59 if row:
60 o.write('\n' if row % 1024 else '\n\n') 60 o.write('\n' if row % 1024 else '\n\n')
61 o.write('U+%06x ' % row) 61 o.write('U+%06x ' % row)
62 last_row = row 62 last_row = row
63 o.write(' ' + to_unicode(i)) 63 o.write(' ' + to_unicode(i))
64 o.write('\n') 64 o.write('\n')
OLDNEW
« no previous file with comments | « no previous file | tools/SkShaper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698