Add Script, Language, and Direction classes#205
Conversation
b67d05b to
56d895d
Compare
|
Quick comment after a brief look: hb_feature_t is a struct with multiple fields therefore it’s helpful to represent it as a class, but these all seem to only provide a validation layer (not even for Language)? |
|
I hade code like |
|
Got to have another look:
Oh I thought there’s already |
It basically wraps
I like HarfBuzz names, and find Script.ARABIC etc. easier to remember that
We have |
Ah I see, export const Direction = {
LTR: "ltr",
RTL: "rtl",
...
} as const;
export type Direction = ValueOf<typeof Direction>;Then you convert This exposes the most useful variants of these values (the strings one can simply input and get type checked, as well as the readable symbols like |
|
Lets close this then, since no one complained about the status co. If we ever need to do something similar, I think we can still do it in backwards-compatible way. |
Inspired by
Featureclass introduce in #204, but I’m not sure if it is an overall improvement. It seemed nice in my head, but after doing it things feel a bit verbose.Leaving it here for others more familiar with JS to voice their opinion.