ARB
aw_font_group.hxx
Go to the documentation of this file.
1 // ==================================================================== //
2 // //
3 // File : aw_font_group.hxx //
4 // Purpose : Bundles a group of fonts and provides overall maximas //
5 // //
6 // //
7 // Coded by Ralf Westram (coder@reallysoft.de) in December 2004 //
8 // Copyright Department of Microbiology (Technical University Munich) //
9 // //
10 // Visit our web site at: http://www.arb-home.de/ //
11 // //
12 // ==================================================================== //
13 
14 #ifndef AW_FONT_GROUP_HXX
15 #define AW_FONT_GROUP_HXX
16 
17 #ifndef AW_DEVICE_HXX
18 #include <aw_device.hxx>
19 #endif
20 
21 #define AW_FONT_GROUP_MAX_GC 10
22 
23 class AW_font_group { // IRRELEVANT_LOOP
25  AW_font_limits any_limits; // maxima of all registered fonts
26 
27 #if defined(ASSERTION_USED)
28  bool font_registered(int gc) const { return gc_limits[gc].was_notified(); }
29  bool any_font_registered() const { return any_limits.was_notified(); }
30 #endif
31 
32 public:
33  void unregisterAll() { *this = AW_font_group(); }
34  void registerFont(AW_device *device_, int gc, const char *chars = NULp); // if no 'chars' specified => use complete ASCII-range
35 
36  const AW_font_limits& get_limits(int gc) const {
37  aw_assert(font_registered(gc));
38  return gc_limits[gc];
39  }
40  const AW_font_limits& get_max_limits() const {
41  aw_assert(any_font_registered());
42  return any_limits;
43  }
44 
45  int get_width (int gc) const { return get_limits(gc).width; }
46  int get_ascent (int gc) const { return get_limits(gc).ascent; }
47  int get_descent(int gc) const { return get_limits(gc).descent; }
48  int get_height (int gc) const { return get_limits(gc).get_height(); }
49 
50  // maxima of all registered fonts:
51  int get_max_width () const { return get_max_limits().width; }
52  int get_max_ascent () const { return get_max_limits().ascent; }
53  int get_max_descent() const { return get_max_limits().descent; }
54  int get_max_height () const { return get_max_limits().get_height(); }
55 };
56 
57 
58 #else
59 #error aw_font_group.hxx included twice
60 #endif // AW_FONT_GROUP_HXX
61 
short get_height() const
#define AW_FONT_GROUP_MAX_GC
bool was_notified() const
int get_height(int gc) const
void unregisterAll()
int get_width(int gc) const
const AW_font_limits & get_limits(int gc) const
int get_descent(int gc) const
int chars
Definition: seq_search.cxx:38
const AW_font_limits & get_max_limits() const
#define aw_assert(bed)
Definition: aw_position.hxx:29
int get_max_ascent() const
int get_max_width() const
int get_ascent(int gc) const
int get_max_descent() const
void registerFont(AW_device *device_, int gc, const char *chars=NULp)
#define NULp
Definition: cxxforward.h:97
int get_max_height() const