Permalink
Browse files

added alignment support, constants and docs

  • Loading branch information...
1 parent 0524a74 commit 6f709d81a0d6361cc8ab92a3d972b2a235dd05ae Tobias Leich committed Mar 29, 2010
Showing with 59 additions and 5 deletions.
  1. +11 −0 lib/SDL/Constants.pm
  2. +2 −1 lib/SDL/Pango.pm
  3. +2 −1 lib/SDL/Pango/Context.pm
  4. +40 −1 lib/pods/SDL/Pango.pod
  5. +3 −2 src/Pango/Pango.xs
  6. +1 −0 typemap
View
@@ -447,6 +447,11 @@ our %EXPORT_TAGS = (
SDLPANGO_DIRECTION_WEAK_RTL
SDLPANGO_DIRECTION_NEUTRAL
)],
+ 'SDL::Pango/align' => [qw(
+ SDLPANGO_ALIGN_LEFT
+ SDLPANGO_ALIGN_CENTER
+ SDLPANGO_ALIGN_RIGHT
+ )],
'SDL::RWOps/defaults' => [qw(
RW_SEEK_SET
RW_SEEK_CUR
@@ -1022,6 +1027,12 @@ use constant{
}; # SDL::Pango/direction
use constant{
+ SDLPANGO_ALIGN_LEFT => 0,
+ SDLPANGO_ALIGN_CENTER => 1,
+ SDLPANGO_ALIGN_RIGHT => 2
+}; # SDL::Pango/align
+
+use constant{
RW_SEEK_SET => 0,
RW_SEEK_CUR => 1,
RW_SEEK_END => 2,
View
@@ -16,7 +16,8 @@ use base 'Exporter';
our @EXPORT = @{ $SDL::Constants::EXPORT_TAGS{'SDL::Pango'} };
our %EXPORT_TAGS = (
all => \@EXPORT,
- direction => $SDL::Constants::EXPORT_TAGS{'SDL::Pango/direction'}
+ direction => $SDL::Constants::EXPORT_TAGS{'SDL::Pango/direction'},
+ align => $SDL::Constants::EXPORT_TAGS{'SDL::Pango/align'}
);
1;
View
@@ -16,7 +16,8 @@ use base 'Exporter';
our @EXPORT = @{ $SDL::Constants::EXPORT_TAGS{'SDL::Pango'} };
our %EXPORT_TAGS = (
all => \@EXPORT,
- direction => $SDL::Constants::EXPORT_TAGS{'SDL::Pango/direction'}
+ direction => $SDL::Constants::EXPORT_TAGS{'SDL::Pango/direction'},
+ align => $SDL::Constants::EXPORT_TAGS{'SDL::Pango/align'}
);
1;
View
@@ -48,7 +48,27 @@ and access them directly:
SDL::Pango::SDLPANGO_DIRECTION_NEUTRAL;
-Available constants:
+or by choosing the export tags below:
+
+Export tag: ':align'
+
+=over 4
+
+=item SDLPANGO_ALIGN_LEFT
+
+Left alignment
+
+=item SDLPANGO_ALIGN_CENTER
+
+Centered
+
+=item SDLPANGO_ALIGN_RIGHT
+
+Right alignment
+
+=back
+
+Export tag: ':direction'
=over 4
@@ -113,9 +133,28 @@ Sets the minimum size of the drawing rectangle.
=head2 set_text
SDL::Pango::set_text($context, $text, $length);
+ SDL::Pango::set_text($context, $text, $length, $alignment);
Set plain text to context. Text must be utf-8. C<$length> chars will be rendered, pass C<-1> to render the whole text.
+C<$alignment> can be:
+
+=over 4
+
+=item *
+
+SDLPANGO_ALIGN_LEFT (default)
+
+=item *
+
+SDLPANGO_ALIGN_CENTER
+
+=item *
+
+SDLPANGO_ALIGN_RIGHT
+
+=back
+
=head2 set_markup
SDL::Pango::set_markup($context, $text, $length);
View
@@ -147,12 +147,13 @@ pango_set_dpi(context, dpi_x, dpi_y)
SDLPango_SetDpi(context, dpi_x, dpi_y);
void
-pango_set_text(context, markup, length)
+pango_set_text(context, markup, length, alignment = SDLPANGO_ALIGN_LEFT)
SDLPango_Context *context
const char *markup
int length
+ SDLPango_Alignment alignment
CODE:
- SDLPango_SetText(context, markup, length);
+ SDLPango_SetText_GivenAlignment(context, markup, length, alignment);
void
pango_set_language(context, language_tag)
View
@@ -54,6 +54,7 @@ Mix_Chunk * O_OBJECT
Mix_Music * O_OBJECT
SDL_GLattr T_IV
SDLPango_Context * O_OBJECT
+SDLPango_Alignment T_UV
int * T_PTR
int ** T_PTR
void * T_PTR

0 comments on commit 6f709d8

Please sign in to comment.