-
Notifications
You must be signed in to change notification settings - Fork 36
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
Only two character BCP47 language tags work, ISO-639-3 tags do not work. #108
Comments
|
Harfbuzz has to support OpenType tags, as Uniscribe only uses OpenType and not BCP47. I tested against a Windows HarfBuzz/Cairo test tool (built using out-the-box settings in vcpkg), plus a similar Uniscribe test tool, and harfbuzzjs. The Windows tool uses hb_language_from_string too. Have I missed some other way of setting the buffer language? |
HarfBuzz does not take OpenType language tags or script tags as for buffer language and script, it takes BCP 47 for language, and ISO 15924 tags for script. That is an intentional design. Using OpenType language or script tags is a mistake (not an uncommon one) and it works sometimes by coincidence. |
Now I have to work out why "nep" and "mar" actually work in the HarfBuzz windows tool 🫢 BCP 47 + ISO 15294 make perfect sense. |
The Windows app is using HarfBuzz 8.3.0. Wondering why that appears to accept OpenType language tags the same as Uniscribe does..? |
OK, I'm confused as well.
for (lang of ["", "NEP", "ne", "x-hbot-4E455020"]) {
var buffer = hb.createBuffer();
buffer.addText("५ल");
buffer.setScript("Deva");
buffer.setDirection("ltr");
if (lang) buffer.setLanguage(lang);
hb.shape(font, buffer);
var result = buffer.json(font);
console.log(result[0].g)
}
|
That's the same confusing result I'm getting here... |
HB uses Another example is It appears that 3 character BCP-47 tags are also not detected. Only 2 character BCP-47 work. Those tables are only used in hb-ot-tag.cc, in Have I missed something? |
We define |
I'm fine removing this from |
|
Fine with both. Sorry for the trouble. |
Remove HB_NO_LANGUAGE_LONG and HB_NO_LANGUAGE_PRIVATE_SUBTAG defines to support language tags longer than 2 letters and private language tags (needed to set language using OpenType language tags) respectively. HB_LEAN is used when smaller binary size is desired, but in general it should not produce different shaping output. Fixes harfbuzz/harfbuzzjs#108
Remove HB_NO_LANGUAGE_LONG and HB_NO_LANGUAGE_PRIVATE_SUBTAG defines to support language tags longer than 2 letters and private language tags (needed to set language using OpenType language tags) respectively. HB_LEAN is used when smaller binary size is desired, but in general it should not produce different shaping output. Fixes harfbuzz/harfbuzzjs#108
Remove HB_NO_LANGUAGE_LONG and HB_NO_LANGUAGE_PRIVATE_SUBTAG defines to support language tags longer than 2 letters and private language tags (needed to set language using OpenType language tags) respectively. HB_LEAN is used when smaller binary size is desired, but in general it should not produce different shaping output. Fixes harfbuzz/harfbuzzjs#108
Switch HarfBuzz submodule to main branch to have the fix and add tests for it. Related to #108
Switch HarfBuzz submodule to main branch to have the fix and add tests for it. Related to #108
Harfbuzzjs is behaving as if
HB_NO_LANGUAGE_LONG
is defined, and only 2 character BCP47 tags work.Reproduce
The first glyph should change when language = "
nep
" (ISO-639-3) or "ne
" (BCP47).The second glyph should change when language = "
mar
" (ISO-639-3) or "mr
" (BCP47).However, harfbuzzjs falls back to default language when language string is set to "
nep
" or "mar
"It only works with "
ne
" or "mr
".Tools to test
Harfbuzz code
Looking at the HarfBuzz code,
hb_ot_tags_from_language
does the work, looking up the buffer's language tag fromot_languages2
to map the BCP47 tag to the OpenType tag. Only ifHB_NO_LANGUAGE_LONG
is undefined does it also tryot_languages3
, and then if there is no match does it try taking the language string as ISO-639-3 converted to uppercase.I haven't (yet) tried building hb.wasm...
The text was updated successfully, but these errors were encountered: