mirror of https://github.com/kivy/kivy.git
pango: prevent deprecation warning
This commit is contained in:
parent
9a67b173ef
commit
e51c4481fb
|
@ -434,11 +434,7 @@ cdef ContextContainer _get_or_create_cc(bytes font_context, bytes font_name_r):
|
|||
pango_ft2_font_map_set_default_substitute(PANGO_FT2_FONT_MAP(cc.fontmap),
|
||||
&_ft2subst_callback, <gpointer>&cc.ft2subst_callback_data, NULL)
|
||||
|
||||
# FIXME: Can we avoid deprecation warning?
|
||||
if PANGO_VERSION_CHECK(1, 22, 0):
|
||||
cc.context = pango_font_map_create_context(cc.fontmap)
|
||||
else:
|
||||
cc.context = pango_ft2_font_map_create_context(PANGO_FT2_FONT_MAP(cc.fontmap))
|
||||
cc.context = _pango_font_map_create_context(cc.fontmap)
|
||||
if not cc.context:
|
||||
Logger.warn("_text_pango: Could not create pango context")
|
||||
return
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
// needed to prevent warning during compilation
|
||||
|
||||
#if PANGO_VERSION_CHECK(1, 22, 0)
|
||||
#define _pango_font_map_create_context(fontmap) \
|
||||
pango_font_map_create_context(fontmap)
|
||||
#else
|
||||
#define _pango_font_map_create_context(fontmap) \
|
||||
pango_ft2_font_map_create_context(PANGO_FT2_FONT_MAP(fontmap))
|
||||
#endif
|
|
@ -15,7 +15,6 @@ cdef extern from "glib.h" nogil:
|
|||
# gpointer GUINT_TO_POINTER(guint u)
|
||||
# guint GPOINTER_TO_UINT(gpointer p)
|
||||
|
||||
|
||||
# https://www.freetype.org/freetype2/docs/reference/ft2-index.html
|
||||
cdef extern from "../../lib/pango/freetype2.h" nogil:
|
||||
int FREETYPE_MAJOR
|
||||
|
@ -229,7 +228,6 @@ cdef extern from "pango/pangoft2.h" nogil:
|
|||
void pango_ft2_render_layout(FT_Bitmap *bitmap, PangoLayout *layout, int x, int y)
|
||||
void pango_ft2_render_layout_subpixel(FT_Bitmap *bitmap, PangoLayout *layout, int x, int y)
|
||||
void pango_ft2_font_map_set_default_substitute(PangoFT2FontMap *fontmap, PangoFT2SubstituteFunc func, gpointer data, GDestroyNotify notify)
|
||||
PangoContext *pango_ft2_font_map_create_context(PangoFT2FontMap *fontmap) # < v1.22, now pango_font_map_create_context
|
||||
void pango_ft2_font_map_substitute_changed(PangoFT2FontMap *fontmap)
|
||||
|
||||
|
||||
|
@ -269,7 +267,6 @@ cdef extern from "pango/pango-font.h" nogil:
|
|||
pass
|
||||
|
||||
PangoFontMap *pango_ft2_font_map_new()
|
||||
PangoContext *pango_font_map_create_context(PangoFontMap *fontmap)
|
||||
PangoFontDescription* pango_font_description_new()
|
||||
PangoFontDescription* pango_font_description_from_string(const char *string)
|
||||
void pango_font_description_free(PangoFontDescription *desc)
|
||||
|
@ -364,3 +361,6 @@ cdef extern from "pango/pango-layout.h" nogil:
|
|||
gboolean pango_layout_get_justify(PangoLayout *layout)
|
||||
void pango_layout_set_single_paragraph_mode(PangoLayout *layout, gboolean setting)
|
||||
gboolean pango_layout_get_single_paragraph_mode(PangoLayout *layout)
|
||||
|
||||
cdef extern from "../../lib/pango/pangoft2.h" nogil:
|
||||
PangoContext *_pango_font_map_create_context(PangoFontMap *fontmap)
|
||||
|
|
4
setup.py
4
setup.py
|
@ -856,7 +856,9 @@ if c_options['use_pangoft2'] in (None, True) and platform not in (
|
|||
if pango_flags and 'libraries' in pango_flags:
|
||||
print('Pango: pangoft2 found via pkg-config')
|
||||
c_options['use_pangoft2'] = True
|
||||
pango_depends = {'depends': ['lib/pango/pangoft2.pxi']}
|
||||
pango_depends = {'depends': [
|
||||
'lib/pango/pangoft2.pxi',
|
||||
'lib/pango/pangoft2.h']}
|
||||
sources['core/text/_text_pango.pyx'] = merge(
|
||||
base_flags, pango_flags, pango_depends)
|
||||
print(sources['core/text/_text_pango.pyx'])
|
||||
|
|
Loading…
Reference in New Issue