3 <h3 id="TOP">Index</h3>
5 <ul><li><a href="#NAME">NAME</a></li>
6 <li><a href="#CATEGORY">CATEGORY</a></li>
7 <li><a href="#SYNOPSIS">SYNOPSIS</a></li>
8 <li><a href="#CONSTANTS">CONSTANTS</a></li>
9 <li><a href="#METHODS">METHODS</a>
10 <ul><li><a href="#init">init</a></li>
11 <li><a href="#was_init">was_init</a></li>
12 <li><a href="#set_default_color">set_default_color</a></li>
13 <li><a href="#set_minimum_size">set_minimum_size</a></li>
14 <li><a href="#set_text">set_text</a></li>
15 <li><a href="#set_markup">set_markup</a></li>
16 <li><a href="#get_layout_width">get_layout_width</a></li>
17 <li><a href="#get_layout_height">get_layout_height</a></li>
18 <li><a href="#set_base_direction">set_base_direction</a></li>
19 <li><a href="#set_dpi">set_dpi</a></li>
20 <li><a href="#set_language">set_language</a></li>
21 <li><a href="#draw">draw</a></li>
22 <li><a href="#set_surface_create_args">set_surface_create_args</a></li>
23 <li><a href="#create_surface_draw">create_surface_draw</a></li>
26 <li><a href="#AUTHORS">AUTHORS</a></li>
27 <li><a href="#SEE_ALSO">SEE ALSO</a>
32 <h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p>
33 <div id="NAME_CONTENT">
34 <p>SDL::Pango - Text rendering engine</p>
37 <h1 id="CATEGORY">CATEGORY</h1><p><a href="#TOP" class="toplink">Top</a></p>
38 <div id="CATEGORY_CONTENT">
42 <h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p>
43 <div id="SYNOPSIS_CONTENT">
52 use SDL::Pango::Context;
56 my $context = SDL::Pango::Context->new;
57 SDL::Pango::set_default_color($context, 0xA7C344FF, 0);
58 SDL::Pango::set_markup($context, 'Hallo <b>W<span foreground="red">o</span><i>r</i><u>l</u>d</b>!', -1);
60 SDL::init(SDL_INIT_VIDEO);
62 my $display = SDL::Video::set_video_mode(640, 480, 32, SDL_SWSURFACE);
63 my $bg = SDL::Video::map_RGB($display->format, 0x12, 0x22, 0x45);
64 SDL::Video::fill_rect($display, SDL::Rect->new(0, 0, 640, 480), $bg);
66 my $surface = SDL::Pango::create_surface_draw($context);
67 SDL::Video::blit_surface($surface, SDL::Rect->new(0, 0, 640, 480), $display, SDL::Rect->new(0, 0, 640, 480));
69 SDL::Video::update_rect($display, 0, 0, 0, 0);
75 <h1 id="CONSTANTS">CONSTANTS</h1><p><a href="#TOP" class="toplink">Top</a></p>
76 <div id="CONSTANTS_CONTENT">
77 <p>The constants are exported by default. You can avoid this by doing:</p>
78 <pre> use SDL::Pango ();
81 <p>and access them directly:</p>
82 <pre> SDL::Pango::SDLPANGO_DIRECTION_NEUTRAL;
85 <p>or by choosing the export tags below:</p>
86 <p>Export tag: ':align'</p>
88 <dt>SDLPANGO_ALIGN_LEFT</dt>
92 <dt>SDLPANGO_ALIGN_CENTER</dt>
96 <dt>SDLPANGO_ALIGN_RIGHT</dt>
98 <p>Right alignment</p>
101 <p>Export tag: ':direction'</p>
103 <dt>SDLPANGO_DIRECTION_LTR</dt>
107 <dt>SDLPANGO_DIRECTION_RTL</dt>
111 <dt>SDLPANGO_DIRECTION_WEAK_LTR</dt>
113 <p>Left to right (weak)</p>
115 <dt>SDLPANGO_DIRECTION_WEAK_RTL</dt>
117 <p>Right to left (weak)</p>
119 <dt>SDLPANGO_DIRECTION_NEUTRAL</dt>
126 <h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
127 <div id="METHODS_CONTENT">
130 <h2 id="init">init</h2>
131 <div id="init_CONTENT">
132 <pre> SDL::Pango::init();
135 <p>Initialize the Glib and Pango API. This must be called before using other functions in this library, excepting <a href="/SDL-Pango.html#was_init">SDL::Pango::was_init</a>.
136 SDL does not have to be initialized before this call.</p>
137 <p>Returns: always <code>0</code>. </p>
140 <h2 id="was_init">was_init</h2>
141 <div id="was_init_CONTENT">
142 <pre> my $was_init = SDL::Pango::was_init();
145 <p>Query the initilization status of the Glib and Pango API. You may, of course, use this before <a href="/SDL-Pango.html#init">SDL::Pango::init</a> to avoid initilizing twice
147 <p>Returns: Non-zero when already initialized. Zero when not initialized.</p>
150 <h2 id="set_default_color">set_default_color</h2>
151 <div id="set_default_color_CONTENT">
152 <pre> SDL::Pango::set_default_color($context, $foreground, $background);
153 SDL::Pango::set_default_color($context, $r1, $g1, $b1, $a1, $r2, $g2, $b2, $a2);
156 <p>Sets default foreground and background color when rendering text and markup.</p>
157 <p>You can call it with either 2 color-parameters (32-bit RRGGBBAA values), or with 4 separate values for foreground and 4 separate values for
161 <h2 id="set_minimum_size">set_minimum_size</h2>
162 <div id="set_minimum_size_CONTENT">
163 <pre> SDL::Pango::set_minimum_size($context, $width, $height);
166 <p>Sets the minimum size of the drawing rectangle.</p>
169 <h2 id="set_text">set_text</h2>
170 <div id="set_text_CONTENT">
171 <pre> SDL::Pango::set_text($context, $text, $length);
172 SDL::Pango::set_text($context, $text, $length, $alignment);
175 <p>Set plain text to context. Text must be utf-8. <code>$length</code> chars will be rendered, pass <code>-1</code> to render the whole text.</p>
176 <p><code>$alignment</code> can be:</p>
178 <li>SDLPANGO_ALIGN_LEFT (default) </li>
179 <li>SDLPANGO_ALIGN_CENTER </li>
180 <li>SDLPANGO_ALIGN_RIGHT</li>
185 <h2 id="set_markup">set_markup</h2>
186 <div id="set_markup_CONTENT">
187 <pre> SDL::Pango::set_markup($context, $text, $length);
190 <p>Set markup text to context. Text must be utf-8. <code>$length</code> chars will be rendered, pass <code>-1</code> to render the whole text.</p>
191 <p>See <a href="http://library.gnome.org/devel/pango/unstable/PangoMarkupFormat.html">PangoMarkupFormat</a> for a description about the markup format.</p>
194 <h2 id="get_layout_width">get_layout_width</h2>
195 <div id="get_layout_width_CONTENT">
196 <pre> my $w = SDL::Pango::get_layout_width($context);
199 <p>Returns the width of the resulting surface of the given text/markup for this context.</p>
202 <h2 id="get_layout_height">get_layout_height</h2>
203 <div id="get_layout_height_CONTENT">
204 <pre> my $h = SDL::Pango::get_layout_height($context);
207 <p>Returns the height of the resulting surface of the given text/markup for this context.</p>
210 <h2 id="set_base_direction">set_base_direction</h2>
211 <div id="set_base_direction_CONTENT">
212 <pre> SDL::Pango::set_base_direction($context, $direction);
215 <p>Sets the direction of the text to either left-to-right or right-to-left.</p>
216 <p>See <a href="http://search.cpan.org/perldoc?">http://search.cpan.org/perldoc?</a>.</p>
219 <h2 id="set_dpi">set_dpi</h2>
220 <div id="set_dpi_CONTENT">
221 <pre> SDL::Pango::set_dpi($context, $dpi_x, $dpi_y);
224 <p>Sets the DPI (dots per inch) for this context. Default is <code>96</code>.</p>
227 <h2 id="set_language">set_language</h2>
228 <div id="set_language_CONTENT">
229 <pre> SDL::Pango::set_language($context, $language);
232 <p>Sets the language name for this context.</p>
233 <p>See <a href="http://www.loc.gov/standards/iso639-2/php/code_list.php">ISO639-2</a>.</p>
235 <pre> SDL::Pango::set_language($context, "en");
240 <h2 id="draw">draw</h2>
241 <div id="draw_CONTENT">
242 <pre> SDL::Pango::draw($context, $display, $x, $y);
245 <p>Draws the text or markup to an existing surface at position <code>$x</code>/<code>$y</code>.</p>
248 <h2 id="set_surface_create_args">set_surface_create_args</h2>
249 <div id="set_surface_create_args_CONTENT">
250 <pre> SDL::Pango::set_surface_create_args($context, $flags, $bits, $r_mask, $g_mask, $b_mask, $a_mask);
253 <p>Sets the argumet that are used when creating a surface via <a href="/SDL-Pango.html#create_surface_draw">SDL::Pango::create_surface_draw</a>.</p>
255 <pre> SDL::Pango::set_surface_create_args(
268 <h2 id="create_surface_draw">create_surface_draw</h2>
269 <div id="create_surface_draw_CONTENT">
270 <pre> my $surface = SDL::Pango::create_surface_draw($context);
273 <p>Creates a new surface and draws the text/markup. You can specify the attributes of the surfaces using <a href="/SDL-Pango.html#set_surface_create_args">SDL::Pango::set_surface_create_args</a>.</p>
276 <h1 id="AUTHORS">AUTHORS</h1><p><a href="#TOP" class="toplink">Top</a></p>
277 <div id="AUTHORS_CONTENT">
278 <p>See <a href="/SDL.html#AUTHORS">/SDL.html#AUTHORS</a>.</p>
281 <h1 id="SEE_ALSO">SEE ALSO</h1><p><a href="#TOP" class="toplink">Top</a></p>
282 <div id="SEE_ALSO_CONTENT">
283 <p><a href="SDL-Pango-Context.html">SDL::Pango::Context</a>, <a href="SDL-Video.html">SDL::Video</a>, <a href="SDL-Surface.html">SDL::Surface</a>, <a href="SDL-TTF.html">SDL::TTF</a></p>