[Lazarus] fpVectorial text related question

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Mon Jun 6 11:06:43 CEST 2011

On Mon, Jun 6, 2011 at 1:32 AM, Leonardo M. Ramé <l.rame at griensu.com> wrote:
> 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.

It is impossible to measure text in vectorial graphics because the
rendering font is not known. Note how, for example, AutoCAD and SVG
don't support it. There are two possible work arounds:

1> Try to make a clever guess based on the font info and add an extra
safety spacing
2> Add script capabilities

> Example. Here's more or less what I want to draw:
> |---- 10cm ----|

That looks like a Dimension. There is an element dedicated to that:

Maybe that's what you want to draw?

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

We can simply add a new element to represent that. Some questions come
from that: As double-precision degrees or as integer 1/16 of degrees?
Rotating in which direction for positive values? Which output do you
use? fpvtocanvas? Or image formats?

Felipe Monteiro de Carvalho

More information about the Lazarus mailing list