10de23d1b215f2fedf77c91f7e65d5b588351735
1 /*
2 * RasterFont.h
3 * testICU
4 *
5 */
7 #ifndef my_raster_font
8 #define my_raster_font
10 #include <map>
12 #include <libnr/nr-forward.h>
13 #include <libnrtype/nrtype-forward.h>
14 #include <libnrtype/font-style.h>
16 // one rasterfont is one way to draw a font on the screen
17 // the way it's drawn is stored in style
18 class raster_font {
19 public:
20 font_instance* daddy;
21 int refCount;
23 font_style style;
25 std::map<int,int> glyph_id_to_raster_glyph_no;
26 // an array of glyphs in this rasterfont.
27 // it's a bit redundant with the one in the daddy font_instance, but these glyphs
28 // contains the real rasterization data
29 int nbBase,maxBase;
30 raster_glyph** bases;
32 explicit raster_font(font_style const &fstyle);
33 ~raster_font(void);
35 void Unref(void);
36 void Ref(void);
38 // utility functions
39 NR::Point Advance(int glyph_id);
40 void BBox(int glyph_id,NRRect *area);
42 // attempts to load a glyph and return a raster_glyph on which you can call Blit
43 raster_glyph* GetGlyph(int glyph_id);
44 // utility
45 void LoadRasterGlyph(int glyph_id); // refreshes outline/polygon if needed
46 void RemoveRasterGlyph(raster_glyph* who);
48 private:
49 /* Disable the default copy constructor and operator=: they do the wrong thing for refCount. */
50 raster_font(raster_font const &);
51 raster_font &operator=(raster_font const &);
52 };
54 #endif
57 /*
58 Local Variables:
59 mode:c++
60 c-file-style:"stroustrup"
61 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
62 indent-tabs-mode:nil
63 fill-column:99
64 End:
65 */
66 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :