ws-arch2: font/bdf (read / write; FreeType reads our output identically) and font/pcf (every pad / unit / order, .pcf.gz via the api), shared bitmap-font fixtures vs FreeType

init.luau unwrap: a single-stream archive whose entry is a .pcf / .psf / .bdf loads as that font (category font).
This commit is contained in:
4DBug committed 2026-10-31 14:56:44 -05:00
1 parent f1c2c6ed06
commit 87cbc62fb6
11 files changed
+913 -2

No files matched your search

+8 -2
View File
@@ -240,7 +240,7 @@ end
-- .tar.gz) load as that inner archive, with meta.compression = the outer format. opts.unwrap = false keeps the outer
-- one; an explicit opts.format also does. Package archives name their payload entry in meta.payload (a .deb's
-- data.tar.xz): they load as that inner archive too, with meta.container = the outer format and meta.outer = the
-- outer archive (its control data).
-- outer archive (its control data). A single-stream archive holding a .pcf / .psf / .bdf font loads as the font.
local function unwrap(value: any, formatName: string, o: Options): any
if o.unwrap == false or o.format ~= nil or (o._depth or 0) >= 3 then
return value
@@ -261,12 +261,18 @@ local function unwrap(value: any, formatName: string, o: Options): any
if not rok or type(inner) ~= "buffer" then
return value
end
local category = "archive"
local e = detect(inner, nil, "archive", nil)
if not e and value.meta.stream and ((Input.extension(entryName) or "") == "pcf" or (Input.extension(entryName) or "") == "psf" or (Input.extension(entryName) or "") == "bdf") then
-- compressed bitmap fonts (.pcf.gz, .psf.gz, .bdf.gz: X11 and console font directories) load as the font
e = detect(inner, entryName, "font", nil)
category = "font"
end
if not e then
return value
end
local io = table.clone(o)
io.category = "archive"
io.category = category
io.name = entryName
io._depth = (o._depth or 0) + 1
local v = load(inner, io)