ws-arch2: font/psf (PSF 1 / 2 read + write, Unicode tables kept on round trip, .psfu.gz via the api); Types.BitmapStrike.map (extra code points per glyph, additive)
This commit is contained in:
1 parent
1b0bc158e8
commit
19f486031d
9 files changed
+545
-8
No files matched your search
@@ -1,10 +1,14 @@
|
||||
-- tools/fixtures/_bitmapfonts_ours.luau: our bitmap font writers' output for FreeType to read back (run by
|
||||
-- tools/fixtures/bitmapfonts.py after it wrote tests/gen/bitmapfonts_src.luau): decodes each source font with its
|
||||
-- format and prints "<case> <hex of our BDF>" lines.
|
||||
-- tools/fixtures/_bitmapfonts_ours.luau: our bitmap font writers' output for the reference tools to read back (run by
|
||||
-- tools/fixtures/bitmapfonts.py / psf.py after they wrote the source fonts to tests/gen/<src>.luau:
|
||||
-- `luau _bitmapfonts_ours.luau -a <src> <format> [version]`): decodes each source font with its format, encodes it
|
||||
-- with <format> (default bdf) and prints "<case> <hex>" lines.
|
||||
local F = require("@formats")
|
||||
local Bytes = require("@formats/core/Bytes")
|
||||
local Deflate = require("@formats/codecs/compress/Deflate")
|
||||
local Src = require("@tests/gen/bitmapfonts_src")
|
||||
|
||||
local srcName, outFormat, version = ...
|
||||
local Src = if srcName == "psf_src" then require("@tests/gen/psf_src") else require("@tests/gen/bitmapfonts_src")
|
||||
local enc = F.format(outFormat or "bdf") :: any
|
||||
|
||||
local function hex(b: buffer): string
|
||||
local t = table.create(buffer.len(b))
|
||||
@@ -21,8 +25,8 @@ for _, c in Src.fonts do
|
||||
end
|
||||
local mod = F.format(c.format) :: any
|
||||
local font = if mod then mod.decode(Bytes.reader(data)) else nil
|
||||
if font and F.format("bdf") then
|
||||
local out = (F.format("bdf") :: any).encode(font)
|
||||
if font and enc then
|
||||
local out = enc.encode(font, { version = tonumber(version) })
|
||||
if out then
|
||||
print(c.name .. " " .. hex(out))
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user