Skip to content

Commit

Permalink
Fix resolved direction for all neutral text
Browse files Browse the repository at this point in the history
FriBiDi will treat the text as LTR if no base direction is set, so make
sure we set resolved dir the same way (i.e. treat FRIBIDI_PAR_ON as
FRIBIDI_PAR_LTR). SheenBiDi will report LTR base level in this case, but
I changed the code for consistency.
  • Loading branch information
khaledhosny committed Jun 3, 2022
1 parent 5640404 commit 9649ec4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/raqm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1348,10 +1348,10 @@ _raqm_bidi_itemize (raqm_t *rq, size_t *run_count)
line = SBParagraphCreateLine (par, 0, par_len);
*run_count = SBLineGetRunCount (line);

if (SBParagraphGetBaseLevel (par) == 0)
rq->resolved_dir = RAQM_DIRECTION_LTR;
else
if (SBParagraphGetBaseLevel (par) == 1)
rq->resolved_dir = RAQM_DIRECTION_RTL;
else
rq->resolved_dir = RAQM_DIRECTION_LTR;

runs = malloc (sizeof (_raqm_bidi_run) * (*run_count));
if (runs)
Expand Down Expand Up @@ -1502,10 +1502,10 @@ _raqm_bidi_itemize (raqm_t *rq, size_t *run_count)
rq->text_len, &par_type,
levels);

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

if (max_level == 0)
goto done;
Expand Down

0 comments on commit 9649ec4

Please sign in to comment.