-
- void draw_text(const std::string& text, const Vector& pos,
- uint32_t drawing_effect = NONE_EFFECT, uint8_t alpha = 255) const;
-
- void draw_chars(Surface* pchars, const std::string& text,
- const Vector& position, uint32_t drawing_effect, uint8_t alpha) const;
-
- Surface* chars;
- Surface* shadow_chars;
- FontType type;
- int w;
- int h;
+
+ void draw_text(Renderer *renderer, const std::string& text, const Vector& pos,
+ DrawingEffect drawing_effect = NO_EFFECT,
+ Color color = Color(1.0,1.0,1.0),
+ float alpha = 1.0f) const;
+
+ void draw_chars(Renderer *renderer, bool nonshadow, const std::string& text,
+ const Vector& position, DrawingEffect drawing_effect, Color color,
+ float alpha) const;
+
+ void loadFontFile(const std::string &filename);
+ void loadFontSurface(const std::string &glyphimage,
+ const std::string &shadowimage,
+ const std::vector<std::string> &chars,
+ GlyphWidth glyph_width,
+ int char_width);
+private:
+ struct Glyph {
+ /** How many pixels should the cursor advance after printing the
+ glyph */
+ float advance;
+
+ /** Offset that is used when drawing the glyph */
+ Vector offset;
+
+ /** index of containing surface */
+ int surface_idx;
+
+ /** Position of the glyph inside the surface */
+ Rect rect;
+
+ Glyph() :
+ advance(),
+ offset(),
+ surface_idx(),
+ rect()
+ {}
+ };
+
+private:
+ GlyphWidth glyph_width;
+
+ std::vector<Surface> glyph_surfaces;
+ std::vector<Surface> shadow_surfaces;
+ int char_height;