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

Consider scripts with no directionality to be LTR #576

Merged
merged 3 commits into from
Jan 14, 2022

Conversation

simoncozens
Copy link
Contributor

Copy link
Member

@anthrotype anthrotype left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@@ -337,7 +337,10 @@ def _groupScriptsByTagAndDirection(feaScripts):
# direction (DFLT is excluded)
scriptGroups = {}
for scriptCode, scriptLangSys in feaScripts.items():
direction = unicodedata.script_horizontal_direction(scriptCode)
if scriptCode:
direction = unicodedata.script_horizontal_direction(scriptCode)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or you could also do direction = unicodedata.script_horizontal_direction(scriptCode, default="LTR")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually that may hide other bugs, it's better like you did (we still get a KeyError if a not-None scriptCode is not found by script_horizontal_direction)

@khaledhosny
Copy link
Collaborator

What does HarfBuzz do for these scripts? Math can be set RTL, not sure about the others.

@anthrotype
Copy link
Member

anthrotype commented Jan 11, 2022

I don't know if related, but it looks like the fontTools.unicodedata' list of RTL scripts could be not up to date with latest Unicode 14, see the link in the comment at
https://github.com/fonttools/fonttools/blob/e778f2c3f485101ad11cb595c427f579955c0714/Lib/fontTools/unicodedata/__init__.py#L137-L203
I believe I copied those from harfbuzz source code, but i forgot exactly where. Might be a good idea to update them just in case.

@anthrotype
Copy link
Member

(ok, it's not related to this issue, but it's good that I checked: we were actually missing Old Uyghur from the RTL script list, it was added with Unicode 14.0 => fonttools/fonttools#2499)

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

Successfully merging this pull request may close these issues.

Kern writer fails when script tag not in unicodedata.ot_tag_to_script
3 participants