gnu: Add kafs-client
[jackhill/guix/guix.git] / gnu / packages / patches / sdl-pango-api_additions.patch
1 Index: SDL_Pango-0.1.2/src/SDL_Pango.c
2 ===================================================================
3 --- SDL_Pango-0.1.2.orig/src/SDL_Pango.c 2004-12-10 10:06:33.000000000 +0100
4 +++ SDL_Pango-0.1.2/src/SDL_Pango.c 2007-09-18 14:56:35.362379428 +0200
5 @@ -723,13 +723,9 @@
6 SDL_UnlockSurface(surface);
7 }
8
9 -/*!
10 - Create a context which contains Pango objects.
11
12 - @return A pointer to the context as a SDLPango_Context*.
13 -*/
14 SDLPango_Context*
15 -SDLPango_CreateContext()
16 +SDLPango_CreateContext_GivenFontDesc(const char* font_desc)
17 {
18 SDLPango_Context *context = g_malloc(sizeof(SDLPango_Context));
19 G_CONST_RETURN char *charset;
20 @@ -743,8 +739,7 @@
21 pango_context_set_language (context->context, pango_language_from_string (charset));
22 pango_context_set_base_dir (context->context, PANGO_DIRECTION_LTR);
23
24 - context->font_desc = pango_font_description_from_string(
25 - MAKE_FONT_NAME (DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE));
26 + context->font_desc = pango_font_description_from_string(font_desc);
27
28 context->layout = pango_layout_new (context->context);
29
30 @@ -762,6 +757,17 @@
31 }
32
33 /*!
34 + Create a context which contains Pango objects.
35 +
36 + @return A pointer to the context as a SDLPango_Context*.
37 +*/
38 +SDLPango_Context*
39 +SDLPango_CreateContext()
40 +{
41 + SDLPango_CreateContext_GivenFontDesc(MAKE_FONT_NAME(DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE));
42 +}
43 +
44 +/*!
45 Free a context.
46
47 @param *context [i/o] Context to be free
48 @@ -1053,6 +1059,20 @@
49 pango_layout_set_font_description (context->layout, context->font_desc);
50 }
51
52 +void
53 +SDLPango_SetText_GivenAlignment(
54 + SDLPango_Context *context,
55 + const char *text,
56 + int length,
57 + SDLPango_Alignment alignment)
58 +{
59 + pango_layout_set_attributes(context->layout, NULL);
60 + pango_layout_set_text (context->layout, text, length);
61 + pango_layout_set_auto_dir (context->layout, TRUE);
62 + pango_layout_set_alignment (context->layout, alignment);
63 + pango_layout_set_font_description (context->layout, context->font_desc);
64 +}
65 +
66 /*!
67 Set plain text to context.
68 Text must be utf-8.
69 @@ -1067,11 +1087,7 @@
70 const char *text,
71 int length)
72 {
73 - pango_layout_set_attributes(context->layout, NULL);
74 - pango_layout_set_text (context->layout, text, length);
75 - pango_layout_set_auto_dir (context->layout, TRUE);
76 - pango_layout_set_alignment (context->layout, PANGO_ALIGN_LEFT);
77 - pango_layout_set_font_description (context->layout, context->font_desc);
78 + SDLPango_SetText_GivenAlignment(context, text, length, SDLPANGO_ALIGN_LEFT);
79 }
80
81 /*!
82 Index: SDL_Pango-0.1.2/src/SDL_Pango.h
83 ===================================================================
84 --- SDL_Pango-0.1.2.orig/src/SDL_Pango.h 2004-12-10 10:06:33.000000000 +0100
85 +++ SDL_Pango-0.1.2/src/SDL_Pango.h 2007-09-18 15:00:41.736419485 +0200
86 @@ -26,6 +26,7 @@
87
88 #ifndef SDL_PANGO_H
89 #define SDL_PANGO_H
90 +#define SDL_PANGO_HAS_GC_EXTENSIONS
91
92 #include "SDL.h"
93
94 @@ -109,12 +110,20 @@
95 SDLPANGO_DIRECTION_NEUTRAL /*! Neutral */
96 } SDLPango_Direction;
97
98 -
99 +/*!
100 + Specifies alignment of text. See Pango reference for detail
101 +*/
102 +typedef enum {
103 + SDLPANGO_ALIGN_LEFT,
104 + SDLPANGO_ALIGN_CENTER,
105 + SDLPANGO_ALIGN_RIGHT
106 +} SDLPango_Alignment;
107
108 extern DECLSPEC int SDLCALL SDLPango_Init();
109
110 extern DECLSPEC int SDLCALL SDLPango_WasInit();
111
112 +extern DECLSPEC SDLPango_Context* SDLCALL SDLPango_CreateContext_GivenFontDesc(const char* font_desc);
113 extern DECLSPEC SDLPango_Context* SDLCALL SDLPango_CreateContext();
114
115 extern DECLSPEC void SDLCALL SDLPango_FreeContext(
116 @@ -157,6 +166,12 @@
117 const char *markup,
118 int length);
119
120 +extern DECLSPEC void SDLCALL SDLPango_SetText_GivenAlignment(
121 + SDLPango_Context *context,
122 + const char *text,
123 + int length,
124 + SDLPango_Alignment alignment);
125 +
126 extern DECLSPEC void SDLCALL SDLPango_SetText(
127 SDLPango_Context *context,
128 const char *markup,