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