Is this a regression? I was under the impression t...
# compose-web
a
Is this a regression? I was under the impression that the font issues (emojis not shown with the default font) was fixed according to this. But I am using 1.7.1 and I still see weird shapes instead of emojis with the default font
a
@Oleksandr Karpovich [JB] ^^
o
> emojis not shown with the default font The default font won't show the emojis. You still need to provide a fallback font which includes emojis (for example Noto Color Emoji). To do so, you'd need to load it an add it like shown in the usage example in the PR. Note that there is
fontsLoaded.value = true
. Its purpose is to know when the fallback font is ready, so you know when to show the app content. Otherwise the UI would start rendering before the fallback font is ready. If you have added a fallback font but still it shows tofu, it's likely that the font doesn't have a glyph for that particular emoji. In that case you'd need to use some other font. But first try showing some popular emojis. _ P.S. The proper documentation for this is in progress.
a
@Oleksandr Karpovich [JB] can you explain this more? is this using noto color emoji only for the characters the default font can't render?
If I am getting this right, if I want to use an other font in my UI say Inter, I would also need to load an emoji font, so that emojis are rendered correctly, yes?
o
> I would also need to load an emoji font, so that emojis are rendered correctly, yes? Yes. You would "register" your loaded font family like this:
Copy code
fontFamilyResolver.preload(emojiFontFamily)
It works like this: As a first step, the implicit font manager (in skia) is trying to find a glyph in the fonts provided by you in a Theme or right in a Text() composable call. If it can't find it there, it would try to find them in a default font (Roboto Regular is bundled into skiko.wasm). And if it can't find it there, the last step is to check the fallback fonts. When you use
fontFamilyResolver.preload
it would add it to the collection of fallback fonts. If it not found there, then it would be shown as a tofu - □
👍 1
d
@Oleksandr Karpovich [JB] What are the chances of having this be added to the template generated by the web wizard?
o
@dewildte I'll make a note of such a request. The downside of such an approach is that the extra font might remain in the project even if it's not needed. The first problem is that this feature is not documented yet, it's in progress though.