Files
browser/build.zig.zon
T
Karl SeguinandAdrià Arrufat 789ec07545 screenshot: --dump png and Page.captureScreenshot with a Zig rasterizer
Lightpanda has no layout engine, so a screenshot is the page's text
content flowed into blocks, the same content the markdown dump produces,
word-wrapped and rasterized. The DOM walk (src/browser/screenshot.zig),
CDP wiring, viewport/clip/scale handling and tests are from #3231; the
rasterizer behind the block/span model is Zig instead of a Rust crate:

- z2d (pure Zig, MPL-2.0) for glyph outlines, antialiased fills and
  compositing, from the arrufat/z2d fork's lightpanda branch: upstream
  plus one line exporting glyph metrics, since z2d has no public
  text-measurement API and takes no public pull requests.
- the ICU bundled in V8's static archive for bidi (ubidi), Arabic
  shaping to presentation forms (u_shapeArabic) and UAX #14 line
  breaking (ubrk). Symbols carry ICU's major version. The shared dev
  build of V8 hides them behind its version script; until a prebuilt
  ships with lightpanda-io/zig-v8-fork#201, build and test with
  -Dprebuilt_v8_path pointing at the static archive.
- gpos.zig, a reader for the fonts' mark-to-base, mark-to-ligature and
  mark-to-mark lookups, so harakat, niqqud and combining Latin accents
  anchor to their base. Tashkeel come back from ICU as FE70-block forms
  with no anchors and are mapped back to the bare marks first.
- glyph masks rasterized once per unique glyph and quarter-pixel phase
  into an alpha8 scratch sized from the outline's bbox, then blitted
  directly; PNG streamed scanline-in / IDAT-out through the zlib the
  binary already links. Renderer state is arena-owned per call.
- four bundled DejaVu 2.37 faces, including Sans Mono Bold.

Output matches the parley/tiny-skia renderer of #3231 line for line on
Latin, Arabic, Hebrew, mixed-direction and vocalized text; release
builds render a dense page in about 23ms against 58ms.

Co-authored-by: Adrià Arrufat <adria.arrufat@gmail.com>
2026-08-24 23:39:46 +02:00

53 lines
2.5 KiB
Zig

.{
.name = .browser,
.version = "1.0.0-dev",
.fingerprint = 0xda130f3af836cea0, // Changing this has security and trust implications.
.minimum_zig_version = "0.16.0",
.dependencies = .{
.v8 = .{
.url = "https://github.com/lightpanda-io/zig-v8-fork/archive/57747955a59f09147b4dc1142152f0d960b2c7e1.tar.gz",
.hash = "v8-0.0.0-xddH6x4GAwB6psyI4sllqMbK7cLkz-Bo3xC9WDheGksn",
},
// .v8 = .{ .path = "../zig-v8-fork" },
.brotli = .{
// v1.2.0
.url = "https://github.com/google/brotli/archive/028fb5a23661f123017c060daa546b55cf4bde29.tar.gz",
.hash = "N-V-__8AAJudKgCQCuIiH6MJjAiIJHfg_tT_Ew-0vZwVkCo_",
},
.zlib = .{
.url = "https://github.com/madler/zlib/releases/download/v1.3.2/zlib-1.3.2.tar.gz",
.hash = "N-V-__8AAJ2cNgAgfBtAw33Bxfu1IWISDeKKSr3DAqoAysIJ",
},
.nghttp2 = .{
.url = "https://github.com/nghttp2/nghttp2/releases/download/v1.69.0/nghttp2-1.69.0.tar.gz",
.hash = "N-V-__8AAMHpvwChC6orFCDB8MeiumT6OlfmKfmrWlak7Int",
},
.@"boringssl-zig" = .{
.url = "git+https://github.com/lightpanda-io/boringssl-zig.git#f07cc58fa4a051eb0985287e691db5dbb0e7e76f",
.hash = "boringssl-0.1.0-VtJeWd1OAAAQ5AuNOZGP5a_5ZyNn5BfeE-jiKqEm2gsE",
},
// .@"boringssl-zig" = .{ .path = "../boringssl-zig" },
.curl = .{
.url = "https://github.com/curl/curl/releases/download/curl-8_20_0/curl-8.20.0.tar.gz",
.hash = "N-V-__8AAHM9RQHjzJo8Wn4dbGPqNOC21zZJJA9PcCj7FPF5",
},
.sqlite3 = .{
.url = "https://github.com/allyourcodebase/sqlite3/archive/7a615f5af79009cd733e3480658586d9b0d28b35.tar.gz",
.hash = "sqlite3-3.53.2-DMxLWuAOAAA_Px0arJOIOaP4AKEu5prbsQgPMA35W1zz",
},
.zenai = .{
.url = "git+https://github.com/lightpanda-io/zenai.git#5c208f61c5b6b0bc46ceaf2670d0d267b1eef87e",
.hash = "zenai-0.0.0-iOY_VKQ9BgC0_zD9nj_EedEkNioEJnGqoKsHWcq27D74",
},
.z2d = .{
.url = "git+https://github.com/arrufat/z2d?ref=lightpanda#0cb4284b4e6bb697a1c1ae9baa138969ecb32577",
.hash = "z2d-0.12.2-pre-j5P_HgE9EQBji5eF89ddAHaihfzMifj6c-uocwjCTpTy",
},
.isocline = .{
.url = "git+https://github.com/arrufat/isocline?ref=lightpanda#832a9fe25f5f4458fcc47b5acc7c21db669c2f47",
.hash = "N-V-__8AANtqEwD-jr5LWeksHDYkaQSpLbu6MRHFvlPURIik",
},
},
.paths = .{""},
}