Measure text height #1735
rob-johansen
started this conversation in
General
Replies: 1 comment 1 reply
-
This is a very fair request as we may be able to expose APIs from Skia to do exactly just that. I create #1736 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
React Native Skia is a great library—I'm really enjoying using it!
I have a
<Text>
element rendering just one dynamic letter of the alphabet at a time, and I'm trying to measure its height so I can center it vertically no matter which letter it's displaying. I'm able to center it horizontally with help fromgetTextWidth()
, but I see there's nogetTextHeight()
method. I've tried calling both of the following on theSkFont
instance returned fromuseFont()
...getMetrics().bounds?.height
getMetrics().ascent
...but they don't quite seem to help me get it centered vertically.
Is there a way to get the height of a font or a
<Text>
element?Beta Was this translation helpful? Give feedback.
All reactions