gxfont.h 871 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef GXFONT_H
  2. #define GXFONT_H
  3. class gxCanvas;
  4. class gxGraphics;
  5. typedef IDirectDrawSurface7 ddSurf;
  6. class gxFont{
  7. public:
  8. gxFont(
  9. gxGraphics *graphics,gxCanvas *canvas,
  10. int width,int height,int begin_char,int end_char,int def_char,
  11. int *offs,int *widths );
  12. ~gxFont();
  13. int charWidth( int c )const;
  14. void render( gxCanvas *dest,unsigned color_argb,int x,int y,const std::string &t );
  15. private:
  16. gxGraphics *graphics;
  17. gxCanvas *canvas,*t_canvas;
  18. int width,height,begin_char,end_char,def_char;
  19. int *offs,*widths;
  20. /***** GX INTERFACE *****/
  21. public:
  22. enum{
  23. FONT_BOLD=1,
  24. FONT_ITALIC=2,
  25. FONT_UNDERLINE=4
  26. };
  27. //ACCESSORS
  28. int getWidth()const; //width of widest char
  29. int getHeight()const; //height of font
  30. int getWidth( const std::string &text )const; //width of string
  31. bool isPrintable( int chr )const; //printable char?
  32. };
  33. #endif