When I change my phones font size from default to large I see the expected increase in text size, except with strings generated by CSBuilder. CSBuilder strings don't change with the system setting, and consequently the resultant calculated height of a label are wrong. I've attached the code, and two screen images that show the problem. The font size is set to 18 for both labels. screen 1 shows default fonts, screen 2 shows "large" fonts. I use CSBuilder in order to have varied text size and colors in my app (not this quick demo).
As you can see, even with normal fonts there is a slightly different height result. With large fonts, it's exaggerated, but the CSBuilder strings also don't change size! I have the same problem on two tablets and my phone.
Any help is appreciated!
As you can see, even with normal fonts there is a slightly different height result. With large fonts, it's exaggerated, but the CSBuilder strings also don't change size! I have the same problem on two tablets and my phone.
Any help is appreciated!
B4X:
Sub Globals
Dim Label1, Label2 As Label
Dim cs As CSBuilder
Dim txt As String
Dim su As StringUtils
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("labels")
txt = "Now is the time for all good men to come to my aid and bring beer and pretzels" & CRLF
cs.Initialize.Size(18).Color(Colors.White).Append(txt).PopAll
Label1.Text = txt
Label1.TextSize = 18
Label2.Text = cs
Label1.Height = su.MeasureMultilineTextHeight(Label1, Label1.Text)
Label2.Height = su.MeasureMultilineTextHeight(Label2, Label2.Text)
End Sub