| 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 { |
|---|
| 24 | AW_font_limits max_letter_limits[AW_FONT_GROUP_MAX_GC+1]; |
|---|
| 25 | |
|---|
| 26 | int max_width; // maximas of all registered fonts |
|---|
| 27 | int max_ascent; |
|---|
| 28 | int max_descent; |
|---|
| 29 | int max_height; |
|---|
| 30 | |
|---|
| 31 | public: |
|---|
| 32 | AW_font_group(); |
|---|
| 33 | |
|---|
| 34 | void unregisterAll(); |
|---|
| 35 | void registerFont(AW_device *device_, int gc, const char *chars = 0); // if no 'chars' specified => use complete ASCII-range |
|---|
| 36 | |
|---|
| 37 | int get_width (int gc) const { return max_letter_limits[gc].width; } |
|---|
| 38 | int get_ascent (int gc) const { return max_letter_limits[gc].ascent; } |
|---|
| 39 | int get_descent(int gc) const { return max_letter_limits[gc].descent; } |
|---|
| 40 | int get_height (int gc) const { return max_letter_limits[gc].height; } |
|---|
| 41 | |
|---|
| 42 | // maximas of all registered fonts: |
|---|
| 43 | int get_max_width () const { return max_width; } |
|---|
| 44 | int get_max_ascent () const { return max_ascent; } |
|---|
| 45 | int get_max_descent() const { return max_descent; } |
|---|
| 46 | int get_max_height () const { return max_height; } |
|---|
| 47 | }; |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | #else |
|---|
| 51 | #error aw_font_group.hxx included twice |
|---|
| 52 | #endif // AW_FONT_GROUP_HXX |
|---|
| 53 | |
|---|