Typst's `pattern` inside a PDF file prevents MuPDF viewer from showing any pattern changes
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 56.1k
- Forks
- 1.7k
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 22
Description
Description
Using the MuPDF from the nix shell nixpkgs#mupdf: v1.23.5
- Paste this code into a text editor:
#set rect(width: 100%, height: 20pt)
#let pattern = pattern(size: (20pt, 20pt), square(size: 5pt, fill: black))
// #let pattern = pattern(size: (20pt, 20pt), square(size: 5pt))
#rect(fill: pattern)
- Run the
typst watch. - Open the PDF file with the
mupdf-x11(mupdf). - Comment out the 2nd line and uncomment the 3rd line (from the top).
- The output of MuPDF doesn't change. Although you can still write some text below or anything else and the PDF preview will be updated. But the section/part of the PDF preview where the pattern is shown won't be updated, i.e., the MuPDF "remembers" the last state of the shown pattern and doesn't forget/refresh this state.
I can demonstrate how it worked in my document:
Run the editor, MuPDF, typst watch (and echo "$pdf_file" | entr -n kill -HUP $mupdf_pid to update the preview):
Change the pattern (doesn't update only the pattern part):
Press the e key (toggle spot color mode) (updated the pattern part, but the colors are ugly):
Press the e key again (colors are fine, but now the pattern part is completely broken):
But with the minimal example above, the e key (or E) doesn't work/fix. So I'm stuck with the unupdatable pattern part of the PDF preview, and I can only "fix" this by restarting the MuPDF. And this happens every time I edit the pattern.
Reproduction URL
No response
Operating system
Linux
Typst version
- I am using the latest version of Typst
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the minimal Typst example with typst watch and opening the generated PDF in MuPDF. Compare the preview after changing the pattern and check whether the generated PDF reflects the change. Done means MuPDF refreshes the pattern region without restarting or toggling modes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100