Repository navigation
chore(deps): update Rust crate printpdf to v0.12.9 - #252
Merged
Merged
Conversation
|
This pull request is merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
0.12.8→0.12.9Release Notes
fschutt/printpdf (printpdf)
v0.12.9Compare Source
azul 0.0.17 (azul#476). The azul-css / azul-core / azul-layout pins move to
0.0.17: the HTML components use azul-core's
ComponentCodegen,FontHashcarries
synthetic_bold, and paged layout fixes azul#478 (a table thatoverflows a page now fills every non-final page; the regression tests from
#291 run by default). Also in this release: pictures decoded per page and
written with 1 bit where possible (#290), from_html errors (#294), Arabic
shaping in the SVG preview (#293), text color alpha (#287), same-page bookmark
order (#282) and the multiple-fonts example (#283).
from_htmlno longer answersOkwith an empty document. When the HTMLloader could not read the page (for example a character XML 1.0 excludes,
such as U+FFFE or a C0 control, reaching azul's strict loader), the
conversion returned
Ok(PdfDocument)with no pages and the reason only inwarnings, so callers rendered blank output without noticing (pdfocr #11).from_html,from_html_with_cacheandfrom_html_debug_with_cachenowreturn
Errwith the loader's messages joined;warningsstill gets thedetails. Test:
tests/html_errors.rs.The SVG preview shows shaped text the way the PDF does (Arabic joins).
PdfPage::to_svg, which the web demo's page view uses, wrote every shapedglyph back out as its Unicode text, one
<text>per glyph, and the browsershaped each character again on its own: Arabic came out as isolated,
unjoined letters (and ligatures and Indic conjuncts fell apart), and a
parsed PDF's visual-order line was bidi-reversed a second time. The PDF
itself was always shaped correctly. Glyph-id runs are now painted from the
glyph outlines (
<defs>+<use>), pen-advanced by the same/Wwidths aPDF viewer uses; the
<text>stays as an unpainted layer for selection andsearch. Text written as
TextItem::Textand the builtin fonts render asbefore. Tests:
tests/arabic_shaping.rs.A CID-keyed CFF font read from a PDF keeps its glyph widths. The
synthesized
hmtxof a bare CFF program took a glyph's first stemcoordinate as its width when the first hint operator sat in a subroutine
and had no width operand (NotoSansJP's 語: advance 0, so the rest of a
parsed line was drawn on top of it). Test:
tests/parsed_cff_widths.rs.HTML: a page decodes only the pictures it shows.
PdfDocument::from_html*copied (and base64-decoded) every entry of the
imagesmap, and the bridgedecoded every one of them, on every call, whether the page's HTML used it or
not; every decoded picture was also embedded. Rendering a 1053-page book page
by page with its 57 pictures in the map took 22 minutes (1.26 s a page);
handing each page only the pictures its
<img src>names took 3.5 (0.24 s apage). After layout, the renderer now collects the
<img src>values the pagesdraw and looks up, decodes and embeds only those, once each
(
bridge::referenced_image_srcs). The same holds forxml_to_pdf_pages,add_xml_to_documentandfrom_html_debug*(which also no longer decodesevery picture twice).
bridge::resolve_html_imagesstill decodes a whole map.there used to make
from_html*returnErr("Base64 decode error: …").base64-decoded or decoded, is now a warning in
from_html*'swarningsnaming its
src(the<img>draws nothing, as before). A bad base64 stringfor a shown picture used to fail the whole call.
Tests:
tests/html_images_on_demand.rs, and the decode count insrc/html/mod.rs(an_image_the_page_does_not_reference_is_not_decoded).HTML text now honours color alpha. The HTML bridge emitted text fill
colors from the RGB channels only, so
color: transparentpainted opaqueblack glyphs and
color: rgba(…, 0.5)painted fully opaque ones. Each textrun whose color is not opaque now gets its own
q … Qscope:transparent) uses text rendering mode 3 (3 Tr, invisible). Theglyphs stay selectable, searchable and extractable, which is how OCR text
layers over a page scan work.
ExtGStatewith the fill/stroke alpha, the same waytranslucent rects already did.
Inline
background-colorbehind glyph runs had the same bug (translucentbackgrounds were painted opaque) and now gets the same
ExtGState. Opaque textemits exactly the same ops as before. Tests:
tests/html_text_alpha.rs.Smaller text: one text object per line instead of one per word (#288).
A page of HTML text in a base-14 family wrote two text objects per word
(
Tf BT /Span <</ActualText …>> BDC Tm TJ EMC ETfor the word, again forthe space). On a 1000-word book page the Flate-compressed content stream
goes from 45 KB to 17 KB with positioned words, and from 32 KB to 12 KB with
flowing paragraphs. Rendering and extracted text are unchanged.
defaultfonts/had a glyph for U+0020 or U+00A0, so every space fell backto a system font (HelveticaNeue on macOS): a font switch, and a new glyph
run, at every word, plus a second, machine-dependent font in the PDF. Each
subset now has an empty
spaceglyph with the standard base-14 advance,appended so existing glyph ids are unchanged (
scripts/add_space_glyphs.py).!,”and a few others are still missing (see #288).optimizemerges text objects (src/text_merge.rs): consecutive textobjects with only text state between them become one, a font or fill colour
that is already set is not set again, and
/ActualTextspans that followeach other on one baseline become one span with the joined text.
same-baseline merger wrote a kern after almost every glyph for the
fraction-of-a-unit difference between the layout's positions and the integer
/Wwidths ([<0030> -0.16767642<0041> …]). Kerns are now rounded to wholethousandths of an em, with the exact pen position carried along so the error
stays below half a unit, and glyphs without a kern between them share one
hex string.
Regression test for azul#478 — multi-page tables broke about a third early.
tests/html_table_page_breaks.rsrenders the reporter's fixture (one<table>ofidentical single-line rows, default A4, no
break-*CSS), finds the single-pagecapacity by bisection, and asserts that once the table overflows every non-final
page is still filled. Against azul-layout 0.0.16 a table of capacity + 1 rows
paginates as 32 + 18 (the reporter saw 29 + 17), so both tests are
#[ignore]duntil the azul pins move past the fix; run them with
--ignoredto check apatched azul-layout, and drop the attribute on the bump.
For the record, this is not the 0.12.6 policy switch: 0.12.6 already ran
break-aware pagination against azul 0.0.14 and paginated the same fixture as
45 + 1. Two azul-layout defects combine in 0.0.16. The trigger: the display
list widens an overflow-visible node's text clip to its "scroll content size",
which is floored at the node's BORDER box, from the content-box origin, so each
cell's text clip runs
padding-toppixels into the next row and the rows'avoid-ranges overlap. The amplifier, latent since the break-aware paginator was
written:
page_breaks::snap_break_uptook every containing range as nesting, so aftersnapping to a row's top the break was "inside" the previous row, snapped again,
and climbed row by row until the
max_push_distancebudget (0.33 × page) wasspent. The azul fix lets only a range that ENCLOSES the range the break just
left pull it further up (true nesting: a line inside a
break-inside: avoidbox), never a sibling that merely overlaps its top edge; a second azul fix
stops the clip widening for a box whose only "overflow" is its own padding.
The snap fix alone makes this test pass; with both, the break lands exactly at
the top of the first row that no longer fits.
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.