/** * \brief Draws a new glyph on this sheet. * \param c The character to draw. * \param face The font face from which we take the glyph. */ void bear::visual::true_type_font::glyph_sheet::draw_character ( charset::char_type c, const freetype_face& face ) { CLAW_PRECOND( can_draw( c, face ) ); const size_box_type glyph_size( face.get_glyph_size(c) ); if ( m_next_position.x + glyph_size.x + 2 * s_margin.x >= m_image.width() ) { m_next_position.x = 0; m_next_position.y += m_current_line_height; m_current_line_height = 0; } m_image.draw( face.get_glyph( c ), m_next_position + s_margin ); character_placement placement; placement.clip = clip_rectangle( m_next_position, glyph_size + 2 * s_margin ); placement.metrics = face.get_glyph_metrics( c ); placement.metrics = glyph_metrics ( placement.metrics.get_advance() - s_margin, placement.metrics.get_bearing() - s_margin ); m_placement[ c ] = placement; m_next_position.x += glyph_size.x + 2 * s_margin.x; m_current_line_height = std::max ( m_current_line_height, (unsigned int)( glyph_size.y + 2 * s_margin.y ) ); } // true_type_font::glyph_sheet::draw_character()
void sng_current_draw_rectangle(int filled, float x, float y, float width, float height) { if (!clip_rectangle(&x, &y, &width, &height)) return; graph_dev_draw_rectangle(filled, x * sgc.xscale, y * sgc.yscale, width * sgc.xscale, height * sgc.yscale); }