-
-
Notifications
You must be signed in to change notification settings - Fork 793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor PDF export #4154
Merged
Merged
Refactor PDF export #4154
Conversation
This file contains 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
This won't work, because most ID inserted in the global context are in fact local, and should be remapped.
Each "write" pass now return the sub-state it produced instead of mutating a global state.
This may break emojis TODO: check that it doesn't
Also move some more stuff to the catalog module
Not sure that this is a good idea, but it sort of makes the design simpler.
Remove parallelism. The previous implementation was not actually parallel anyways. The only thing that seems to take time during PDF export is image encoding, which is already correctly parallelized.
Also move Resources to the dedicated module.
elegaanz
force-pushed
the
refactor-pdf-export
branch
from
May 27, 2024 10:28
8404fe8
to
286953b
Compare
elegaanz
force-pushed
the
refactor-pdf-export
branch
from
May 27, 2024 11:03
0b9ff11
to
a31ce39
Compare
elegaanz
force-pushed
the
refactor-pdf-export
branch
from
May 27, 2024 11:07
a31ce39
to
fce86ca
Compare
I ran the test suite through my script that renders a PDF using different viewers, and I noticed that the following file doesn't seem to render correctly anymore:
Other than that everything else seemed fine, although I admittedly only skimmed it. :) |
Thanks, I'll see if I can reproduce and fix. And I will definitely do some more in depth testing before merging. |
elegaanz
force-pushed
the
refactor-pdf-export
branch
from
May 28, 2024 13:46
af90503
to
dfcf3ef
Compare
PgBiel
added a commit
to tulio240/typst
that referenced
this pull request
May 30, 2024
Refactor frame metadata into tags (typst#4212) Require `Send` and `Sync` for worlds (typst#4219) Optimize counters and state (typst#4223) Add `windows` method to array (typst#4136) Improve `CITATION.cff` file (typst#4201) Fix equation resizing when adding the equation number (typst#4179) `layout` documentation improvements (typst#4196) Allow somewhat arbitrary characters as `mat`, `vec` and `cases` `delim` (typst#4211) Do layout short-circuit in flow instead of realization (typst#4231) Split `BitSet` into two types and make it a bit nicer (typst#4249) Set default value of `raw.theme` to `auto`, and allow setting `raw.theme` to `auto` (typst#4186) Extended cargo installation instructions (typst#4168) Hint for language-region pair on `text.lang` (typst#4183) Improve macro docs (+ Native*Data docs) (typst#4240) Rephrase the sentence on variable scope in Scripting documentation (typst#4250) Refactor `Capable::vtable` to return `Option<NonNull<()>>` (typst#4252) Nicer test helper CSS (typst#4269) Trim weak spacing at line start/end in paragraph layout (typst#4087) Add ability to choose between minified and pretty-printed JSON (typst#4161) Refactor PDF export (typst#4154) Reorder syntax kinds (typst#4287) Fix figure centering (typst#4276) Fix `Default` impls for AST nodes (typst#4288) Bump libc to v0.2.155 (typst#4268) Bump time dependency (typst#4294)
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.
The PDF exporter now uses a type state to ensure that it is impossible to access context that is not yet available. It also makes extensive use of the
pdf_writer::Chunk::rewrite_into
API to have each step being more independent, and thus potentially easier to memoize.The actual behavior of the crate didn't change a lot, everything is just less entangled and hopefully easier to reason about.
TODO:
qpdf --check
on all files generated by the test runner, and no errors were reported.