casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
casa::DLFont Class Reference

A class designed to manage several representations of the same font. More...

#include <DLFont.h>

Public Types

enum  FontDescription {
  Name,
  XFontDescription,
  PSFontName
}
 

Public Member Functions

 DLFont ()
 (Required) default constructor. More...
 
 DLFont (const casacore::String &description, const DLFont::FontDescription whatType=DLFont::Name, const casacore::Int &size=12)
 The constructor accepts any description of the font. More...
 
 DLFont (const DLFont &other)
 Copy constructor using copy semantics. More...
 
virtual ~DLFont ()
 Destructor. More...
 
DLFontoperator= (const DLFont &other)
 Copy assignment. More...
 
casacore::String getXValueNoSize ()
 Return the current font as a XLFD. More...
 
casacore::Int getSize ()
 Return the current font as a post-script recognisable name casacore::String getPSValueNoSize();. More...
 
casacore::String getXValue ()
 Return the current font as a XLFD, with the specific size. More...
 
casacore::String getPSValue ()
 Return the current font as a PS recognisable name, with the specific size 'tagged onto' the end of it. More...
 
casacore::String getName ()
 Return the name (as it should be presented to users) of the font. More...
 
void setName (const casacore::String &newName)
 Set the name of the font. More...
 
void setSize (const casacore::Int newSize)
 Set the desired size (pixelSize) More...
 
void setXValue (const casacore::String &newX11)
 Set the XLFD for this font (if you wish to set at matrix for any fields e.g. More...
 
void setPSValue (const casacore::String &newPS)
 Set the Postscript representation of this font. More...
 
casacore::Vector
< casacore::String
getAllNames ()
 

Private Member Functions

void fillArrays ()
 
casacore::Bool lookUp (const casacore::String &desc, const DLFont::FontDescription, casacore::Int &returnIndex)
 

Private Attributes

casacore::Vector
< casacore::String
itsXFonts
 
casacore::Vector
< casacore::String
itsPSFonts
 
casacore::Vector
< casacore::String
itsNames
 
casacore::Int itsSize
 
casacore::Int itsCurrentFont
 

Detailed Description

A class designed to manage several representations of the same font.

Intended use:

Public interface

Etymology

DLFont is a class designed to manage multiple representations of the same font.

Motivation

Different DL media (e.g. X11 and postscript) have different ways of representing fonts. The user, however should be presented with a single representation across all media types. This class is designed to represent a single font, as observed by the user, but also to contain different representations of the font for each media.

Thrown Exceptions

To Do

Definition at line 70 of file DLFont.h.

Member Enumeration Documentation

Enumerator
Name 
XFontDescription 
PSFontName 

Definition at line 73 of file DLFont.h.

Constructor & Destructor Documentation

casa::DLFont::DLFont ( )

(Required) default constructor.

casa::DLFont::DLFont ( const casacore::String description,
const DLFont::FontDescription  whatType = DLFont::Name,
const casacore::Int size = 12 
)

The constructor accepts any description of the font.

By default it is the 'name' of the font. You can also construct a DLFont by either of its other descriptions, by using the appropriate 'FontDescription'. e.g to select Times by its PostScript name:

DLFont myFont("Times-Roman", DLFont::PSFontName);

is equivalent to :

DLFont myFont("-adobe-times-medium-r-*--*", DLFont::XFontDescription);

or, more simply :

DLFont myFont("Times - Roman");
casa::DLFont::DLFont ( const DLFont other)

Copy constructor using copy semantics.

virtual casa::DLFont::~DLFont ( )
virtual

Destructor.

Member Function Documentation

void casa::DLFont::fillArrays ( )
private
casacore::Vector<casacore::String> casa::DLFont::getAllNames ( )
inline

Definition at line 150 of file DLFont.h.

References itsNames.

casacore::String casa::DLFont::getName ( )

Return the name (as it should be presented to users) of the font.

casacore::String casa::DLFont::getPSValue ( )

Return the current font as a PS recognisable name, with the specific size 'tagged onto' the end of it.

Referenced by casa::PSPixelCanvas::setFont().

casacore::Int casa::DLFont::getSize ( )

Return the current font as a post-script recognisable name casacore::String getPSValueNoSize();.

Return the current fonts desired size

Referenced by casa::PSPixelCanvas::setFont().

casacore::String casa::DLFont::getXValue ( )

Return the current font as a XLFD, with the specific size.

NB If there is any matrix transform in the pixel size field of the XLFD, this will not preserve it. To do operations e.g. rotation, extract the desired font size (getSize) and the font info (getXFontNoSize) seperately before applying required transforms

casacore::String casa::DLFont::getXValueNoSize ( )

Return the current font as a XLFD.

Although it states "noSize", it may actually return a size. e.g. a call to "setXValue", providing an entry in the size field will result in a XLFD with a valid size field. However, if you do a "setSize", then call this method, the change in size will not be reflected.

casacore::Bool casa::DLFont::lookUp ( const casacore::String desc,
const DLFont::FontDescription  ,
casacore::Int returnIndex 
)
private
DLFont& casa::DLFont::operator= ( const DLFont other)

Copy assignment.

void casa::DLFont::setName ( const casacore::String newName)

Set the name of the font.

void casa::DLFont::setPSValue ( const casacore::String newPS)

Set the Postscript representation of this font.

void casa::DLFont::setSize ( const casacore::Int  newSize)

Set the desired size (pixelSize)

void casa::DLFont::setXValue ( const casacore::String newX11)

Set the XLFD for this font (if you wish to set at matrix for any fields e.g.

set the size field as a rotation matrix to rotate text, you will need to handle the size of the text independantly of this class. You can use the getXValueNoSize for that. i.e. class will not preserve rotated/scaled text via matrix transforms

Member Data Documentation

casacore::Int casa::DLFont::itsCurrentFont
private

Definition at line 167 of file DLFont.h.

casacore::Vector<casacore::String> casa::DLFont::itsNames
private

Definition at line 164 of file DLFont.h.

Referenced by getAllNames().

casacore::Vector<casacore::String> casa::DLFont::itsPSFonts
private

Definition at line 163 of file DLFont.h.

casacore::Int casa::DLFont::itsSize
private

Definition at line 166 of file DLFont.h.

casacore::Vector<casacore::String> casa::DLFont::itsXFonts
private

Definition at line 162 of file DLFont.h.


The documentation for this class was generated from the following file: