Skip to content
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

LibGfx/JBIG2: Fix rendering of transposed text, and add lots of tests #23810

Merged
merged 5 commits into from
Apr 3, 2024

Conversation

nico
Copy link
Collaborator

@nico nico commented Apr 2, 2024

The current code was incorrect for non-TopRight reference corners.
Fixes rendering of ghostpdl/tests/jbig2/042_19.jb2.

nico added 5 commits April 2, 2024 13:26
This already worked fine. Now it's tested.

I did have to teach `jbig2` to correctly generate test files for this.
See the PR adding these tests for local changes.

I used the script from SerenityOS#23659 to create these images, but I replaced
these lines:

```
-txt -Param -numInst 4
    -ID 2 108 50 -ID 3 265 60 -ID 1 100 135 -ID 0 70 232
-txt -Param -RefCorner 2
```

For `bottomleft`, I replaced them with:

```
-txt -Param -numInst 4
    -ID 2 137 50 -ID 3 294 60 -ID 1 199 135 -ID 0 319 232
-txt -Param -RefCorner 0
```

For `bottomright`, I replaced them with:

```
-txt -Param -numInst 4
    -ID 2 108 50 -ID 3 265 60 -ID 1 100 135 -ID 0 70 232
-txt -Param -RefCorner 2
```

For `topright`, I replaced them with:

```
-txt -Param -numInst 4
    -ID 2 108 79 -ID 3 265 89 -ID 1 100 234 -ID 0 70 351
-txt -Param -RefCorner 3
```

All three new files display fine in Chrome.
The bottomleft one displays fine in Firefox, while the other two
look compressed in X. I think this is a bug in pdf.js that I'll
report upstream.
(Reportedly they look fine in Acrobat on Android.)
The current code was incorrect for non-TopRight reference corners.
Fixes rendering of ghostpdl/tests/jbig2/042_19.jb2.
This needed the same `jbig2` changes as for the non-transposed ones,
and the changes to it mentioned on SerenityOS#23780.

I used the same .ini files as for the non-transposed ones, except
that I added `-txt -Param -Transposed 1` as last line to each of them.

All three new files display fine in Chrome.
They all look busted in Firefox.
I think this is likey a bug in pdf.js that I'll report upstream.
(Reportedly they look fine in Acrobat on Android.)
@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label Apr 2, 2024
@nico
Copy link
Collaborator Author

nico commented Apr 2, 2024

@nico
Copy link
Collaborator Author

nico commented Apr 2, 2024

Before:

Screenshot 2024-04-02 at 2 47 04 PM

After:

Screenshot 2024-04-02 at 2 47 18 PM

For this file:

transpose2.pdf

@nico
Copy link
Collaborator Author

nico commented Apr 3, 2024

Red CI is unrelated.

@nico
Copy link
Collaborator Author

nico commented Apr 3, 2024

Filed mozilla/pdf.js#17871 for the non-transposed bug in pdf.js / Firefox. Depending on how that one goes, I'll open another issue for the transposed files there later.

@trflynn89 trflynn89 merged commit 44d3fd0 into SerenityOS:master Apr 3, 2024
10 of 12 checks passed
@github-actions github-actions bot removed the 👀 pr-needs-review PR needs review from a maintainer or community member label Apr 3, 2024
@nico nico deleted the jbig2-transposer branch April 3, 2024 15:42
@nico
Copy link
Collaborator Author

nico commented Apr 3, 2024

The pdf.js team fixed mozilla/pdf.js#17871 in record time (🎉), so I opened mozilla/pdf.js#17883 for the transposed test cases rendering differently in pdf.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants