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

use of rlm and lrm causes signs in the rendered pdf #464

Closed
AnanasPizza opened this issue Apr 14, 2020 · 2 comments
Closed

use of rlm and lrm causes signs in the rendered pdf #464

AnanasPizza opened this issue Apr 14, 2020 · 2 comments

Comments

@AnanasPizza
Copy link

I'm facing a problem with telephone numbers in bidirectional texts.
My approach is in a rtl-text, to use a span around the phone number, use direction : ltr and unicode-bidi: embed on it. this works fine if there is no plus at the beginning for an international number. But most of the times there is a plus. So what I tried to do is, to use an ‎ or ‎ at the end of the number. And now it is ordered correct. But you can see the problem in this screenshot. Where i put those marks, there is an extra char or sign or however you call it. that little arrow in front of the numbers. Do you now how to prevent this or is it a bug?

image

The html at that point is

<span style="font-family: 'Sakkal Majalla' !important; ">الرقم</span>

<span> <span style="font-family: 'Liberation Sans' !important; direction: ltr; unicode-bidi: embed;">

&lrm;+49 &lrm;1 &lrm;1234 &lrm;5678 &lrm;</span> </span>

<span style="font-family: 'Sakkal Majalla' !important; ">أو</span>"

@danfickle
Copy link
Owner

Hi @AnanasPizza,

It turns out you have found a couple of bugs. As well as the lrm character being output, the direction: ltr in CSS is not being honored.

As a quick workaround, you can use the dir attribute rather than specifying ltr in CSS:
<span dir="ltr">+123 456 etc</span>. I think this is recommended approach anyway.

As for the bug, it stems from this line in ParagraphSplitter class:

            	if (style.isParagraphContainerForBidi() || element.hasAttribute("dir") || element.getNodeName().equals("bdi")) {
                	// If a element has a dir attribute or is a bdi tag it sits in its own direction isolate.

It should also consider an explicit change of direction via CSS as a direction isolate. I'll try to work a fix now.

P.S. We also don't support the unicode-bidi property but if you need it you can use a bdi tag instead.

@AnanasPizza
Copy link
Author

AnanasPizza commented Apr 15, 2020

Okay, using the bdi tag is working perfectly, thanks for the hint. and great effort to fix the bug so quickly.

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

No branches or pull requests

2 participants