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

Incorrect resolved paragraph direction #163

Open
niello opened this issue Feb 26, 2022 · 4 comments · May be fixed by #164
Open

Incorrect resolved paragraph direction #163

niello opened this issue Feb 26, 2022 · 4 comments · May be fixed by #164

Comments

@niello
Copy link
Contributor

niello commented Feb 26, 2022

libraqm/src/raqm.c

Lines 1417 to 1420 in ce67a59

if (par_type == FRIBIDI_PAR_LTR)
rq->resolved_dir = RAQM_DIRECTION_LTR;
else
rq->resolved_dir = RAQM_DIRECTION_RTL;

An assumption is made that everything that is not explicitly LTR is RTL. It fails for direction-neutral paragraphs (FRIBIDI_PAR_ON). This leads to strange results, e.g. a number in a separate paragraph in a completely LTR text is considered RTL.

I suggest to turn FRIBIDI_PAR_ON into RAQM_DIRECTION_DEFAULT, so users can treat it accordingly to their preference. This value should not have any side meaning anyway, e.g. checking whether layouting was performed by inspecting raqm_get_par_resolved_direction is definitely a bad practice.

This sould also be fixed for SheenBIDI but I can't make exact suggestions as I didn't work with it.

@niello niello changed the title Incorrect paragraph direction Incorrect resolved paragraph direction Feb 26, 2022
@niello niello linked a pull request Mar 6, 2022 that will close this issue
@niello
Copy link
Contributor Author

niello commented Mar 6, 2022

@khaledhosny , please look at the PR. The fix works perfectly in my case. Now all necessary info is provided to the library user code.

@khaledhosny
Copy link
Collaborator

I think the code is assuming par direction is explicitly set, which I think is one way to handle this. Am I right that you are using auto par dir?

@vorlov-playrix
Copy link
Contributor

Yes, I want a multiline editbox to detect text direction per paragraph and align them correctly. Direction-neutral paragraphs are aligned as the above text. But this is only a practical example. The problem is conceptual - there are direction-neutral paragraphs (i.e. "111") and middleware should not suppose any strict direction for them. It should be handled in user code.

@khaledhosny
Copy link
Collaborator

I understand that, I was trying to figure out how the original code came to be like that, but it was definitely wrong. Now I need to make sure the SeenBiDi code is fixed the same way.

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

Successfully merging a pull request may close this issue.

3 participants