From: Colin A. <col...@go...> - 2008-04-15 17:43:07
|
I have just implemented the following routine: draw_text (x, y: INTEGER; a_text: STRING_GENERAL) is -- Draw `a_text' with left of baseline at (`x', `y') using `font'. local l_element: XM_ELEMENT l_attribute: XM_ATTRIBUTE l_text: XM_CHARACTER_DATA l_bytes: STRING l_utf8: UC_UTF8_STRING do create l_element.make_last (document.root_element, Svg_text, Svg_namespace) create l_element.make_last (Svg_x_attribute, Svg_namespace, x.out, l_element) create l_element.make_last (Svg_y_attribute, Svg_namespace, (-y).out, l_element) add_font_attributes (l_element) if a_text.is_string_8 then create l_text.make_last (l_element, a_text.as_string_8) else create l_bytes.make (a_text.count * 4) from i := 1 until i > a_text.count loop utf8.append_code_to_utf8 (l_bytes, a_text.item_code (i)) i := i + 1 end create l_utf8.make_from_utf8 (l_bytes) create l_text.make_last (l_element, l_utf8) end end We need a make_from_utf32 (or some such routine) in UC_STRING (or alternatively let XM_CHARACTER_DATA accept a STRING_GENEAL, or prefereably both). |