aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches/sdl-pango-api_additions.patch
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2020-01-03 17:20:27 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2020-02-02 14:20:28 +0100
commitf389c65dbbc4ed1802707aba709bef01bd315895 (patch)
treea9b3eb8cff74296989c87259d6743819276f5358 /gnu/packages/patches/sdl-pango-api_additions.patch
parent2a2da78326e80dabba2d02afa790f487e85df3e4 (diff)
downloadguix-f389c65dbbc4ed1802707aba709bef01bd315895.tar.gz
guix-f389c65dbbc4ed1802707aba709bef01bd315895.zip
gnu: Add sdl-pango.
* gnu/packages/sdl.scm (sdl-pango): New variable. * gnu/packages/patches/sdl-pango-api_additions.patch: New file. * gnu/packages/patches/sdl-pango-blit_overflow.patch: New file. * gnu/packages/patches/sdl-pango-fillrect_crash.patch: New file. * gnu/packages/patches/sdl-pango-fix-explicit-SDLPango_CopyFTBitmapToSurface.patch: New file. * gnu/packages/patches/sdl-pango-matrix_declarations.patch: New file. * gnu/packages/patches/sdl-pango-sans-serif.patch: New file. * gnu/local.mk (sdl-pango): Reference patches. add
Diffstat (limited to 'gnu/packages/patches/sdl-pango-api_additions.patch')
-rw-r--r--gnu/packages/patches/sdl-pango-api_additions.patch128
1 files changed, 128 insertions, 0 deletions
diff --git a/gnu/packages/patches/sdl-pango-api_additions.patch b/gnu/packages/patches/sdl-pango-api_additions.patch
new file mode 100644
index 0000000000..5c02e79910
--- /dev/null
+++ b/gnu/packages/patches/sdl-pango-api_additions.patch
@@ -0,0 +1,128 @@
+Index: SDL_Pango-0.1.2/src/SDL_Pango.c
+===================================================================
+--- SDL_Pango-0.1.2.orig/src/SDL_Pango.c 2004-12-10 10:06:33.000000000 +0100
++++ SDL_Pango-0.1.2/src/SDL_Pango.c 2007-09-18 14:56:35.362379428 +0200
+@@ -723,13 +723,9 @@
+ 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 +739,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 +757,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 +1059,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 +1087,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);
+ }
+
+ /*!
+Index: SDL_Pango-0.1.2/src/SDL_Pango.h
+===================================================================
+--- SDL_Pango-0.1.2.orig/src/SDL_Pango.h 2004-12-10 10:06:33.000000000 +0100
++++ SDL_Pango-0.1.2/src/SDL_Pango.h 2007-09-18 15:00:41.736419485 +0200
+@@ -26,6 +26,7 @@
+
+ #ifndef SDL_PANGO_H
+ #define SDL_PANGO_H
++#define SDL_PANGO_HAS_GC_EXTENSIONS
+
+ #include "SDL.h"
+
+@@ -109,12 +110,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 +166,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,