William Lancee Well-Known Member Licensed User Longtime User Dec 28, 2021 #1 When the textsize is greater then 35, the line spacing is inconsistent B4X: Copy BBCodeView1.Text = _ $" [TextSize=42]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc fermentum elit vitae nisi faucibus, vitae lacinia turpis mattis. [/TextSize] "$
When the textsize is greater then 35, the line spacing is inconsistent B4X: Copy BBCodeView1.Text = _ $" [TextSize=42]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc fermentum elit vitae nisi faucibus, vitae lacinia turpis mattis. [/TextSize] "$
Erel B4X founder Staff member Licensed User Longtime User Dec 29, 2021 #2 This is not a bug. Line spacing isn't consistent by default. There are two relevant properties in TextEngine: https://www.b4x.com/android/forum/threads/b4x-solved-bblabel-line-spacing.134482/post-851072
This is not a bug. Line spacing isn't consistent by default. There are two relevant properties in TextEngine: https://www.b4x.com/android/forum/threads/b4x-solved-bblabel-line-spacing.134482/post-851072
William Lancee Well-Known Member Licensed User Longtime User Dec 29, 2021 #3 Keeping those properties constant (default here)... On my screen, the spacing between the o of Lorem and the o of consectetur is 5mm. But the spacing between u of Nunc and u of faucibus is only 3mm. Is that really by design? Or is it too subtle to see? (The effect is only present/seen for larger font sizes)
Keeping those properties constant (default here)... On my screen, the spacing between the o of Lorem and the o of consectetur is 5mm. But the spacing between u of Nunc and u of faucibus is only 3mm. Is that really by design? Or is it too subtle to see? (The effect is only present/seen for larger font sizes)
Erel B4X founder Staff member Licensed User Longtime User Dec 30, 2021 #4 Increase those values and the line height will be consistent.
William Lancee Well-Known Member Licensed User Longtime User Dec 30, 2021 #5 That works with SpaceBetweenLines= 40dip. The minimum is not relevant to this issue. I could use B4XCanvas to measure font height and use that value (1x or 1.5x or 2x). Thanks.
That works with SpaceBetweenLines= 40dip. The minimum is not relevant to this issue. I could use B4XCanvas to measure font height and use that value (1x or 1.5x or 2x). Thanks.
William Lancee Well-Known Member Licensed User Longtime User Dec 31, 2021 #6 Once again, @Erel points out that what appears to a bug is just a wrong assumption. Somewhere behind the scenes, the code is computing a line spacing and then increases it if the text does not fit. Of course that makes sense (after understanding the process). For those who are following this thread, the formula below works for me. Note that since the line spacing occurs in the text engine, all text in a given code view has the same spacing, irrespective of varying font sizes. However, you can use the [Vertical=..] tag [/Vertical] to override the default. B4X: Copy Dim fs As Int = 35 'or whatever your font size is Textengine1.SpaceBetweenLines = 1.85 * cv.MeasureText("X", xui.CreateDefaultFont(fs)).Height
Once again, @Erel points out that what appears to a bug is just a wrong assumption. Somewhere behind the scenes, the code is computing a line spacing and then increases it if the text does not fit. Of course that makes sense (after understanding the process). For those who are following this thread, the formula below works for me. Note that since the line spacing occurs in the text engine, all text in a given code view has the same spacing, irrespective of varying font sizes. However, you can use the [Vertical=..] tag [/Vertical] to override the default. B4X: Copy Dim fs As Int = 35 'or whatever your font size is Textengine1.SpaceBetweenLines = 1.85 * cv.MeasureText("X", xui.CreateDefaultFont(fs)).Height