font formats: comments are specs only

This commit is contained in:
4DBug committed 2026-11-01 01:52:57 -05:00
1 parent 0452f26eef
commit d91dc6c597
14 files changed
+64 -167

No files matched your search

+4 -7
View File
@@ -1,9 +1,7 @@
--!strict
-- font/ttf: TrueType and OpenType fonts (.ttf, .otf with CFF outlines) and collections (.ttc / .otc), read into the
-- standard Font (Types.Font) by codecs/font/TrueType: metrics, names, cmap, outlines (glyf or CFF), kerning ('kern' table,
-- GPOS pair kerning) and rasterize(glyph, px) through codecs/image/Raster. Ported from stb_truetype 1.26 (public domain /
-- MIT) via imgui-luau's imstb_truetype.lua; see codecs/font/TrueType. opts.index picks the font of a collection.
-- Not supported: hinting, variable fonts, bitmap / colour glyphs, GSUB, writing.
-- font/ttf: TrueType / OpenType (glyf or CFF) fonts and collections via codecs/font/TrueType, ported from stb_truetype
-- 1.26 (public domain / MIT) via imgui-luau's imstb_truetype.lua. Not supported: hinting, variable fonts, bitmap /
-- colour glyphs, GSUB, writing.
-- ------------------------------------------------------------------------------------------------ requires
local Err = require("@rosetta/core/Err")
@@ -21,7 +19,7 @@ local Ttf = {
}
export type DecodeOptions = {
index: number?, -- the font of a collection (default 0)
index: number?, -- default 0
}
-- ------------------------------------------------------------------------------------------------ sniff
@@ -44,7 +42,6 @@ function Ttf.decode(r: Bytes.Reader, opts: DecodeOptions?): (any, Err.Err?)
end
-- ------------------------------------------------------------------------------------------------ extras
-- count(r) -> the number of fonts in the file (1 unless a collection)
function Ttf.count(r: Bytes.Reader): number
return TrueType.count(r.buf, r.base)
end