And here you go

So you can, for windows, pass in a depth which is needed if you want to get string measurements the same as you would get from the graphics in a paint event

This at least gives you the option to get one that measures strings the same

And, like so many things, it doesnt matter which you use on macOS as it just measures the same either way

```
Public Function BetterBitmapForCaching(extends g as graphics, width as integer, height as integer, depth as integer = 0) as Picture
Dim p As picture
If depth <> 0 Then
p = New picture(width * g.ScaleX, height * g.ScaleY, depth )
Else
p = New picture(width * g.ScaleX, height * g.ScaleY )
End If
p.Graphics.ScaleX = g.ScaleX
p.Graphics.ScaleY = g.ScaleY
p.Graphics.AntiAlias = g.AntiAlias
p.Graphics.AntiAliasMode = g.AntiAliasMode
p.Graphics.Bold = g.Bold
p.Graphics.ForeColor = g.ForeColor
p.Graphics.Italic = g.Italic
p.Graphics.PenHeight = g.PenHeight
p.Graphics.PenWidth = g.PenWidth
p.Graphics.TextFont = g.TextFont
p.Graphics.TextSize = g.TextSize
p.Graphics.TextUnit = g.TextUnit
p.Graphics.Transparency = g.Transparency
p.Graphics.Underline = g.Underline
return p
End Function
```

```
Public Function BetterBitmapForCaching(extends w as Window, width as integer, height as integer, depth as integer = 0) as Picture
Dim base As picture = w.BitmapForCaching(1,1)
If base <> Nil Then
Dim g As graphics = base.Graphics
Dim p As picture
If depth <> 0 Then
p = New picture(width * g.ScaleX, height * g.ScaleY, depth )
Else
p = New picture(width * g.ScaleX, height * g.ScaleY )
End If
p.Graphics.ScaleX = g.ScaleX
p.Graphics.ScaleY = g.ScaleY
p.Graphics.AntiAlias = g.AntiAlias
p.Graphics.AntiAliasMode = g.AntiAliasMode
p.Graphics.Bold = g.Bold
p.Graphics.ForeColor = g.ForeColor
p.Graphics.Italic = g.Italic
p.Graphics.PenHeight = g.PenHeight
p.Graphics.PenWidth = g.PenWidth
p.Graphics.TextFont = g.TextFont
p.Graphics.TextSize = g.TextSize
p.Graphics.TextUnit = g.TextUnit
p.Graphics.Transparency = g.Transparency
p.Graphics.Underline = g.Underline
Return p
End If
End Function
```