Wish PdfDocument - Allow Canvas Measuring without StartPage - Robert Valentino    Feb 27, 2019 Private mPDF As PdfDocument mPDF.Initialize mPDF.StartPage(mPageSize.Width, mPageSize.Height) TextHeight = mPDF.Canvas.MeasureStringHeight(mMeasureHeightString, mFont_Roboto_Regular, (10 / mScale)) SubHeadingHeight = mPDF.Canvas.MeasureStringHeight(mMeasureHeightString... you can MeasureStringHeight or MeasureStringWidth Normally I measure my Header items to determine where I want to... B4A Question Max Text Size - RandomCoder    May 26, 2015 it works correctly but if smaller then the textsize is too large even though the canvas MeasureStringHeight suggests that it should fit?
I've thrown together a small sample (attached), and the code...)
' Set canvas and initialise text size to try
Dim c As Canvas
c.Initialize(v)
Dim...)
Dim fltH As Float = c.MeasureStringHeight(str, Typeface.DEFAULT_BOLD, fltSize)
' Check... B4A Question MeasureStringHeight - Sergey_New    Mar 2, 2024 To set the label height I use this code
Dim cn As Canvas
cn.Initialize(Activity)
lbl.Height=cn.MeasureStringHeight("T", Typeface.DEFAULT,14)
To display correctly, the height of the label... Share My Creation [Web] SithasoIONIC Wireframes - A free tool for the b4x community - (Canva/Figma Alternative) - Mashiane    Sep 17, 2025   (11 reactions) Hi there b4x community family.
148690
FUNCTIONALITY
Ability to create different types of applica... B4A Question Question about text size - klaus (first post)    Nov 7, 2015 Canvas.MeasureStringHeight(Text As String, Typeface As Typeface, TextSize As Float)
Returns : Float... B4A Question Canvas.DrawText Positioning issue/formula - RandomCoder (first post)    Jun 22, 2015 I'm pretty sure that the problem will be with the Canvas.MeasureStringHeight it is not reliable. Erel advised me in a previous post somewhere on the Forum to use StringUtils instead.... B4A Question Canvas Draw Text Center Is Not Centering - Jeffrey Cameron (first post)    Jun 22, 2018   (2 reactions) The link is quite old from 2010 and does not address the 'CENTER' position. Correct, but it did nicely illustrate the origin point of the drawtext method which is what I was attempting to emphasize. It should also be noted that the text is drawn starting from the origin point, UP and left/right from the origin point. So, if you wish to correctly center the text on the Y axis you should add 1/2 of the text height to your Y value (see Canvas.MeasureStringHeight).... B4A Question Resize Label text with Java Object - klaus (first post)    May 21, 2015   (1 reaction) Unfortunately your code will not work in all cases because Canvas1.MeasureStringHeight returns different values depending on the text.
Example:
Canvas1.MeasureStringHeight("a", Typeface.DEFAULT, 16)
Canvas1.MeasureStringHeight("A", Typeface.DEFAULT, 16)
Canvas1.MeasureStringHeight("Aj", Typeface.DEFAULT, 16)
These three statements return different values !
The factor... B4A Question Listview label height - LucaMs (first post)    Mar 31, 2014 damn... and canvas MeasureStringHeight also don't calculates the text height as i need.
Thanks for you help.... B4A Question fontsize multiple layout - Erel (first post)    May 28, 2015   (1 reaction) Canvas.MeasureStringHeight is based on a lower level API that doesn't behave in the same way that a Label or EditText will behave. StringUtils uses the same measurement process as the views.... Page: 1   2   3   4   5   6   7   |