added patches to fix API tu build recent SDL (https://github.com/PerlGameDev/SDL/issues/241) [release 0.1.2-4mamba;Tue Dec 24 2013]

This commit is contained in:
Silvan Calarco 2024-01-06 03:38:14 +01:00
parent 2af6562706
commit aa82373b29
3 changed files with 201 additions and 0 deletions

View File

@ -1,2 +1,4 @@
# libSDL_Pango
Pango is the text rendering engine of GNOME 2. SDL_Pango connects that engine to SDL, the Simple DirectMedia Layer.

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,

83
libSDL_Pango.spec Normal file
View File

@ -0,0 +1,83 @@
Name: libSDL_Pango
Version: 0.1.2
Release: 4mamba
Summary: Rendering of internationalized text for SDL (Simple DirectMedia Layer)
Group: System/Libraries
Vendor: openmamba
Distribution: openmamba
Packager: Tiziana Ferro <tiziana.ferro@email.it>
URL: http://sdlpango.sourceforge.net/
#Source: http://downloads.sourceforge.net/sdlpango/SDL_Pango-%{version}.tar.gz
Source0: http://dl.sf.net/sdlpango/SDL_Pango-%{version}.tar.gz
Patch0: SDL_Pango-0.1.2-API-adds.patch
License: LGPL
BuildRoot: %{_tmppath}/%{name}-%{version}-root
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libfontconfig-devel
BuildRequires: libfreetype-devel
BuildRequires: libglib-devel
BuildRequires: libpango-devel
BuildRequires: libSDL-devel
BuildRequires: libz-devel
## AUTOBUILDREQ-END
%description
Pango is the text rendering engine of GNOME 2. SDL_Pango connects that engine to SDL, the Simple DirectMedia Layer.
%package devel
Summary: Header files, libraries and development documentation for %{name}
Group: Development/Libraries
Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release}
%description devel
This package contains the header files, static libraries and development documentation for %{name}. If you like to develop programs using %{name}, you will need to install %{name}-devel
This package contains static libraries and header files need for development.
%prep
%setup -q -n SDL_Pango-%{version}
%patch0 -p0 -b .API-adds
%build
%configure
%make
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%makeinstall
rm -f %{buildroot}%{_libdir}/*.a
rm -f %{buildroot}%{_libdir}/*.la
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%defattr(-,root,root)
%{_libdir}/libSDL_Pango.so.*
%doc AUTHORS COPYING
%files devel
%defattr(-,root,root)
%{_includedir}/SDL_Pango.h
%{_libdir}/libSDL_Pango.so
%{_libdir}/pkgconfig/SDL_Pango.pc
%doc docs/html/*
%doc ChangeLog NEWS README
%changelog
* Tue Dec 24 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 0.1.2-4mamba
- added patches to fix API tu build recent SDL (https://github.com/PerlGameDev/SDL/issues/241)
* Fri Aug 30 2013 Automatic Build System <autodist@mambasoft.it> 0.1.2-3mamba
- automatic rebuild by autodist
* Tue Oct 21 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 0.1.2-2mamba
- specfile renamed to match package name (was libSDL_pango)
- fixed group
* Tue Aug 14 2007 Tiziana Ferro <tiziana.ferro@email.it> 0.1.2-1mamba
- package created by autospec