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

Weird highlight boxes #11644

Open
giuli635 opened this issue Apr 9, 2024 · 18 comments
Open

Weird highlight boxes #11644

giuli635 opened this issue Apr 9, 2024 · 18 comments

Comments

@giuli635
Copy link

giuli635 commented Apr 9, 2024

  • KOReader version: 2024.03.1
  • Device: Android 11 and Arch Linux

Issue

Weird highlight boxes created. This happens throughout the document, but more frequently when is near a math expression.

image

Steps to reproduce

I just don't know if it's legal uploading the pdf jajajaja.

@Frenzie
Copy link
Member

Frenzie commented Apr 9, 2024

Presumably that's just the math saying it's that tall, unless you're saying it doesn't happen in other viewers.

@giuli635
Copy link
Author

giuli635 commented Apr 9, 2024

It doesn't happen in Evince for example. I've just checked if its a rendering issue but it also saves the highlight that way. But as I said, in Evince I dont have this problem.

(Edit)
Perhaps it's worth mentioning that reflow shows highligths better.

@Frenzie
Copy link
Member

Frenzie commented Apr 9, 2024

Based on some random PDF (https://arxiv.org/pdf/2305.17493.pdf) I'd say it's a bit of a toss up what happens to come out better where. It does generally seem to come out a bit nicer in Firefox, probably mostly as a happy coincidence due to how they lay out text. (It's regular HTML with fancy positioning, which is fundamentally quite different from how native PDF implementations work.)

The (hopefully) good news is that there are likely to be some improvements here in the future regardless, due to various updated dependencies.

Okular

Evince, KOReader on top

@Frenzie
Copy link
Member

Frenzie commented Apr 9, 2024

The (hopefully) good news is that there are likely to be some improvements here in the future regardless, due to various updated dependencies.

You can probably get a preview of that in a newer MuPDF app (whether on desktop or Android), unless it doesn't expose text selection.

@giuli635
Copy link
Author

giuli635 commented Apr 9, 2024

Okay, I'm doing a last recap with all the info I realize could be useful, if you tell me I just have to wait, I'll wait :)

Evince selection before any modification in KOReader

image

Evince opening the file modified by KOReader

image

KOReader selection before any modification

image

Doing this, when I want to use reflow and then select in desktop it crashes, but I don't have time to see the logs, I'll see what's going on later.

The page of the pdf

I leave here the page of the pdf test.pdf.

@Frenzie
Copy link
Member

Frenzie commented Apr 9, 2024

Curious, the geometry doesn't seem out of the ordinary in the PDF but as shown the selection returned is rather tall.

(Some relevant output from mutool trace.)

    <span font="DLYZCT+LatinModernMath-Regular" wmode="0" bidi="0" trm="9.96264 0 0 9.96264">
        <g unicode="𝜆" glyph="4470" x="236.69" y="353.349" adv=".583"/>
        <g unicode="𝑥" glyph="1319" x="242.49822" y="353.349" adv=".572"/>
        <g unicode="." glyph="15" x="248.19684" y="353.349" adv=".278"/>
        <g unicode="𝑥" glyph="1319" x="250.96645" y="353.349" adv=".572"/>
        <g unicode="𝑧" glyph="1321" x="256.66508" y="353.349" adv=".465"/>
    </span>
    <span font="IWOTBY+LibreBaskerville-Regular" wmode="0" bidi="0" trm="10.161893 0 0 9.96264">
        <g unicode="a" glyph="66" x="264.867" y="353.349" adv=".554"/>
        <g unicode="n" glyph="79" x="270.4967" y="353.349" adv=".689"/>
        <g unicode="d" glyph="69" x="277.49827" y="353.349" adv=".675"/>
    </span>
04/09/24-21:40:58 DEBUG dict lookup word: 𝜆𝑥𝑦.𝑦𝑥 {
  "124x270+497+545"
} --[[table: 0x7c9d79e20440]]

But yeah, at the moment there's a good chance it'll be fixed automatically once MuPDF is finally updated.

@benoit-pierre
Copy link
Contributor

Nope, I get the same tall selection boxes with a build using MuPDF 1.24.1.

@giuli635
Copy link
Author

giuli635 commented Apr 9, 2024

So is a problem of MuPDF? Not of KOReader?

@Frenzie
Copy link
Member

Frenzie commented Apr 9, 2024

Yes, here's a screenshot from MuPDF 1.24 for Android.

@Frenzie
Copy link
Member

Frenzie commented Apr 9, 2024

As a random thought, I think the Latin Modern Math font, used here for math, had a tall lineheight issue about a decade ago. Although that wouldn't explain why only MuPDF has this issue.

@giuli635
Copy link
Author

giuli635 commented Apr 9, 2024

So, maybe I should create an issue in MuPDF?

@Frenzie
Copy link
Member

Frenzie commented Apr 9, 2024

I suspect this issue already covers it: https://bugs.ghostscript.com/show_bug.cgi?id=700466

Note how the screenshot of http://beta.hebrewbooks.org/pagefeed/hebrewbooks_org_9717_1.pdf shows a very tall selection in the header, when the box actually hugs the Hebrew characters.

@giuli635
Copy link
Author

giuli635 commented Apr 9, 2024

That's five years old, do you think this will be addressed?

@Frenzie
Copy link
Member

Frenzie commented Apr 9, 2024

Your test case could be useful because it shows a clear contrast between desired and undesired behavior. I think it'd be worth adding there, unless @benoit-pierre has different thoughts.

@benoit-pierre
Copy link
Contributor

I would report the issue upstream, yes.

@giuli635
Copy link
Author

giuli635 commented Apr 9, 2024

Thank you guys, you've been very helpful! Do I leave the issue open?

@Frenzie
Copy link
Member

Frenzie commented Apr 10, 2024

Let's leave it open for now.

@Chlorpheniramine
Copy link

  • KOReader version: 2024.03.1
  • Device: Android 11 and Arch Linux

Issue

Weird highlight boxes created. This happens throughout the document, but more frequently when is near a math expression.

image

Steps to reproduce

I just don't know if it's legal uploading the pdf jajajaja.

#11716
This look quite similar to the condition I encountered. I propose to merge it to this thread and close it if necessary.

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

No branches or pull requests

4 participants