VCL: How to know the width of a text to be drawn

Caolán McNamara caolanm at redhat.com
Thu Jan 31 04:09:41 PST 2013


On Thu, 2013-01-31 at 09:38 -0200, Rodolfo wrote:
> I'm drawing a comment control and I need to know two things:
> 
> 1. The text width (to move text to right side in RTL systems)
> 2. The text line base (to align it to an horizontal arrow I draw)
> 
> By now, I only know how to draw a text with OutputDevice::DrawText(),
> so I can't make my hack properly.

if you look at the vcl/inc/vcl/outdev.hxx header there a few things that
might be useful, e.g. GetTextHeight, GetTextWidth, GetTextArray
(depending on what you code looks like, might be worth sending a patch
with "//FIXME: what I want to happen here" in them. e.g. there are
various parts of vcl for Controls which auto-swap the device so that in
RTL mode the Control is swapped around automatically without explicit
RTL positioning.

C.



More information about the LibreOffice mailing list