class EL_DRAWABLE_PIXEL_BUFFER_I
draw_rotated_text_top_left (x, y: INTEGER; angle: DOUBLE; a_text: READABLE_STRING_GENERAL)
require
locked_for_24_rgb_format: is_rgb_24_bit implies is_locked
local
text_rect: EL_RECTANGLE; text_pixel_buffer: EL_DRAWABLE_PIXEL_BUFFER
l_x, l_y, hyphen_width: INTEGER
do
create text_rect.make_for_text (a_text, font)
create text_pixel_buffer.make_with_size (text_rect.width, text_rect.height)
text_pixel_buffer.set_color (color.twin)
text_pixel_buffer.set_antialias_best
text_pixel_buffer.set_font (font)
text_pixel_buffer.draw_text_top_left (0, 0, a_text)
-- Make last hyphen more prominent
if a_text [a_text.count] = '-' then
l_x := font.string_width (a_text.substring (1, a_text.count - 1))
l_y := font.ascent - font.descent + 1
hyphen_width := font.string_width (once "-") - 1
text_pixel_buffer.set_line_width (1)
text_pixel_buffer.draw_line (l_x + 1, l_y, l_x + hyphen_width, l_y)
end
save
translate (x, y); rotate (angle)
draw_pixel_buffer (0, 0, text_pixel_buffer.implementation)
restore
end