[vtk-developers] New scaling mode for vtkTextActor
John Platt
jcplatt at dsl.pipex.com
Thu May 15 03:56:34 EDT 2008
Hi Ken,
Another scaling mode which would be very useful...
The font size used in scalar bar and XY plot titles often becomes
excessive when only a small number of characters are involved. A simple
way to mitigate this is to set a font size ceiling on the vtkTextMapper
constrained font size methods.
Typical use for vtkXYPlotActor, for example, would be
myXYPlotActor->GetXAxisActor2D()->GetTitleMapper()->SetFontSizeCeiling(1
2);
The required changes are
vtkTextMapper.h
===============
// Description:
// Set a ceiling on the font size determined by the constrained font
size
// methods. No ceiling is applied for a zero size (the default).
vtkSetClampMacro(FontSizeCeiling, int, 0, 100);
vtkGetMacro(FontSizeCeiling, int);
protected:
int FontSizeCeiling;
vtkTextMapper.cxx
=================
vtkTextMapper::vtkTextMapper()
.
// No ceiling on the font size is applied on construction.
this->FontSizeCeiling = 0;
void vtkTextMapper::PrintSelf(ostream& os, vtkIndent indent)
.
os << indent << "FontSizeCeiling: " << this->FontSizeCeiling << "\n";
int vtkTextMapper::SetConstrainedFontSize()
before return insert
if ( this->FontSizeCeiling && fontSize > this->FontSizeCeiling )
{
fontSize = this->FontSizeCeiling;
tprop->SetFontSize( this->FontSizeCeiling );
}
Some further work would be required to expose more of the text actors
but this gets the ball rolling. It would be very much appreciated if
some functionality along these lines could be implemented.
Many thanks,
John.
-----Original Message-----
From: vtk-developers-bounces at vtk.org
[mailto:vtk-developers-bounces at vtk.org] On Behalf Of Moreland, Kenneth
Sent: 14 May 2008 23:52
To: vtk-developpers
Subject: [vtk-developers] New scaling mode for vtkTextActor
Hi folks,
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.
As part of this changed, I would like to deprecate the Set/GetScaledText
methods and replace them with a Set/GetTextScaleMode to capture the
tri-scaling state. Are there any objections?
-Ken
**** Kenneth Moreland
*** Sandia National Laboratories
***********
*** *** *** email: kmorel at sandia.gov
** *** ** phone: (505) 844-8919
*** fax: (505) 845-0833
_______________________________________________
vtk-developers mailing list
vtk-developers at vtk.org
http://www.vtk.org/mailman/listinfo/vtk-developers
More information about the vtk-developers
mailing list