Commit 90d18b03 by Alexey Knyazev Committed by Commit Bot

Upgrade overlay fonts generator to Python 3

Bug: angleproject:5707 Change-Id: I809669d7a7de16ed2e098f59067c8e1d9c44a75c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2773292Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
parent 12342643
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
"src/libANGLE/Overlay_font_autogen.h": "src/libANGLE/Overlay_font_autogen.h":
"2eae247cebb716c4f591de8a251b4a8e", "2eae247cebb716c4f591de8a251b4a8e",
"src/libANGLE/gen_overlay_fonts.py": "src/libANGLE/gen_overlay_fonts.py":
"04d5b43c623f0d4376b982daccd60e6b" "9bbc8527ae797254884e9e17d49dacd1"
} }
\ No newline at end of file
#!/usr/bin/env vpython #!/usr/bin/env vpython3
# #
# [VPYTHON:BEGIN] # [VPYTHON:BEGIN]
# wheel: < # wheel: <
...@@ -186,14 +186,14 @@ def main(): ...@@ -186,14 +186,14 @@ def main():
font_height = 'kFontHeights[' + font_layer_symbol + ']' font_height = 'kFontHeights[' + font_layer_symbol + ']'
# Font pixels are packed in 32-bit values. # Font pixels are packed in 32-bit values.
font_array_width = output_cols * glyph_width / 32 font_array_width = output_cols * glyph_width // 32
font_array_height = output_rows * glyph_height font_array_height = output_rows * glyph_height
font_array = [[0] * font_array_width for i in range(font_array_height)] font_array = [[0] * font_array_width for i in range(font_array_height)]
for charIndex in range(len(chars)): for charIndex in range(len(chars)):
char = chars[charIndex] char = chars[charIndex]
base_x = (charIndex % output_cols) * glyph_width base_x = (charIndex % output_cols) * glyph_width
base_y = (charIndex / output_cols) * glyph_height base_y = (charIndex // output_cols) * glyph_height
# Render the character. # Render the character.
face.load_char(char) face.load_char(char)
...@@ -227,7 +227,7 @@ def main(): ...@@ -227,7 +227,7 @@ def main():
output_bit = 1 if pixel_value >= 122 else 0 output_bit = 1 if pixel_value >= 122 else 0
font_array_row = base_y + y font_array_row = base_y + y
font_array_col = (base_x + x) / 32 font_array_col = (base_x + x) // 32
font_array_bit = (base_x + x) % 32 font_array_bit = (base_x + x) % 32
font_array[font_array_row][font_array_col] |= output_bit << font_array_bit font_array[font_array_row][font_array_col] |= output_bit << font_array_bit
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment