You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is other unused data inside of infos I thought it might be in
var infosPtr = exports.hb_buffer_get_glyph_infos(ptr, 0);
var infosPtr32 = infosPtr / 4;
var infos = heapu32.subarray(infosPtr32, infosPtr32 + 5 * length);
but none of this additional unreturned data seems to be what I'm looking for.
I'm looking to use the unicode codepoints from the original buffer to handle fallbacks for glyphs that are not available in the font.
Currently the glyphId is returned as 0 for all of these cases which isn't very helpful.
I'm open to alternative ways of handling this if you all have better ideas for ways to connect the original text with the shaped output.
In the result array each object has cl for the UTF-16 offset into the string and g for the glyph ID in the font. If the glyph ID is 0 you need to do fallback on the unicode cluster it corresponds to. Maybe you were expecting cl to be a full code point value rather than an offset? If you post a full example I could be of better help.
For now I've just been modifying the provided examples and trying to get strings with emojis to return something I can render. From my understanding cl is the cluster index which for single byte characters will work fine but characters like 👱🏽♂️ all of this breaks down because the cluster indexes become disconnected from the original buffer strings with the multibyte characters. I'd tried a few things to get your suggested approach to work by counting the byte length of different characters and modifying the cl values into the original strings index but there are a lot of edge cases. This isn't feeling like the correct path to take and I just want to check if maybe there is another way to access this data.
Activity
chearon commentedon Jan 13, 2023
In the
resultarray each object hasclfor the UTF-16 offset into the string andgfor the glyph ID in the font. If the glyph ID is 0 you need to do fallback on the unicode cluster it corresponds to. Maybe you were expectingclto be a full code point value rather than an offset? If you post a full example I could be of better help.talltyler commentedon Jan 13, 2023
For now I've just been modifying the provided examples and trying to get strings with emojis to return something I can render. From my understanding cl is the cluster index which for single byte characters will work fine but characters like 👱🏽♂️ all of this breaks down because the cluster indexes become disconnected from the original buffer strings with the multibyte characters. I'd tried a few things to get your suggested approach to work by counting the byte length of different characters and modifying the cl values into the original strings index but there are a lot of edge cases. This isn't feeling like the correct path to take and I just want to check if maybe there is another way to access this data.
chearon commentedon Jan 14, 2023
If I drag Noto Color Emoji into the harfbuzzjs demo and type "a👱🏽♂️b" into the input, it gives me this array:
Since
'👱🏽♂️'.length === 7, all of those indices are correct. What are the disconnected indices you're seeing?