source: golgotha/src/i4/font/anti_prop.hh @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 14 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 1.9 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#ifndef ANTI_ALIASED_HH
10#define ANTI_ALIASED_HH
11
12
13#include "font/font.hh"
14class i4_image_class;
15class i4_anti_image_class;
16
17class i4_anti_proportional_font_class : public i4_font_class
18{
19  w16 offsets[256];
20  w16 widths[256];
21  i4_anti_image_class *aim;
22  int longest_w, h;
23  public :
24
25  i4_anti_proportional_font_class(i4_image_class *im, int start_ch=33);
26  virtual void set_color(i4_color color);
27
28  virtual void put_string(i4_image_class *screen,
29                          sw16 x, sw16 y,
30                          const i4_const_str &string,
31                          i4_draw_context_class &context);
32
33  virtual void put_character(i4_image_class *screen,
34                             sw16 x, sw16 y,
35                             const i4_char &c,
36                             i4_draw_context_class &context);
37
38  virtual w16 width(const i4_char &character) { return widths[character.ascii_value()]; }
39  virtual w16 height(const i4_char &character) { return h; }
40
41  virtual w16 width(const i4_const_str &string)
42  {
43    int w=0;
44    for (i4_const_str::iterator i=string.begin(); i!=string.end(); ++i)
45      w+=width(i.get());
46    return w;
47  }
48
49  virtual w16 height(const i4_const_str &string) { return h; }
50
51  virtual w16 largest_height() { return h; }
52  virtual w16 largest_width() { return longest_w; }
53
54  virtual ~i4_anti_proportional_font_class();
55};
56
57
58#endif
59
60
Note: See TracBrowser for help on using the repository browser.