-
Notifications
You must be signed in to change notification settings - Fork 682
[feat] Expose public API #1346
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
[feat] Expose public API #1346
Conversation
42a50fc to
ea64bc0
Compare
|
PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this. Some feedback on naming and documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's an initial review. Didn't validate the API itself. Am heading to read 'feat' table now and be back with commets on that.
|
Applied just no strong preference yet whether we need to return default index or default value (currently). |
|
A couple side-issues:
|
Maybe a separate issue, you said Chrome doesn't need that right now. |
Right. But I want to have the full picture laid out before adding anything. I don't want to find later that we should have done this differently. |
|
It occurs to me that it's also possible to get user set AAT features using feature codes directly, by, eg, passing |
Of just |
Yeah I like this one better. |
|
Read 'feat' table. So, the proposed API completely misses the part about enumerating features themselves. I don't like that. I think there should be a first layer API to list all features and get their name_id's and look up feature's index, then the second layer takes a feature_index and lists the settings. |
Done. But I liked the first layer just was fetching features and fetching name_id on second layer.
So reverting enum thing? |
31b5054 to
29694b6
Compare
src/hb-aat.h
Outdated
| HB_AAT_LAYOUT_SELECTOR_PROPORTIONAL_CJK_ROMAN = 1, | ||
| HB_AAT_LAYOUT_SELECTOR_DEFAULT_CJK_ROMAN = 2, | ||
| HB_AAT_LAYOUT_SELECTOR_FULL_WIDTH_CJK_ROMAN = 3 | ||
| } hb_aat_layout_feature_setting_t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess "setting" or "selector" should only be used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. Pick one and only use that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either "feature_setting" or "feature_selector". Selector sounds less confusing.
| const SettingName* setting = (SettingName*) hb_bsearch (&key, feat+settingTableZ, | ||
| nSettings, | ||
| SettingName::static_size, | ||
| SettingName::cmp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably good idea to have an UnsizedSortedArrayOf (or SortedUnsizedArrayOf?) and move the logic there. COLR/CPAL needed that IIRC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes please.
|
I like us to map out other API that interacts with this, before merging it. So far, things that have been discussed:
|
|
There is also some sort of OT-AAT mapping on Zapf AAT table, I am not sure
if they are useful for dynamic mapping or extract and having them somewhere
(and complete ours) is enough.
…On Monday, November 19, 2018, Behdad Esfahbod ***@***.***> wrote:
I like us to map out other API that interacts with this, before merging
it. So far, things that have been discussed:
- If feat feature is missing, dig into the morx table and extracted
list of features?
- API to convert AAT-style features into OT-style. And back?
- If GSUB is missing, convert back feat table features to OT style and
return from hb-ot-layout API.
- Allow user specifying AAT features directly (without going through
OT equivalents) in hb_feature_t, by using tag names like ' 12' for
feature number 12.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1346 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAy3wfRq4C5kiYwz61C01eC2RW3WzcDnks5uwghygaJpZM4YGHHq>
.
|
|
Coming back here. behdad@, I think I got confused: I asked you whether I can retrieve the CTFont from hb_coretext_font, but IIUC, after moving to HarfBuzz AAT we won't have a CTFont or hb_coretext_font anymore, so I won't have a good way of accessing the CTFont we have up in SkTypeface in the case-mapping/small-caps processing code except for changing a bunch of plumbing above, so some exposing |
|
You can have access to CTFont even after HB AAT, you should just not pass coretext-aat after using hb_shape_full but better to not go there, Behdad concerns are understandable, maybe we can have this behind some compiler flag enabled only for Chromium and only on macOS for now (so no gentoo/chromeos packaging issue I guess) if just merging it is not a good idea. |
I will not be passing a CTFont based hb_font to HarfBuzz anymore after switching to HarfBuzz AAT, so I don't think there is an underlying CTFont anymore. |
Why not finish it? |
|
I don't know what to do :)
…On Thursday, November 22, 2018, Behdad Esfahbod ***@***.***> wrote:
maybe we can have this behind some compiler flag enabled only for Chromium
and only on macOS for now
Why not finish it?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1346 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAy3wRx8b3yCn9qGaxz4ExDUr7pkO-8Tks5uxs4CgaJpZM4YGHHq>
.
|
I listed:
This is easy. But if you don't want to get into it, that's fine for the first round, since doesn't have API implications.
Propose API for this. It's close to trivial. We have an internal API that converts one to another. Model two APIs based on that (just type here, DON'T send a patch) and we discuss it from there.
If you do the conversion API, this part is also easy, but also not required initially since no API implications.
Also easy. Also not required initially since no API implications. |
Even this doesn't have to be implemented before merging this work. I just want to know we have a plan and discuss the API, to avoid any surprises and blind spots later. |
|
One more item to add to TODO list: enum for OpenType features. |
|
I studied this more and I'm comfortable merging it. We can expose something along the lines of |
| unsigned int settings_count = nSettings; | ||
| if (count && *count) | ||
| { | ||
| unsigned int len = MIN (settings_count - start_offset, *count); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be ported to use hb_array_t and sub_array().
| unsigned int feature_count = featureNameCount; | ||
| if (count && *count) | ||
| { | ||
| unsigned int len = MIN (feature_count - start_offset, *count); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same re using hb_array_t and .sub_array().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought about this before, no sub_array on UnsizedArrayOf, and doesn't worth to IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UnsizedArrayOf should not be used directly. Maybe I remove operator[] from it. Idea is you bind it with a length to get a hb_array_t and use that, which has a sub_array().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UnsizedArrayOf::as_array().
| } hb_aat_layout_feature_setting_t; | ||
|
|
||
| HB_EXTERN unsigned int | ||
| hb_aat_layout_get_features (hb_face_t *face, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's fix namespacing. Again, you have all under "hb_aat_layout" namespace, ie. they all start with "hb_aat_layout_get". We want more fine-grained namspacing.
This one is fine, get_features.
src/hb-aat.h
Outdated
| hb_aat_layout_feature_setting_t *settings /* OUT. May be NULL. */); | ||
|
|
||
| HB_EXTERN hb_ot_name_id_t | ||
| hb_aat_layout_get_feature_setting_name_id (hb_face_t *face, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hb_aat_layout_feature_setting_get_name_id or, feature_selector
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way we did this in ot-layout, and in general do these things, is to have find_feature or something, take feature type and return a feature index. The subsequent API entrypoints then take that index, to avoid having to look up the feature entry again and again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Understandable as did once for hb_ot_layout_feature_get_characters
src/hb-aat-layout-feat-table.hh
Outdated
|
|
||
| inline hb_ot_name_id_t get_feature_name_id () const { return nameIndex; } | ||
|
|
||
| inline hb_ot_name_id_t get_feature_setting_name_id (const feat *feat, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These functions taking feat table look weird. I think things can be done differently, but I need to pull down the code and take a deeper look than just reading the patch.
|
This part of the spec: """For feature types that don't have exclusive settings, there will always be a pair of values. One value turns a selector on and a second value turns the selector off. The on setting must be even and the off setting must be one greater than the corresponding on setting. The off setting is therefore always odd. As a result, only the on setting should have an entry in the setting name array.""" needs at least to go into documentation... |
Codecov Report
@@ Coverage Diff @@
## master #1346 +/- ##
=========================================
Coverage ? 76.36%
=========================================
Files ? 134
Lines ? 16372
Branches ? 0
=========================================
Hits ? 12503
Misses ? 3869
Partials ? 0
Continue to review full report at Codecov.
|
| hb_aat_layout_feature_setting_t | ||
| hb_aat_layout_feature_get_selectors | ||
| hb_aat_layout_feature_selector_get_name_id | ||
| hb_aat_layout_feature_selector_t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type name typically goes before functions using it.
Closes #1304