[vtk-developers] New scaling mode for vtkTextActor

Moreland, Kenneth kmorel at sandia.gov
Thu May 15 18:10:50 EDT 2008


The way I scale the font is that I assume that the font is defined for a window whose longer dimension is 6 inches at 72 DPI and then scale accordingly.  So basically, I scale the font as

  targetSize*longerViewportLength/(6*72)

The logic is a bit hokey, but it really is only establishing a baseline for how big to make the font, and the result seems to yield fonts that are about the size expected.  This is the same method I used to scale the labels in the ParaView scalar bar widget, and it seems to work pretty well.

-Ken

> -----Original Message-----
> From: David C Thompson [mailto:dcthomp at sandia.gov]
> Sent: Wednesday, May 14, 2008 5:48 PM
> To: Moreland, Kenneth
> Cc: vtk-developpers
> Subject: Re: [vtk-developers] New scaling mode for vtkTextActor
>
> > I've been working on ParaView bug #6096
> > (http://www.paraview.org/Bug/view.php?id=6096) and as part of the
> > solution I would like to implement a new scaling mode to vtkTextActor.
> > Right now, vtkTextActor can either used a fixed font or can scale the
> > text to fit within the bounds of the prop.  I propose implementing a
> > third mode that will scale the font based on the size of the viewport
> > in which the prop is placed.
>
> How are you measuring the "size of the viewport"? Pixels? Millimeters? I
> think the problem you are having with the existing modes is that
>
> 1. The vtkWindow::DPI member is not being changed when a high-resolution
> movie is being rendered
>
> and
>
> 2. While they are supposed to be using the vtkTextProperty font size as
> a number with units of "points", the various actor/mapper classes end up
> assuming a fixed-resolution (75 dpi) output device. For instance, see
> vtkFreeTypeUtilities::GetSize.
>
>         David





More information about the vtk-developers mailing list