-
Notifications
You must be signed in to change notification settings - Fork 500
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
Link with inline styles is broken up into multiple links #1688
Comments
I'm going to assume you're referring to the PDF viewer in Firefox. How link annotations get defined is not something that this converter has any control over. That's how Prawn works. Prawn is the PDF generator this converter uses. So you'll need to file an issue in https://github.com/prawnpdf/prawn to collapse adjacent link annotation boxes. The way text in Prawn works is that each segment of text that has different formatting gets its own fragment, which is then placed onto the page. Here's where the link annotations get defined: https://github.com/prawnpdf/prawn/blob/master/lib/prawn/text/formatted/box.rb I tried to see if a PDF optimizer would perform this collapsing, but it doesn't seem to be able to. |
I reported prawnpdf/prawn#1157, but as I have no knowledge of Prawn or the internals of asciidoctor-pdf, I'm not sure if I phrased it correctly. |
@mrotteveel It seems like the developers understood your phrasing very well and explained why it's such a difficult behavior to implement. |
This is another example of a feature that we can address with Asciidoctor PDF's browser-based successor. The browser properly tracks the bounding box of a link (even across lines) and thus, when the PDF is generated, the hovering behavior will be as you expect. |
After spending a lot of time in the Prawn text-handling code, my assessment is that it has painted itself into a corner for what it can do with text. It kind of works the way it works and trying to change any part causes all sorts of other behavior to break. Alexander kind of alludes to this in his first reply. |
@mojavelinux Thanks. What is the browser-based successor you're talking about? |
I'll post about it once Asciidoctor PDF 2 is out. You can find an early prototype of it here: https://github.com/mogztter/asciidoctor-pdf.js |
When a link text has inline styles (eg emphasis), then the rendered link is broken up in multiple links (on the normal text before the line style, the text in the inline style, and on the normal text after the inline style).
This looks a bit off when clicking a link (in Adobe Acrobat), or hovering over a link in Firefox.
As a simple example, take
In Firefox, hovering over the link looks like:
Normal:
Emphasis at end:
Emphasis in middle:
The text was updated successfully, but these errors were encountered: