mirror of
https://git.planet-casio.com/Lephenixnoir/fxsdk.git
synced 2025-06-03 01:15:12 +02:00
Compare commits
5 commits
b1a696b996
...
ce0784f765
Author | SHA1 | Date | |
---|---|---|---|
|
ce0784f765 | ||
|
e426868caf | ||
|
207cff6a10 | ||
|
79d2fc63a4 | ||
|
bf21598ea6 |
1 changed files with 27 additions and 6 deletions
|
@ -790,7 +790,8 @@ def convert_topti(input, params):
|
|||
glyph = _trim(glyph)
|
||||
data_width.append(glyph.width)
|
||||
|
||||
length = 4 * ((glyph.width * glyph.height + 31) >> 5)
|
||||
storage_size = ((glyph.width * glyph.height + 31) >> 5)
|
||||
length = 4 * storage_size
|
||||
bits = bytearray(length)
|
||||
offset = 0
|
||||
px = glyph.load()
|
||||
|
@ -811,17 +812,37 @@ def convert_topti(input, params):
|
|||
#---
|
||||
|
||||
if "py" in params and params["py"]["enabled"]:
|
||||
title = params.get("title", "")
|
||||
l = [ "import gint\n",
|
||||
f"{params['name']} = gint.font({title or None}, {flags}, ",
|
||||
f"{params['name']} = gint.font({flags}, ",
|
||||
f"{line_height}, {grid.h}, {len(blocks)}, {glyph_count}, ",
|
||||
f"{char_spacing}, ",
|
||||
f"{char_spacing}, {line_distance}, ",
|
||||
data_blocks,
|
||||
", ",
|
||||
data_glyphs ]
|
||||
if proportional:
|
||||
l += [data_index, data_width]
|
||||
l += [f", {0}, {0}"]
|
||||
l += [f", ", data_index, f", ", data_width]
|
||||
else:
|
||||
l += [f"{grid.w}, {(grid.w * grid.h + 31) >> 5}"]
|
||||
return l + [")\n"]
|
||||
l += [f", {grid.w}, {storage_size}"]
|
||||
#l += [f", ", None, f", ", None]
|
||||
l += [f", {None}, {None}"]
|
||||
l += [", ", repr(title), ")\n"]
|
||||
|
||||
print(f"Output to Python variable {params['name']} ({title!r})")
|
||||
print(f" -", ["Monospaced","Proportional"][proportional], "font")
|
||||
print(f" - Number of Blocks : {len(blocks)}")
|
||||
print(f" - Number of Glyphs : {glyph_count}")
|
||||
print(f" - Size of Block Data : {len(data_blocks)}")
|
||||
print(f" - Size of Glyph Data : {len(data_glyphs)}")
|
||||
if not proportional:
|
||||
print(f" - Width x Height : {grid.w} x {grid.h}")
|
||||
print(f" - Storage size (u32) : {storage_size}")
|
||||
else:
|
||||
print(f" - Size of Index Data : {len(data_index)}")
|
||||
print(f" - Size of Width Data : {len(data_width)}")
|
||||
return l
|
||||
|
||||
|
||||
# Base data: always put the raw data and blocks first since they are
|
||||
# 4-aligned, to preserve alignment on the rest of the references.
|
||||
|
|
Loading…
Add table
Reference in a new issue