libraries/SDL_Pango: Initial import

This commit is contained in:
Erik Hanson 2010-05-11 14:56:11 +02:00
parent 506fa67bb9
commit c0b7b653ee
5 changed files with 192 additions and 0 deletions

View file

@ -0,0 +1,2 @@
SDL_Pango - Pango bindings for SDL
Pango is a text rendering engine. SDL_Pango connects the engine to SDL.

View file

@ -0,0 +1,116 @@
--- src/SDL_Pango.c 2004-12-10 10:06:33.000000000 +0100
+++ src/SDL_Pango.c 2006-09-24 22:46:24.000000000 +0200
@@ -723,13 +723,8 @@
SDL_UnlockSurface(surface);
}
-/*!
- Create a context which contains Pango objects.
-
- @return A pointer to the context as a SDLPango_Context*.
-*/
SDLPango_Context*
-SDLPango_CreateContext()
+SDLPango_CreateContext_GivenFontDesc(const char* font_desc)
{
SDLPango_Context *context = g_malloc(sizeof(SDLPango_Context));
G_CONST_RETURN char *charset;
@@ -743,8 +738,7 @@
pango_context_set_language (context->context, pango_language_from_string (charset));
pango_context_set_base_dir (context->context, PANGO_DIRECTION_LTR);
- context->font_desc = pango_font_description_from_string(
- MAKE_FONT_NAME (DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE));
+ context->font_desc = pango_font_description_from_string(font_desc);
context->layout = pango_layout_new (context->context);
@@ -762,6 +756,17 @@
}
/*!
+ Create a context which contains Pango objects.
+
+ @return A pointer to the context as a SDLPango_Context*.
+*/
+SDLPango_Context*
+SDLPango_CreateContext()
+{
+ SDLPango_CreateContext_GivenFontDesc(MAKE_FONT_NAME(DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE));
+}
+
+/*!
Free a context.
@param *context [i/o] Context to be free
@@ -1053,6 +1058,20 @@
pango_layout_set_font_description (context->layout, context->font_desc);
}
+void
+SDLPango_SetText_GivenAlignment(
+ SDLPango_Context *context,
+ const char *text,
+ int length,
+ SDLPango_Alignment alignment)
+{
+ pango_layout_set_attributes(context->layout, NULL);
+ pango_layout_set_text (context->layout, text, length);
+ pango_layout_set_auto_dir (context->layout, TRUE);
+ pango_layout_set_alignment (context->layout, alignment);
+ pango_layout_set_font_description (context->layout, context->font_desc);
+}
+
/*!
Set plain text to context.
Text must be utf-8.
@@ -1067,11 +1086,7 @@
const char *text,
int length)
{
- pango_layout_set_attributes(context->layout, NULL);
- pango_layout_set_text (context->layout, text, length);
- pango_layout_set_auto_dir (context->layout, TRUE);
- pango_layout_set_alignment (context->layout, PANGO_ALIGN_LEFT);
- pango_layout_set_font_description (context->layout, context->font_desc);
+ SDLPango_SetText_GivenAlignment(context, text, length, SDLPANGO_ALIGN_LEFT);
}
/*!
--- src/SDL_Pango.h 2004-12-10 10:06:33.000000000 +0100
+++ src/SDL_Pango.h 2006-09-24 22:46:01.000000000 +0200
@@ -109,12 +109,20 @@
SDLPANGO_DIRECTION_NEUTRAL /*! Neutral */
} SDLPango_Direction;
-
+/*!
+ Specifies alignment of text. See Pango reference for detail
+*/
+typedef enum {
+ SDLPANGO_ALIGN_LEFT,
+ SDLPANGO_ALIGN_CENTER,
+ SDLPANGO_ALIGN_RIGHT
+} SDLPango_Alignment;
extern DECLSPEC int SDLCALL SDLPango_Init();
extern DECLSPEC int SDLCALL SDLPango_WasInit();
+extern DECLSPEC SDLPango_Context* SDLCALL SDLPango_CreateContext_GivenFontDesc(const char* font_desc);
extern DECLSPEC SDLPango_Context* SDLCALL SDLPango_CreateContext();
extern DECLSPEC void SDLCALL SDLPango_FreeContext(
@@ -157,6 +165,12 @@
const char *markup,
int length);
+extern DECLSPEC void SDLCALL SDLPango_SetText_GivenAlignment(
+ SDLPango_Context *context,
+ const char *text,
+ int length,
+ SDLPango_Alignment alignment);
+
extern DECLSPEC void SDLCALL SDLPango_SetText(
SDLPango_Context *context,
const char *markup,

View file

@ -0,0 +1,58 @@
#!/bin/sh
# Slackware build script for SDL_Pango
# Written by Erik Hanson erik@slackbuilds.org
# Modified by the SlackBuilds.org project
PRGNAM=SDL_Pango
VERSION=0.1.2
ARCH=${ARCH:-i486}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
CWD=`pwd`
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
fi
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xzvf $CWD/$PRGNAM-$VERSION.tar.gz || exit 1
cd $PRGNAM-$VERSION
chown -R root:root .
chmod -R u+w,go+r-w,a-s .
patch -p0 < $CWD/SDL_Pango-0.1.2-API-adds.patch || exit 1
CFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
|| exit 1
make || exit 1
make install DESTDIR=$PKG || exit 1
( cd $PKG
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a AUTHORS COPYING ChangeLog NEWS README docs/html \
$PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz

View file

@ -0,0 +1,8 @@
PRGNAM="SDL_Pango"
VERSION="0.1.2"
HOMEPAGE="http://sdlpango.sourceforge.net/"
DOWNLOAD="http://dl.sourceforge.net/sdlpango/SDL_Pango-0.1.2.tar.gz"
MD5SUM="85bbf9bb7b1cee0538154dadd045418c"
MAINTAINER="Erik Hanson"
EMAIL="erik@slackbuilds.org"
APPROVED="elohim,robw810"

View file

@ -0,0 +1,8 @@
SDL_Pango: SDL_Pango - Pango bindings for SDL
SDL_Pango:
SDL_Pango: Pango is a text rendering engine. SDL_Pango connects the
SDL_Pango: engine to SDL.
SDL_Pango:
SDL_Pango: http://sdlpango.sourceforge.net/
SDL_Pango:
SDL_Pango: