Embed the official ORCID logo as a PDF image

This commit is contained in:
gloamxun committed 2026-10-19 22:43:24 +08:00
1 parent 69edbf56b6
commit 769e3cdf17
8 files changed
+49 -46

No files matched your search

+5 -10
View File
@@ -65,16 +65,11 @@ the printpdf writer.
### ORCID author icon
`orcid.pdf` is an image inside `\author`, but metadata currently keeps text
only. The title author-row renderer needs a positioned-image item that accepts an
x offset (the current `PositionedPageItem::Image` is pinned to x = 0) and a
small PNG/vector badge loaded from repository assets. The current fallback is
`PositionedPageItem::Badge`: a native rounded polygon in the PDF (through the
vendored `genpdf::Area::fill_rounded_rect`) and a rounded `rect` in SVG, with a
white `iD` label. An earlier 256 px PNG experiment was reverted because genpdf
emitted a 12x12 px image regardless of `Image::with_scale`. Replacing the
polygon with the official ORCID bitmap still needs an image writer that keeps
the requested size and an x offset.
Completed: `\orcidlink` and ORCID author URLs use the bundled official logo
`assets/orcid-logo.png` (rasterized from the template's `orcid.pdf`), embedded
at 2.2 mm before the author name. SVG preview keeps the rounded `rect` shape.
The PDF badge is positioned by `PositionedPageItem::Badge` and carries its
`/Link` annotation. No remaining template-specific icon path is needed.
### First-page paragraph break
+13 -15
View File
@@ -107,18 +107,16 @@ See `docs/ROADMAP.md` for concrete implementation plans.
the next page.
- Contents: chapter headings are listed with chapter-prefixed section
numbers, but contents are not split per chapter.
- Preprint title blocks: ORCID links in `\author` render as a native vector
badge (rounded ORCID-green polygon with a white iD, drawn natively in PDF
and SVG) before the author name; the original bitmap ORCID logo is not
embedded.
Hyperlinks use hyperref's green text colour; visible `\url` text,
`\href` display labels, and ORCID author badges emit PDF `/Link` URI
annotations (`/Annots`).
Metadata baselines match the reference within 0.3 pt and page 1 keeps the
same closing section-2 line as the reference. `printpdf 0.3.4` has no
annotation API, so the link is added by reopening the finished PDF with
lopdf and extending each page dictionary. Extending this to `\href`/ORCID
labels (and API-provided ORCID icon images) is the next step.
- Preprint title blocks: ORCID links in `\author` embed the bundled
official ORCID logo (`assets/orcid-logo.png`, rasterized from the
template's `orcid.pdf`) as a 2.2 mm image before the author name; the SVG
preview keeps a rounded `rect` fallback. Hyperlinks use hyperref's green
text colour; visible `\url` text, `\href` display labels, and ORCID author
badges emit PDF `/Link` URI annotations (`/Annots`). Metadata baselines
match the reference within 0.3 pt and page 1 keeps the same closing
section-2 line as the reference. `printpdf 0.3.4` has no annotation API,
so the link is added by reopening the finished PDF with lopdf and extending
each page dictionary.
## Verification
@@ -128,7 +126,7 @@ See `docs/ROADMAP.md` for concrete implementation plans.
3.6 MB and `pdffonts` reports only embedded CID TrueType faces); this avoids
viewer-dependent glyph substitution. Tables use natural column widths and
centered rules; preview and PDF share the same table line coordinates.
- `cargo fmt --check` passes; `cargo test --offline` (58 tests: 53 compiler
- `cargo fmt --check` passes; `cargo test --offline` (58 tests: 54 compiler
integration tests + 4 server tests) covers the three examples, the arXiv
fixture, figure/table floats (top and bottom), newpage, page styles and `\thispagestyle`, SVG/PDF output,
project API, static frontend assets, path traversal, the legacy
@@ -139,7 +137,7 @@ See `docs/ROADMAP.md` for concrete implementation plans.
- Compiler integration tests: 53; server tests: 4; total 57.
- `cargo fmt --check` passes.
- arXiv fixture: 3 Letter pages, ~0.50 MB; four serif faces and one monospace face embedded (bold/italic monospace falls back to the regular face). The bundled SubsetTTF faces are pyftsubset outputs with retained glyph ids and a filtered legacy kern table; a second smaller Latin-1/Greek tier is selected when the document charset fits.
- arXiv fixture: 3 Letter pages, ~0.53 MB; four serif faces and one monospace face embedded (bold/italic monospace falls back to the regular face). The bundled SubsetTTF faces are pyftsubset outputs with retained glyph ids and a filtered legacy kern table; a second smaller Latin-1/Greek tier is selected when the document charset fits.
- Title/author/date/Introduction baselines within 0.3 pt of the XeLaTeX
reference; page 1 keeps the closing section-2 line above the footnote.
- Table 61.1 mm wide (reference 61.2 mm) with `\multicolumn` spans and
@@ -148,4 +146,4 @@ See `docs/ROADMAP.md` for concrete implementation plans.
- PDF link annotations are added by reopening the finished PDF with lopdf,
since printpdf 0.3.4 has no annotation API.
- Fonts: bundled reserved-glyph subsets in `assets/fonts-subset/` are used when the document charset is covered; arXiv PDF is about 0.50 MB with 58 tests.
- Fonts: bundled reserved-glyph subsets in `assets/fonts-subset/` are used when the document charset is covered; arXiv PDF is about 0.53 MB with 58 tests.