Files
haikuports/media-libs/sdl_pango/patches/sdl_pango-0.1.2.patchset
2017-01-02 12:56:25 +00:00

106 lines
2.9 KiB
Plaintext

From 5296b04fac8a8a447685d9c7a2287b38045e6811 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Sun, 1 Jan 2017 00:36:49 +0100
Subject: Patch taken from http://zarb.org/~gc/t/SDL_Pango-0.1.2-API-adds.patch
diff --git a/src/SDL_Pango.c b/src/SDL_Pango.c
index 2118cd2..97d0347 100644
--- a/src/SDL_Pango.c
+++ b/src/SDL_Pango.c
@@ -729,7 +729,7 @@ SDLPango_CopyFTBitmapToSurface(
@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;
@@ -744,7 +744,7 @@ SDLPango_CreateContext()
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 +762,17 @@ SDLPango_CreateContext()
}
/*!
+ 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 +1064,16 @@ SDLPango_SetMarkup(
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)
+{
+ SDLPango_SetText_GivenAlignment(context, text, length, SDLPANGO_ALIGN_LEFT);
+}
+
/*!
Set plain text to context.
Text must be utf-8.
diff --git a/src/SDL_Pango.h b/src/SDL_Pango.h
index 2433661..1acd96f 100644
--- a/src/SDL_Pango.h
+++ b/src/SDL_Pango.h
@@ -109,12 +109,20 @@ typedef enum {
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 +165,12 @@ extern DECLSPEC void SDLCALL SDLPango_SetMarkup(
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,
--
2.7.0