-
-
Notifications
You must be signed in to change notification settings - Fork 92
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
Trying to toggleStyle with emoticons selected breaks toggleStyle #149
Comments
I will take a look into this but if feels strange. Can you print attributes of the selected string, in order to distinguish, what is the issue (if its kerning or paragraph style or something else...) Thanks! |
Here is the print of the attributed string. The unexpected behaviour only happens with emoticon at the beginning of the line
|
Hello @noox89 again, I think I found the issue but I am not quite sure what to do with it right now. You see, when apple renders Emojis, it uses font Apple Color Emoji which is special font with very nice symbolic traits which are probably not available in UIKit and we need to fix this in CoreText. The issue is not just one function, altought I would be happy to fix it only in that way... Given the font: The issue is in here:
which when we apply font style, we get richTextFont, our poor NSAttributes cannot get all the fonts at all ranges, so they return just the first font, which (unlucky for you) is Apple Color Emoji It sets this font to whole text together with bold and thats where the troubles begin. Because this font should be used for emojis only, it has some quirks like super long spaces etc and it causes the behaviour you are seeing. I See the solution in some steps:
cc @danielsaidi looks like we have serious issue 😨 Final.bug.movBTW Thanks for reporting this❗️ |
Looks like my little PoC fixes the issue, but I need to add unit tests probably for this afterwards... Simulator.Screen.Recording.-.iPhone.15.-.2024-03-01.at.01.00.02.mp4
You can see I am enumerating the attributes and setting each coresponding font to just bold or italic (with some sample extensions) I am going to sleep now, but I guess I can take a look tommorow :) Thanks and good night :) |
Thanks for explanation and quick turnaround!:) Btw I like your new func -> čáry máry fuk 🧙♂️ Díky/Thanks🥳 |
Omg, great find @noox89 and @DominikBucher12 |
Let's release 1.0 and look at this later. |
RPReplay_Final1708962172.MP4
When selecting text which includes emoticons and applying
context.toggleStyle(.bold)
orcontext.toggleStyle(.italic)
the spacing gets disrupted andtoggleStyle
stops working. To get back to normal, font needs to be changed.The text was updated successfully, but these errors were encountered: