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

Fix for #85 #86

Merged
merged 2 commits into from
Apr 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
## [1.1.13] - 2020-04-??

- Fixed contextual menu to also respond to right-click.
- Fixed feature tag list: not all available features were always shown.
([Issue 85](https://github.com/justvanrossum/fontgoggles/issues/85),
[PR 86](https://github.com/justvanrossum/fontgoggles/issues/86))

## [1.1.12] - 2020-04-03

Expand Down
10 changes: 8 additions & 2 deletions Lib/fontgoggles/misc/hbShape.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,14 @@ def _getGlyphNameFromCodePoint(cmap, codePoint):
else:
self._funcs = None

def getFeatures(self, tag):
return hb.ot_layout_language_get_feature_tags(self.face, tag)
def getFeatures(self, otTableTag):
features = set()
for scriptIndex, script in enumerate(hb.ot_layout_table_get_script_tags(self.face, otTableTag)):
langIdices = list(range(len(hb.ot_layout_script_get_language_tags(self.face, otTableTag, scriptIndex))))
langIdices.append(0xFFFF)
for langIndex in langIdices:
features.update(hb.ot_layout_language_get_feature_tags(self.face, otTableTag, scriptIndex, langIndex))
return features

def getStylisticSetNames(self):
tags = _stylisticSets & set(self.getFeatures("GSUB"))
Expand Down
12 changes: 6 additions & 6 deletions Tests/test_font.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_sniffFontType():
'weight': 400,
'width': 5},
{'calt', 'ccmp', 'dnom', 'fina', 'init',
'liga', 'medi', 'numr',
'locl', 'liga', 'medi', 'numr',
'pnum', 'rlig', 'rtlm', 'ss01', 'ss02', 'ss03',
'ss04', 'ss05', 'ss06', 'ss07', 'ss08'},
{'curs', 'kern', 'mark', 'mkmk', 'ss05'},
Expand Down Expand Up @@ -50,10 +50,10 @@ def test_sniffFontType():
'suffix': 'ttf',
'weight': 400,
'width': 5},
{'aalt', 'ccmp', 'dnom', 'fina', 'frac', 'init', 'liga',
'medi', 'numr', 'ordn', 'rlig', 'salt', 'sinf', 'ss01',
'ss02', 'ss03', 'ss04', 'ss05', 'ss06', 'subs', 'sups',
'zero'},
{'aalt', 'calt', 'ccmp', 'dnom', 'fina', 'frac', 'init',
'locl', 'liga', 'medi', 'numr', 'ordn', 'rlig', 'salt',
'sinf', 'ss01', 'ss02', 'ss03', 'ss04', 'ss05', 'ss06',
'subs', 'sups', 'zero'},
{'kern', 'mark', 'mkmk'},
{'DFLT': set(), 'arab': {'URD '}, 'latn': set()},
{},
Expand Down Expand Up @@ -128,7 +128,7 @@ def test_sniffFontType():
'suffix': 'ttf',
'weight': 400,
'width': 5},
{'abvs', 'blws', 'blwf'},
{'locl', 'blws', 'abvs', 'blwf'},
{'kern', 'mark', 'mkmk'},
{'mym2': {'KSW ', 'MON '}},
{},
Expand Down