/[packages]/cauldron/SDL_Pango/current/SOURCES/SDL_Pango-0.1.2-API-adds.patch
ViewVC logotype

Contents of /cauldron/SDL_Pango/current/SOURCES/SDL_Pango-0.1.2-API-adds.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 42129 - (show annotations) (download)
Thu Jan 27 17:09:20 2011 UTC (13 years, 3 months ago) by jquelin
File size: 3624 byte(s)
imported package SDL_Pango
1 --- src/SDL_Pango.c 2004-12-10 10:06:33.000000000 +0100
2 +++ src/SDL_Pango.c 2006-09-24 22:46:24.000000000 +0200
3 @@ -723,13 +723,8 @@
4 SDL_UnlockSurface(surface);
5 }
6
7 -/*!
8 - Create a context which contains Pango objects.
9 -
10 - @return A pointer to the context as a SDLPango_Context*.
11 -*/
12 SDLPango_Context*
13 -SDLPango_CreateContext()
14 +SDLPango_CreateContext_GivenFontDesc(const char* font_desc)
15 {
16 SDLPango_Context *context = g_malloc(sizeof(SDLPango_Context));
17 G_CONST_RETURN char *charset;
18 @@ -743,8 +738,7 @@
19 pango_context_set_language (context->context, pango_language_from_string (charset));
20 pango_context_set_base_dir (context->context, PANGO_DIRECTION_LTR);
21
22 - context->font_desc = pango_font_description_from_string(
23 - MAKE_FONT_NAME (DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE));
24 + context->font_desc = pango_font_description_from_string(font_desc);
25
26 context->layout = pango_layout_new (context->context);
27
28 @@ -762,6 +756,17 @@
29 }
30
31 /*!
32 + Create a context which contains Pango objects.
33 +
34 + @return A pointer to the context as a SDLPango_Context*.
35 +*/
36 +SDLPango_Context*
37 +SDLPango_CreateContext()
38 +{
39 + SDLPango_CreateContext_GivenFontDesc(MAKE_FONT_NAME(DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE));
40 +}
41 +
42 +/*!
43 Free a context.
44
45 @param *context [i/o] Context to be free
46 @@ -1053,6 +1058,20 @@
47 pango_layout_set_font_description (context->layout, context->font_desc);
48 }
49
50 +void
51 +SDLPango_SetText_GivenAlignment(
52 + SDLPango_Context *context,
53 + const char *text,
54 + int length,
55 + SDLPango_Alignment alignment)
56 +{
57 + pango_layout_set_attributes(context->layout, NULL);
58 + pango_layout_set_text (context->layout, text, length);
59 + pango_layout_set_auto_dir (context->layout, TRUE);
60 + pango_layout_set_alignment (context->layout, alignment);
61 + pango_layout_set_font_description (context->layout, context->font_desc);
62 +}
63 +
64 /*!
65 Set plain text to context.
66 Text must be utf-8.
67 @@ -1067,11 +1086,7 @@
68 const char *text,
69 int length)
70 {
71 - pango_layout_set_attributes(context->layout, NULL);
72 - pango_layout_set_text (context->layout, text, length);
73 - pango_layout_set_auto_dir (context->layout, TRUE);
74 - pango_layout_set_alignment (context->layout, PANGO_ALIGN_LEFT);
75 - pango_layout_set_font_description (context->layout, context->font_desc);
76 + SDLPango_SetText_GivenAlignment(context, text, length, SDLPANGO_ALIGN_LEFT);
77 }
78
79 /*!
80 --- src/SDL_Pango.h 2004-12-10 10:06:33.000000000 +0100
81 +++ src/SDL_Pango.h 2006-09-24 22:46:01.000000000 +0200
82 @@ -109,12 +109,20 @@
83 SDLPANGO_DIRECTION_NEUTRAL /*! Neutral */
84 } SDLPango_Direction;
85
86 -
87 +/*!
88 + Specifies alignment of text. See Pango reference for detail
89 +*/
90 +typedef enum {
91 + SDLPANGO_ALIGN_LEFT,
92 + SDLPANGO_ALIGN_CENTER,
93 + SDLPANGO_ALIGN_RIGHT
94 +} SDLPango_Alignment;
95
96 extern DECLSPEC int SDLCALL SDLPango_Init();
97
98 extern DECLSPEC int SDLCALL SDLPango_WasInit();
99
100 +extern DECLSPEC SDLPango_Context* SDLCALL SDLPango_CreateContext_GivenFontDesc(const char* font_desc);
101 extern DECLSPEC SDLPango_Context* SDLCALL SDLPango_CreateContext();
102
103 extern DECLSPEC void SDLCALL SDLPango_FreeContext(
104 @@ -157,6 +165,12 @@
105 const char *markup,
106 int length);
107
108 +extern DECLSPEC void SDLCALL SDLPango_SetText_GivenAlignment(
109 + SDLPango_Context *context,
110 + const char *text,
111 + int length,
112 + SDLPango_Alignment alignment);
113 +
114 extern DECLSPEC void SDLCALL SDLPango_SetText(
115 SDLPango_Context *context,
116 const char *markup,

  ViewVC Help
Powered by ViewVC 1.1.30