[vtk-developers] Taming contrained font size in vtkTextMapper

Wylie, Brian bnwylie at sandia.gov
Sun Jul 10 19:24:07 EDT 2005


By the way, just as a general observation, I've always considered the
'bar of colors' in the scalar bar actor to be too thick in proportion to
it's length and associated annotation text size. I know it messes up all
the image tests but could the scalar bar be a tad thinner?
 
(How's that for nit-picky :)
 

Brian Wylie - Org 9227 
Sandia National Laboratories 
MS 0822 - Building 880/A1-J 
(505)844-2238 FAX(505)845-0833                       
     ____                  _    __ 
    / __ \____  _________ | |  / (_)__ _      __ 
   / /_/ / __ `/ ___/ __ `/ | / / / _ \ | /| / / 
  / ____/ /_/ / /  / /_/ /| |/ / /  __/ |/ |/ / 
 /_/    \__,_/_/   \__,_/ |___/_/\___/|__/|__/

                                    Unleash the Beast 

 


________________________________

	From: vtk-developers-bounces+bnwylie=sandia.gov at vtk.org
[mailto:vtk-developers-bounces+bnwylie=sandia.gov at vtk.org] On Behalf Of
John Platt
	Sent: Thursday, July 07, 2005 3:12 PM
	To: vtk-developers at vtk.org
	Subject: [vtk-developers] Taming contrained font size in
vtkTextMapper
	
	

	Hi all,

	 

	The font size used in scalar bar and XY plots 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

	 

	vtkTextMapperEx::vtkTextMapperEx()

	...

	  // No ceiling on the font size is applied on construction.

	  this->FontSizeCeiling = 0;

	 

	void vtkTextMapperEx::PrintSelf(ostream& os, vtkIndent indent)

	...

	  os << indent << "FontSizeCeiling: " << this->FontSizeCeiling
<< "\n";  

	 

	int vtkTextMapperEx::SetConstrainedFontSize()

	 

	before return insert

	 

	  if ( this->FontSizeCeiling && fontSize > this->FontSizeCeiling


	  {

	     fontSize = this->FontSizeCeiling;

	     tprop->SetFontSize( this->FontSizeCeiling );

	  }

	 

	Some further work will be required to expose more of the text
actors but this gets the ball rolling.

	 

	If there are no obvious problems, I would really appreciate it
if this enhancement could be made.

	 

	Many thanks

	 

	John.

	 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20050710/bc9fcee9/attachment.html>


More information about the vtk-developers mailing list