Chemical Data Processing Library C++ API - Version 1.1.1
FontMetrics.hpp
Go to the documentation of this file.
1 /*
2  * FontMetrics.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_VIS_FONTMETRICS_HPP
30 #define CDPL_VIS_FONTMETRICS_HPP
31 
32 #include <string>
33 
34 #include "CDPL/Vis/APIPrefix.hpp"
35 
36 
37 namespace CDPL
38 {
39 
40  namespace Vis
41  {
42 
43  class Font;
44  class Rectangle2D;
45 
71  {
72 
73  public:
77  virtual ~FontMetrics() {}
78 
83  virtual void setFont(const Font& font) = 0;
84 
96  virtual double getAscent() const = 0;
97 
108  virtual double getDescent() const = 0;
109 
118  virtual double getHeight() const = 0;
119 
128  virtual double getLeading() const = 0;
129 
139  virtual double getWidth(const std::string& str) const = 0;
140 
149  virtual double getWidth(char ch) const = 0;
150 
163  virtual void getBounds(const std::string& str, Rectangle2D& bounds) const = 0;
164 
175  virtual void getBounds(char ch, Rectangle2D& bounds) const = 0;
176  };
177  } // namespace Vis
178 } // namespace CDPL
179 
180 #endif // CDPL_VIS_FONTMETRICS_HPP
CDPL::Vis::FontMetrics::getWidth
virtual double getWidth(const std::string &str) const =0
Returns the total advance width for the characters in the string str.
CDPL::Vis::Font
Specifies a font for drawing text.
Definition: Font.hpp:54
CDPL::Vis::FontMetrics::getBounds
virtual void getBounds(char ch, Rectangle2D &bounds) const =0
Returns the bounding rectangle of the character ch relative to the left-most point on the baseline.
CDPL::Vis::FontMetrics::getHeight
virtual double getHeight() const =0
Returns the height of the font.
CDPL::Vis::FontMetrics::getBounds
virtual void getBounds(const std::string &str, Rectangle2D &bounds) const =0
Returns the total bounding rectangle for the characters in the string str.
CDPL_VIS_API
#define CDPL_VIS_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
CDPL::Vis::FontMetrics::getDescent
virtual double getDescent() const =0
Returns the descent of the font.
CDPL::Vis::FontMetrics::~FontMetrics
virtual ~FontMetrics()
Virtual destructor.
Definition: FontMetrics.hpp:77
CDPL::Vis::FontMetrics::getAscent
virtual double getAscent() const =0
Returns the ascent of the font.
CDPL::Vis::FontMetrics::getLeading
virtual double getLeading() const =0
Returns the leading of the font.
CDPL::Vis::FontMetrics::setFont
virtual void setFont(const Font &font)=0
Specifies the font for which to obtain the metrics.
CDPL
The namespace of the Chemical Data Processing Library.
CDPL::Vis::Rectangle2D
Specifies an axis aligned rectangular area in 2D space.
Definition: Rectangle2D.hpp:51
CDPL::Vis::FontMetrics
An interface class with methods that provide information about the metrics of a font.
Definition: FontMetrics.hpp:71
CDPL::Vis::FontMetrics::getWidth
virtual double getWidth(char ch) const =0
Returns the advance width for the character ch.
APIPrefix.hpp
Definition of the preprocessor macro CDPL_VIS_API.