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

Possible bug in _raqm_reorder_runs #77

Open
deepakjois opened this issue May 4, 2017 · 1 comment
Open

Possible bug in _raqm_reorder_runs #77

deepakjois opened this issue May 4, 2017 · 1 comment
Labels

Comments

@deepakjois
Copy link

deepakjois commented May 4, 2017

for (level = max_level; level > 0; level--)

In the code:

for (level = max_level; level > 0; level--)

The spec says:

L2. From the highest level found in the text to the lowest odd level on each line…

The code above seems to assume that the lowest odd level is always 1. I am not sure if it makes any difference in practice. I was reading through the code because I want to reimplement parts of this file in Lua, and this seemed to be not according to my understanding of the spec.

@deepakjois
Copy link
Author

deepakjois commented May 4, 2017

A spec-compliant implementation would be to determine minimum level as well as maximum level for the line. Something similar what is done in the BiDi reference implementation (reproduced below in Lua):

From: https://github.com/deepakjois/luabidi/blob/4b90e7acc14a5f3173e7f5eb88fb501bc9c9dca4/src/bidi.lua#L1118

  local highestLevel = 0
  local lowestOddLevel = MAX_DEPTH + 2
  for i = 1, lineLength do
    local level = levels[i]
    if level > highestLevel then highestLevel = level end
    if bit32.band(level, 1) ~= 0 and level < lowestOddLevel then lowestOddLevel = level end
  end

MAX_DEPTH is defined in the standard as 125, so maybe it is available as a constant in the FriBiDi library.

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

No branches or pull requests

2 participants