Dash:
[t2.git] / package / graphic / libsdl_pango / 0.1.2-API-adds.patch
bloba44c57fa861f496e099a8556b32b572798a828cb
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
3 #
4 # T2 SDE: package/.../libsdl_pango/0.1.2-API-adds.patch
5 # Copyright (C) 2007 The T2 SDE Project
6 #
7 # More information can be found in the files COPYING and README.
8 #
9 # This patch file is dual-licensed. It is available under the license the
10 # patched project is licensed under, as long as it is an OpenSource license
11 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
12 # of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
14 # version.
15 # --- T2-COPYRIGHT-NOTE-END ---
17 --- ./src/SDL_Pango.c 2004-12-10 10:06:33.000000000 +0100
18 +++ ./src/SDL_Pango.c 2006-09-24 22:46:24.000000000 +0200
19 @@ -723,13 +723,8 @@
20 SDL_UnlockSurface(surface);
23 -/*!
24 - Create a context which contains Pango objects.
26 - @return A pointer to the context as a SDLPango_Context*.
27 -*/
28 SDLPango_Context*
29 -SDLPango_CreateContext()
30 +SDLPango_CreateContext_GivenFontDesc(const char* font_desc)
32 SDLPango_Context *context = g_malloc(sizeof(SDLPango_Context));
33 G_CONST_RETURN char *charset;
34 @@ -743,8 +738,7 @@
35 pango_context_set_language (context->context, pango_language_from_string (charset));
36 pango_context_set_base_dir (context->context, PANGO_DIRECTION_LTR);
38 - context->font_desc = pango_font_description_from_string(
39 - MAKE_FONT_NAME (DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE));
40 + context->font_desc = pango_font_description_from_string(font_desc);
42 context->layout = pango_layout_new (context->context);
44 @@ -762,6 +756,17 @@
47 /*!
48 + Create a context which contains Pango objects.
50 + @return A pointer to the context as a SDLPango_Context*.
51 +*/
52 +SDLPango_Context*
53 +SDLPango_CreateContext()
55 + SDLPango_CreateContext_GivenFontDesc(MAKE_FONT_NAME(DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE));
58 +/*!
59 Free a context.
61 @param *context [i/o] Context to be free
62 @@ -1053,6 +1058,20 @@
63 pango_layout_set_font_description (context->layout, context->font_desc);
66 +void
67 +SDLPango_SetText_GivenAlignment(
68 + SDLPango_Context *context,
69 + const char *text,
70 + int length,
71 + SDLPango_Alignment alignment)
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, alignment);
77 + pango_layout_set_font_description (context->layout, context->font_desc);
80 /*!
81 Set plain text to context.
82 Text must be utf-8.
83 @@ -1067,11 +1086,7 @@
84 const char *text,
85 int length)
87 - pango_layout_set_attributes(context->layout, NULL);
88 - pango_layout_set_text (context->layout, text, length);
89 - pango_layout_set_auto_dir (context->layout, TRUE);
90 - pango_layout_set_alignment (context->layout, PANGO_ALIGN_LEFT);
91 - pango_layout_set_font_description (context->layout, context->font_desc);
92 + SDLPango_SetText_GivenAlignment(context, text, length, SDLPANGO_ALIGN_LEFT);
95 /*!
96 --- ./src/SDL_Pango.h 2004-12-10 10:06:33.000000000 +0100
97 +++ .//src/SDL_Pango.h 2006-09-24 22:46:01.000000000 +0200
98 @@ -109,12 +109,20 @@
99 SDLPANGO_DIRECTION_NEUTRAL /*! Neutral */
100 } SDLPango_Direction;
103 +/*!
104 + Specifies alignment of text. See Pango reference for detail
106 +typedef enum {
107 + SDLPANGO_ALIGN_LEFT,
108 + SDLPANGO_ALIGN_CENTER,
109 + SDLPANGO_ALIGN_RIGHT
110 +} SDLPango_Alignment;
112 extern DECLSPEC int SDLCALL SDLPango_Init();
114 extern DECLSPEC int SDLCALL SDLPango_WasInit();
116 +extern DECLSPEC SDLPango_Context* SDLCALL SDLPango_CreateContext_GivenFontDesc(const char* font_desc);
117 extern DECLSPEC SDLPango_Context* SDLCALL SDLPango_CreateContext();
119 extern DECLSPEC void SDLCALL SDLPango_FreeContext(
120 @@ -157,6 +165,12 @@
121 const char *markup,
122 int length);
124 +extern DECLSPEC void SDLCALL SDLPango_SetText_GivenAlignment(
125 + SDLPango_Context *context,
126 + const char *text,
127 + int length,
128 + SDLPango_Alignment alignment);
130 extern DECLSPEC void SDLCALL SDLPango_SetText(
131 SDLPango_Context *context,
132 const char *markup,