| 58 | const FONT: Map<number, Uint8Array> = decodeFont() |
| 59 | |
| 60 | function decodeFont(): Map<number, Uint8Array> { |
| 61 | const buf = Buffer.from(FONT_B64, 'base64') |
| 62 | const count = buf.readUInt16LE(0) |
| 63 | const map = new Map<number, Uint8Array>() |
| 64 | let off = 2 |
| 65 | for (let i = 0; i < count; i++) { |
| 66 | const cp = buf.readUInt32LE(off) |
| 67 | off += 4 |
| 68 | map.set(cp, buf.subarray(off, off + GLYPH_BYTES)) |
| 69 | off += GLYPH_BYTES |
| 70 | } |
| 71 | return map |
| 72 | } |
| 73 | |
| 74 | export type AnsiToPngOptions = { |
| 75 | /** Integer zoom factor (nearest-neighbor). Default 1 — the font is already rasterized at output resolution. */ |