[Lazarus] fpVectorial text related question

Leonardo M. Ramé l.rame at griensu.com
Mon Jun 6 01:32:12 CEST 2011


Hi, I would like to know how can I measure text in fpVectorial. I need
to draw a segment with text in the middle of the segment and I can't
find any helper function to do that.

Example. Here's more or less what I want to draw:

|---- 10cm ----|

As you see, the text "10cm" is in the middle of the segment, to do that,
I usually use this function:

lText := '10cm';
lTextWidth := GetTextWidth(lText); 
lSegmentWidth := 1000;
lTextPosX := (lSegmentWidth / 2) - (lTextWidth / 2);

Also, I whould like to be able to draw the text rotated to follow the
angle of the segment. Is this possible?.

Thanks in advance,
Leonardo M. Ramé
http://leonardorame.blogspot.com




More information about the Lazarus mailing list