title: Why can't toPx() work outside of Canvas in Jetpack Compose?
body: <p>In the below code, <code>toPx()</code> works in <code>Canvas</code> but not in <code>Surface</code>.<br />
  Why?</p>
  <pre><code>Canvas(modifier = Modifier.size(16.dp)) {
      val textPaint = Paint().asFrameworkPaint().apply {
          textSize = 32.dp.toPx()
      }
  }
  
  Surface(modifier = Modifier.size(16.dp)) {
      val textPaint = Paint().asFrameworkPaint().apply {
          textSize = 32.dp.toPx() // Error `toPx()`
      }
  }    
  </code></pre>