def _set_sample_layout(layout, text, family, fontsize): text = text.encode('utf-8') _libpango.set_layout_width(layout, -1) fnt_descr = family + ', ' + str(fontsize) fnt_descr = _libpango.create_font_description(fnt_descr) _libpango.set_layout_font_description(layout, fnt_descr) markup = cgi.escape(text) _libpango.set_layout_markup(layout, markup)
def _set_layout(layout, text, width, text_style, attributes): text = text.encode('utf-8') _libpango.set_layout_width(layout, width) fnt_descr = _get_font_description(text_style) _libpango.set_layout_font_description(layout, fnt_descr) _libpango.set_layout_alignment(layout, text_style[3]) markup = cgi.escape(text) _libpango.set_layout_markup(layout, markup)
def set_layout(text, width, text_style, markup, layout=PANGO_LAYOUT): if not width == -1: width *= PANGO_UNITS _libpango.set_layout_width(layout, width) fnt_descr = get_font_description(text_style) _libpango.set_layout_font_description(layout, fnt_descr) _libpango.set_layout_alignment(layout, text_style[3]) markuped_text = apply_markup(text, markup) _libpango.set_layout_markup(layout, markuped_text)
def _set_sample_layout(layout, text, family, fontsize): text = text.encode("utf-8") _libpango.set_layout_width(layout, -1) fnt_descr = family + ", " + str(fontsize) fnt_descr = _libpango.create_font_description(fnt_descr) _libpango.set_layout_font_description(layout, fnt_descr) markup = cgi.escape(text) _libpango.set_layout_markup(layout, markup)
def set_glyph_layout(text, width, text_style, markup, text_range=[], check_nt=False, layout=PANGO_LAYOUT): if not width == -1: width *= PANGO_UNITS _libpango.set_layout_width(layout, width) fnt_descr = get_font_description(text_style, check_nt) _libpango.set_layout_font_description(layout, fnt_descr) _libpango.set_layout_alignment(layout, text_style[3]) markuped_text, vpos = apply_glyph_markup(text, text_range, markup, check_nt) _libpango.set_layout_markup(layout, markuped_text) return vpos