Is it possible (or planned) to draw a `Text` with ...
# compose
l
Is it possible (or planned) to draw a
Text
with outline? This was done with
Paint.Style.STROKE
, but there's no painter on
Text
parameters. I want to draw a text in white with a black border (like a shadow, but without blur)
n
I don’t think it’s possible (yet). I went already through all different possibilities offered by
TextStyle
or
SpanStyle
but it seems there’s no way right now to do that other than play around with shadows I guess
l
cc @Siyamed
s
hmm.. I knew Paint would be an issue in the future but wasn’t expecting it to be fast.
Currently we do have internal Paint object(s) that we use. It is possible to expose it but I couldn’t know about the priority and side effects.
@len is it possible for you to create a ticket about this?
l
i think exposing paint seems like a strong step in the wrong direction. what about just adding stroke to textstyle or something?
s
stroke?
l
but yeah, maybe a ticket is a better place to discuss 🙂
well it sounds like the stroke style is the desired support from len here, no?
s
I was going to say even if Text exposes the Paint, it wouldnt possible to do the same for AnnatatedString so it might be a deep hole
I want to draw a text in white with a black border (like a shadow, but without blur)
if we add stroke etc, then it will end up in more Paint params. I need to check it but at the end of the day Paint has lots of configurations.
stroke, stroke type, dashed, stroke color you name it 🙂
l
I was thinking of the stroke/outline like a subclass of
Shadow
, although it's not exactly that, but it allows to support them without changing the public
Text
API (or that's what I think)
But my solution doesn't sound right to me. I don't know what the proper solution would be, but I think it could be a nice addition for when you draw text over a background/image as it improves readability (shadow is also an option but IMO the outline is better, and also with any color, not just black)
❤️ 1
🙏 1