-
From my understanding There is other unused data inside of
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. 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. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 10 replies
-
In the |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
If I drag Noto Color Emoji into the harfbuzzjs demo and type "a👱🏽♂️b" into the input, it gives me this array:
Since |
Beta Was this translation helpful? Give feedback.
-
I added code based on my understanding of your logic to print out the string representation of cluster along with the other relevant information which works for the case you are talking about. Using 'Noto Color Emoji' I get this result using the same input
What I've been looking to do it the opposite. Using fonts like Roboto-Black.ttf that is included in the examples I would like to be able to render both what is supported by Roboto and other multibyte characters like emojis. With this Roboto I get this output from the same string and code from above.
I was assuming this output was expected and I needed to find a way to take the glyphs unsupported by this font out of this result but maybe what you are telling me is that this shaped result is wrong and I should always be seeing 3 clusters but 7? I've been trying to work with these results as is and this is the basis for my questions. I was thinking I could maybe ignore cl 5 and 7, then anything with the same ax value could maybe be part of the same multibyte character but there are layers of assumptions here and it gets worse with longer strings and multiple emojis which is why I wanted to link the original input string back to these results more directly, there is still a connection here but the results are hard for me to reason with. I'm trying to render text in a variety of fonts that don't always have all the glyphs they need but have fallbacks to other fonts so that the original input is always rendered. I was trying todo this one cluster at a time based on the shaped results but maybe I should be thinking about this differently. |
Beta Was this translation helpful? Give feedback.
-
So that you know I've also tried setClusterLevel of 0, 1 and 2 which from my understanding is the main thing that controls which grapheme cluster boundary is used.
If you have suggested of other API methods to look into please let me know. |
Beta Was this translation helpful? Give feedback.
So that you know I've also tried setClusterLevel of 0, 1 and 2 which from my understanding is the main thing that controls which grapheme cluster boundary is used.
The output for one and two for the same as I posted before but setting the value to 0 give this response which seems worse but the docs also recommend not using this cluster level.