Hi, I'm trying to find a way to print some long string on a canvas with wordwrapping.
Eventually I'll be sending this canvas to a standard 8.5 x 11 inch printer.
I have seen the post
https://www.b4x.com/android/forum/threads/draw-multiline-text-on-canvas.42933/
which is great if you know where to put the CRLF, but what if you just have a long
string without embedded CRLF. Is there some useful approach someone could suggest.
So I have
' Create a bitmap ( bdw ) to draw on, and then initialize it
Dim bdw As Bitmap ' This is the Bitmap we are drawing on
Dim Const intPageWidth As Int = 850dip
Dim Const intPageHeight As Int = 1100dip
Dim Const intOneInch As Int = 100dip
bdw.InitializeMutable( pageWidth, pageHeight)
Dim strLngStr as String = " ...... this may be a few paragraphs "
Now if this string could fit on a single printed line I could write
intLeft = pageWidth /2 ,
cvs.DrawText("strLngStr",intLeft, intTop, _
Typeface.DEFAULT_BOLD, 20, Colors.Blue, "CENTER")
But let's say I want to fit into a box with a 15% of the pagewidth
I don't know how much text fits in that width so I don't know
where to break the lines.
Any ideas ?
- Jeff