diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05d6155..493112e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,15 +66,23 @@ jobs: ~/.cache/gamba-tools ~/.cache/apt-archives key: gamba-${{ runner.os }}-${{ hashFiles('corpus/manifest.yml', '.github/workflows/ci.yml') }} + # A change to this file starts from the previous cache: without its packages, the fallback below has none. + restore-keys: gamba-${{ runner.os }}- # 2026-11-04: Azure's Ubuntu mirror stalls for minutes on libmupdf (34 MB), which cancelled whole jobs: the # packages come from the cache, and a stalled attempt is cut after 90 seconds and resumed. + # 2026-11-11: the mirror stopped answering apt-get update for hours: the cached packages are then installed + # as they are. - name: Install the PDF tools timeout-minutes: 6 run: | mkdir -p ~/.cache/apt-archives/partial for attempt in 1 2 3; do - sudo timeout 90 apt-get update && sudo timeout 90 apt-get install --yes \ - -o Dir::Cache::Archives="$HOME/.cache/apt-archives" mupdf-tools poppler-utils qpdf && break + if sudo timeout 90 apt-get update; then + sudo timeout 90 apt-get install --yes \ + -o Dir::Cache::Archives="$HOME/.cache/apt-archives" mupdf-tools poppler-utils qpdf && break + else + sudo dpkg --install ~/.cache/apt-archives/*.deb && break + fi test "$attempt" -lt 3 || exit 1 done sudo chown -R "$USER" ~/.cache/apt-archives diff --git a/README.md b/README.md index 5923587..d81cad1 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,22 @@ version of the API Gamba reproduces, for code that checks it. Gamba's own versio Anything that would change how a page looks compared with Prawn is off until you ask for it. +An API of its own, next to Prawn's. The block receives the document instead of running inside it, options are +keywords, and a mistyped one raises instead of being ignored: + +```ruby +document = Gamba.document(page_size: "A4", lang: "en") do |document| + document.style :title, size: 18, weight: :bold + document.text "Invoice INV-2026-0001", style: :title + document.draw InvoiceLines.new(invoice) # any object with call(document) +end +document.write("invoice.pdf") +``` + +Code written for Prawn adopts it one block at a time, `gamba { |document| document.text "Total", style: :title }`, +and `document.prawn` gives a native document all of Prawn's API. Text, styles and components are there today; +layout comes next ([the plan](https://github.com/levups/gamba/issues/69)). + Ligatures and kerning from OpenType fonts, per font: ```ruby diff --git a/docs/guide.html b/docs/guide.html index dcc33df..06aaf9b 100644 --- a/docs/guide.html +++ b/docs/guide.html @@ -33,10 +33,11 @@

Guide

-

Gamba answers to Prawn’s API: installing it is swapping gems. This page covers what it brings on top.

+

Gamba answers to Prawn’s API: installing it is swapping gems. This page covers what it brings on top, and its own API, which existing code adopts one block at a time.