16 #ifndef AGG_GLYPH_RASTER_BIN_INCLUDED 17 #define AGG_GLYPH_RASTER_BIN_INCLUDED 20 #include "agg_basics.h" 29 typedef ColorT color_type;
44 if(*(
char*)&t == 0) m_big_endian =
true;
45 std::memset(m_span, 0,
sizeof(m_span));
49 const int8u* font()
const {
return m_font; }
50 void font(
const int8u* f) { m_font = f; }
53 double height()
const {
return m_font[0]; }
54 double base_line()
const {
return m_font[1]; }
58 double width(
const CharT* str)
const 60 unsigned start_char = m_font[2];
61 unsigned num_chars = m_font[3];
66 unsigned glyph = *str;
67 const int8u* bits = m_font + 4 + num_chars * 2 +
68 value(m_font + 4 + (glyph - start_char) * 2);
76 void prepare(
glyph_rect* r,
double x,
double y,
unsigned glyph,
bool flip)
78 unsigned start_char = m_font[2];
79 unsigned num_chars = m_font[3];
81 m_bits = m_font + 4 + num_chars * 2 +
82 value(m_font + 4 + (glyph - start_char) * 2);
84 m_glyph_width = *m_bits++;
85 m_glyph_byte_width = (m_glyph_width + 7) >> 3;
88 r->x2 = r->x1 + m_glyph_width - 1;
91 r->y1 = int(y) - m_font[0] + m_font[1];
92 r->y2 = r->y1 + m_font[0] - 1;
96 r->y1 = int(y) - m_font[1] + 1;
97 r->y2 = r->y1 + m_font[0] - 1;
99 r->dx = m_glyph_width;
104 const cover_type* span(
unsigned i)
106 i = m_font[0] - i - 1;
107 const int8u* bits = m_bits + i * m_glyph_byte_width;
109 unsigned val = *bits;
111 for(j = 0; j < m_glyph_width; ++j)
113 m_span[j] = (cover_type)((val & 0x80) ? cover_full : cover_none);
126 int16u value(
const int8u* p)
const 132 *((int8u*)&v + 1) = p[0];
137 *((int8u*)&v + 1) = p[1];
146 cover_type m_span[32];
148 unsigned m_glyph_width;
149 unsigned m_glyph_byte_width;