title: How can I get the width of a String when I use TextPaint() in Compose?
body: <p>I use Code A to draw a text with Compose, and I can use either Code B or Code C to get the height of the string.</p>
  <p>I hope to get the  width of the  String <code>var label=&quot;Hello, world!&quot;</code>, how can I do ?</p>
  <p><strong>Code A</strong></p>
  <pre><code>val paintText = TextPaint().also {
      it.isAntiAlias = true
      it.color = Color.Red.toArgb()
      it.textSize = 30f
  }
  
  var label=&quot;Hello, world!&quot;
  it.nativeCanvas.drawText( label, x, y, paintText )
  </code></pre>
  <p><strong>Code B</strong></p>
  <pre><code>val fontHeight = paintText.textSize
  </code></pre>
  <p><strong>Code C</strong></p>
  <pre><code>val fm= paintText.fontMetrics
  val fontHeight: Float = fm.descent - fm.ascent
  </code></pre>