casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DLFont.h
Go to the documentation of this file.
1 //# DLFont.h : Class to provide encapsulation for fonts
2 //# Copyright (C) 2000,2002
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id:
27 
28 
29 #ifndef TRIALDISPLAY_DLFONT_H
30 #define TRIALDISPLAY_DLFONT_H
31 
32 #include <casa/BasicSL/String.h>
33 #include <casa/Exceptions.h>
34 
35 namespace casa { //# NAMESPACE CASA - BEGIN
36 
37 // <summary>
38 // A class designed to manage several representations of the same font
39 // </summary>
40 
41 // <use visibility=export>
42 
43 // <reviewed reviewer="" date="" test="" demos="">
44 // </reviewed>
45 
46 // <prerequisite>
47 // </prerequisite>
48 
49 // <etymology>
50 // DLFont is a class designed to manage multiple representations of the
51 // same font.
52 // </etymology>
53 
54 // <motivation>
55 // Different DL media (e.g. X11 and postscript) have different ways of
56 // representing fonts. The user, however should be presented with a single
57 // representation across all media types. This class is designed to represent
58 // a single font, as observed by the user, but also to contain different
59 // representations of the font for each media.
60 // </motivation>
61 
62 // <thrown>
63 // <li> None.
64 // </thrown>
65 
66 // <todo asof="2002/05/13">
67 // <li> Nothing known.
68 // </todo>
69 
70  class DLFont {
71 
72  public:
74 
75  // (Required) default constructor.
76  DLFont();
77 
78  // The constructor accepts any description of the font. By default it is
79  // the 'name' of the font. You can also construct a DLFont by either of
80  // its other descriptions, by using the appropriate 'FontDescription'.
81  // e.g to select Times by its PostScript name:
82  // <srcblock>
83  // DLFont myFont("Times-Roman", DLFont::PSFontName);
84  // </srcblock>
85  // is equivalent to :
86  // <srcblock>
87  // DLFont myFont("-adobe-times-medium-r-*--*", DLFont::XFontDescription);
88  // </srcblock>
89  // or, more simply :
90  // <srcblock>
91  // DLFont myFont("Times - Roman");
92  // </srcblock>
93  DLFont(const casacore::String& description,
94  const DLFont::FontDescription whatType = DLFont::Name,
95  const casacore::Int& size = 12);
96 
97  // Copy constructor using copy semantics.
98  DLFont(const DLFont& other);
99 
100  // Destructor.
101  virtual ~DLFont();
102 
103  // Copy assignment.
104  DLFont &operator=(const DLFont &other);
105 
106  // Return the current font as a XLFD. Although it states "noSize", it may
107  // actually return a size. e.g. a call to "setXValue", providing
108  // an entry in the size field will result in a XLFD with a valid size field.
109  // However, if you do a "setSize", then call this method, the change in
110  // size will not be reflected.
112 
113  // Return the current font as a post-script recognisable name
114  // casacore::String getPSValueNoSize();
115 
116  // Return the current fonts desired size
118 
119  // Return the current font as a XLFD, with the specific size.
120  // NB If there is any matrix transform in the pixel size field
121  // of the XLFD, this will not preserve it. To do operations
122  // e.g. rotation, extract the desired font size (getSize) and the
123  // font info (getXFontNoSize) seperately before applying required
124  // transforms
126 
127  // Return the current font as a PS recognisable name, with the specific size
128  // 'tagged onto' the end of it.
130 
131  // Return the name (as it should be presented to users) of the font.
133 
134  // Set the name of the font
135  void setName(const casacore::String& newName);
136 
137  // Set the desired size (pixelSize)
138  void setSize(const casacore::Int newSize);
139 
140  // Set the XLFD for this font (if you wish to set at matrix for any fields
141  // e.g. set the size field as a rotation matrix to rotate text, you will
142  // need to handle the size of the text independantly of this class.
143  // You can use the getXValueNoSize for that. i.e. class will not
144  // preserve rotated/scaled text via matrix transforms
145  void setXValue(const casacore::String& newX11);
146 
147  // Set the Postscript representation of this font
148  void setPSValue(const casacore::String& newPS);
149 
151  return itsNames;
152  }
153 
154  protected:
155 
156 
157  private:
158  void fillArrays();
160  casacore::Int& returnIndex);
161 
165 
168  };
169 
170 
171 } //# NAMESPACE CASA - END
172 
173 #endif
174 
175 
176 
177 
casacore::Vector< casacore::String > itsNames
Definition: DLFont.h:164
casacore::String getXValueNoSize()
Return the current font as a XLFD.
A class designed to manage several representations of the same font.
Definition: DLFont.h:70
int Int
Definition: aipstype.h:50
virtual ~DLFont()
Destructor.
void fillArrays()
FontDescription
Definition: DLFont.h:73
casacore::Int itsSize
Definition: DLFont.h:166
casacore::Int itsCurrentFont
Definition: DLFont.h:167
void setSize(const casacore::Int newSize)
Set the desired size (pixelSize)
size_t size() const
void setXValue(const casacore::String &newX11)
Set the XLFD for this font (if you wish to set at matrix for any fields e.g.
casacore::Int getSize()
Return the current font as a post-script recognisable name casacore::String getPSValueNoSize();.
casacore::String getName()
Return the name (as it should be presented to users) of the font.
casacore::String getXValue()
Return the current font as a XLFD, with the specific size.
casacore::Vector< casacore::String > itsPSFonts
Definition: DLFont.h:163
DLFont & operator=(const DLFont &other)
Copy assignment.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::Vector< casacore::String > itsXFonts
Definition: DLFont.h:162
DLFont()
(Required) default constructor.
casacore::Vector< casacore::String > getAllNames()
Definition: DLFont.h:150
void setName(const casacore::String &newName)
Set the name of the font.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
void setPSValue(const casacore::String &newPS)
Set the Postscript representation of this font.
casacore::String getPSValue()
Return the current font as a PS recognisable name, with the specific size &#39;tagged onto&#39; the end of it...
casacore::Bool lookUp(const casacore::String &desc, const DLFont::FontDescription, casacore::Int &returnIndex)