source: branches/port5/WINDOW/AW_font_group.cxx

Last change on this file was 5675, checked in by westram, 16 years ago
  • removed automatic timestamps (the best they were good for, were vc-conflicts)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.2 KB
Line 
1// ==================================================================== //
2//                                                                      //
3//   File      : AW_font_group.cxx                                      //
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#include "aw_font_group.hxx"
15#include <cstring>
16
17// ____________________________________________________________
18// start of implementation of class AW_font_group:
19
20AW_font_group::AW_font_group() {
21    unregisterAll();
22}
23
24void AW_font_group::unregisterAll()
25{
26    max_width   = 0;
27    max_ascent  = 0;
28    max_descent = 0;
29    max_height  = 0;
30
31    memset(&max_letter_limits[0], 0, sizeof(max_letter_limits));
32}
33
34inline void set_max(int val, int& max) { if (val>max) max = val; }
35
36void AW_font_group::registerFont(AW_device *device, int gc, const char *chars) {
37    aw_assert(gc <= AW_FONT_GROUP_MAX_GC);
38
39    if (!chars) {
40        // use complete ASCII-range for limits
41        max_letter_limits[gc] = device->get_font_information(gc, 0)->max_letter;
42    }
43    else {
44        aw_assert(chars[0]);
45        max_letter_limits[gc] = device->get_font_information(gc, chars[0])->this_letter;
46        for (int i = 1; chars[i]; ++i) {
47            max_letter_limits[gc] = AW_font_limits(max_letter_limits[gc],
48                                                   device->get_font_information(gc, chars[i])->this_letter);
49        }
50    }
51
52    set_max(get_width(gc), max_width);
53    set_max(get_ascent(gc), max_ascent);
54    set_max(get_descent(gc), max_descent);
55    set_max(get_height(gc), max_height);
56}
57
58
59// -end- of implementation of class AW_font_group.
60
61
62
63
Note: See TracBrowser for help on using the repository browser.