what is a reliable way to test whether a font actu...
# compose
t
what is a reliable way to test whether a font actually has glyphs for a code point, given that
Typeface.getUTF32Glyph
does not appear to do that?
been trying to figure out whether there is a sensible way to do this, but the first thing is, my current logic seems to think that NotoSans has a glyph for unprintable characters. that alone should be fairly easy to dodge, but it isn't the complete picture
here for example is a decent chunk of code points where the font claims not to have a glyph, but it renders perfectly fine
then there are combining marks. it looks like if NotoSans claims it doesn't have a glyph for one of those, often it does, but it just renders without the placeholder character. whereas if it claims it does have a glyph, it seems to provide the placeholder character too
I guess what I'm looking for is a way to tell whether I'm going to get tofu when I render a code point using a given font family, so that I can make a best effort to render "anything", even if that means using LastResort. But I don't want to accidentally use LastResort when there is a better option available, and it looks like Skia's font fallback is generally doing a good job of falling back to some other font for a lot of code points which are missing in NotoSans. I just have no idea how to get a peek inside Skia to figure out in advance whether the fallback is going to work or not
r
Are you using Compose on Android?
t
desktop mostly
android is a future dream
r
t
I wonder what is backing that method... I guess I could go looking
I haven't gone looking on places like DrawScope, Canvas, etc. for this yet
atm I jump through some hoops to get the skia.Typeface, and then call getUTF32Glyphs, but it often claims no glyphs but then renders the text fine
even things like TextLayoutResult surely must contain the knowledge of font fallbacks, because you'd have to do the fallbacks to measure the glyphs, so you wouldn't be able to even layout a line of text without it
but getting the info out...
Shaper
might be the right way