Public Sub FontToBitmap (text As String, Fuente As B4XFont, color As Int) As B4XBitmap
Dim xui As XUI
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, 0, 0, 32dip, 32dip)
Dim cvs1 As B4XCanvas
cvs1.Initialize(p)
Dim fnt As B4XFont = Fuente
Dim r As B4XRect = cvs1.MeasureText(text, fnt)
Dim BaseLine As Int = cvs1.TargetRect.CenterY - r.Height / 2 - r.Top
cvs1.DrawText(text, cvs1.TargetRect.CenterX, BaseLine, fnt, color, "CENTER")
Dim bmp As B4XBitmap = cvs1.CreateBitmap
Dim cg As NativeObject = bmp
Dim uiimg As NativeObject
bmp = uiimg.Initialize("UIImage").RunMethod("imageWithCGImage:scale:orientation:", Array(cg.RunMethod("CGImage", Null), 1, _
cg.GetField("imageOrientation")))
cvs1.Release
Return bmp
End Sub