Merge branch 'pango-deprecations' into 'gtk-3-24'
Pango deprecations See merge request GNOME/gtk!544
This commit is contained in:
commit
df890474ed
@ -55,6 +55,7 @@ m4_define([glib_max_allowed_version], m4_join([_], [GLIB_VERSION], glib_required
|
||||
GLIB_VERSION_CFLAGS="-DGLIB_MIN_REQUIRED_VERSION=glib_min_required_version -DGLIB_MAX_ALLOWED_VERSION=glib_max_allowed_version"
|
||||
|
||||
m4_define([pango_required_version], [1.41.0])
|
||||
m4_define([fribidi_required_version], [0.19.7])
|
||||
m4_define([atk_required_version], [2.15.1])
|
||||
m4_define([cairo_required_version], [1.14.0])
|
||||
m4_define([gdk_pixbuf_required_version], [2.30.0])
|
||||
@ -585,6 +586,7 @@ PKG_CHECK_MODULES(BASE_DEPENDENCIES,
|
||||
[glib-2.0 >= glib_required_version dnl
|
||||
atk >= atk_required_version dnl
|
||||
pango >= pango_required_version dnl
|
||||
fribidi >= fribidi_required_version dnl
|
||||
cairo >= cairo_required_version dnl
|
||||
cairo-gobject >= cairo_required_version dnl
|
||||
gdk-pixbuf-2.0 >= gdk_pixbuf_required_version])
|
||||
|
19
gdk/gdk.c
19
gdk/gdk.c
@ -41,6 +41,8 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <fribidi.h>
|
||||
|
||||
|
||||
/**
|
||||
* SECTION:general
|
||||
@ -1113,3 +1115,20 @@ gdk_disable_multidevice (void)
|
||||
|
||||
_gdk_disable_multidevice = TRUE;
|
||||
}
|
||||
|
||||
PangoDirection
|
||||
gdk_unichar_direction (gunichar ch)
|
||||
{
|
||||
FriBidiCharType fribidi_ch_type;
|
||||
|
||||
G_STATIC_ASSERT (sizeof (FriBidiChar) == sizeof (gunichar));
|
||||
|
||||
fribidi_ch_type = fribidi_get_bidi_type (ch);
|
||||
|
||||
if (!FRIBIDI_IS_STRONG (fribidi_ch_type))
|
||||
return PANGO_DIRECTION_NEUTRAL;
|
||||
else if (FRIBIDI_IS_RTL (fribidi_ch_type))
|
||||
return PANGO_DIRECTION_RTL;
|
||||
else
|
||||
return PANGO_DIRECTION_LTR;
|
||||
}
|
||||
|
@ -558,6 +558,8 @@ cairo_surface_t * _gdk_offscreen_window_create_surface (GdkWindow *window,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
PangoDirection gdk_unichar_direction (gunichar ch);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_INTERNALS_H__ */
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <sys/mman.h>
|
||||
#include <fribidi.h>
|
||||
|
||||
#include "gdk.h"
|
||||
#include "gdkwayland.h"
|
||||
@ -499,7 +500,7 @@ update_direction (GdkWaylandKeymap *keymap)
|
||||
{
|
||||
PangoDirection dir;
|
||||
|
||||
dir = pango_unichar_direction (xkb_keysym_to_utf32 (syms[sym]));
|
||||
dir = gdk_unichar_direction (xkb_keysym_to_utf32 (syms[sym]));
|
||||
switch (dir)
|
||||
{
|
||||
case PANGO_DIRECTION_RTL:
|
||||
|
@ -480,7 +480,7 @@ get_direction (XkbDescRec *xkb,
|
||||
{
|
||||
gint level = 0;
|
||||
KeySym sym = XkbKeySymEntry (xkb, code, level, group);
|
||||
PangoDirection dir = pango_unichar_direction (gdk_keyval_to_unicode (sym));
|
||||
PangoDirection dir = gdk_unichar_direction (gdk_keyval_to_unicode (sym));
|
||||
|
||||
switch (dir)
|
||||
{
|
||||
|
@ -6388,7 +6388,7 @@ gtk_entry_create_layout (GtkEntry *entry,
|
||||
PangoDirection pango_dir;
|
||||
|
||||
if (gtk_entry_get_display_mode (entry) == DISPLAY_NORMAL)
|
||||
pango_dir = pango_find_base_dir (display_text, n_bytes);
|
||||
pango_dir = _gtk_pango_find_base_dir (display_text, n_bytes);
|
||||
else
|
||||
pango_dir = PANGO_DIRECTION_NEUTRAL;
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "config.h"
|
||||
#include "gtkpango.h"
|
||||
#include <pango/pangocairo.h>
|
||||
#include <fribidi.h>
|
||||
#include "gtkintl.h"
|
||||
|
||||
#define GTK_TYPE_FILL_LAYOUT_RENDERER (_gtk_fill_layout_renderer_get_type())
|
||||
@ -1321,3 +1322,46 @@ _gtk_pango_attr_list_merge (PangoAttrList *into,
|
||||
|
||||
return into;
|
||||
}
|
||||
|
||||
PangoDirection
|
||||
_gtk_pango_unichar_direction (gunichar ch)
|
||||
{
|
||||
FriBidiCharType fribidi_ch_type;
|
||||
|
||||
G_STATIC_ASSERT (sizeof (FriBidiChar) == sizeof (gunichar));
|
||||
|
||||
fribidi_ch_type = fribidi_get_bidi_type (ch);
|
||||
|
||||
if (!FRIBIDI_IS_STRONG (fribidi_ch_type))
|
||||
return PANGO_DIRECTION_NEUTRAL;
|
||||
else if (FRIBIDI_IS_RTL (fribidi_ch_type))
|
||||
return PANGO_DIRECTION_RTL;
|
||||
else
|
||||
return PANGO_DIRECTION_LTR;
|
||||
}
|
||||
|
||||
PangoDirection
|
||||
_gtk_pango_find_base_dir (const gchar *text,
|
||||
gint length)
|
||||
{
|
||||
PangoDirection dir = PANGO_DIRECTION_NEUTRAL;
|
||||
const gchar *p;
|
||||
|
||||
g_return_val_if_fail (text != NULL || length == 0, PANGO_DIRECTION_NEUTRAL);
|
||||
|
||||
p = text;
|
||||
while ((length < 0 || p < text + length) && *p)
|
||||
{
|
||||
gunichar wc = g_utf8_get_char (p);
|
||||
|
||||
dir = _gtk_pango_unichar_direction (wc);
|
||||
|
||||
if (dir != PANGO_DIRECTION_NEUTRAL)
|
||||
break;
|
||||
|
||||
p = g_utf8_next_char (p);
|
||||
}
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
|
@ -82,6 +82,9 @@ gchar *_gtk_pango_get_text_after (PangoLayout *layout,
|
||||
PangoAttrList *_gtk_pango_attr_list_merge (PangoAttrList *into,
|
||||
PangoAttrList *from);
|
||||
|
||||
PangoDirection _gtk_pango_find_base_dir (const gchar *text,
|
||||
gint length);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_PANGO_H__ */
|
||||
|
@ -67,6 +67,7 @@
|
||||
#include "gtkdebug.h"
|
||||
#include "gtktextmarkprivate.h"
|
||||
#include "gtktextsegment.h"
|
||||
#include "gtkpango.h"
|
||||
|
||||
/*
|
||||
* Types
|
||||
@ -598,8 +599,7 @@ gtk_text_btree_resolve_bidi (GtkTextIter *start,
|
||||
{
|
||||
PangoDirection pango_dir;
|
||||
|
||||
pango_dir = pango_find_base_dir (seg->body.chars,
|
||||
seg->byte_count);
|
||||
pango_dir = _gtk_pango_find_base_dir (seg->body.chars, seg->byte_count);
|
||||
|
||||
if (pango_dir != PANGO_DIRECTION_NEUTRAL)
|
||||
{
|
||||
|
@ -58,6 +58,7 @@
|
||||
#include "gtkpixelcacheprivate.h"
|
||||
#include "gtkmagnifierprivate.h"
|
||||
#include "gtkemojichooser.h"
|
||||
#include "gtkpango.h"
|
||||
|
||||
#include "a11y/gtktextviewaccessibleprivate.h"
|
||||
|
||||
@ -6460,7 +6461,7 @@ iter_line_is_rtl (const GtkTextIter *iter)
|
||||
gtk_text_iter_set_line_offset (&start, 0);
|
||||
gtk_text_iter_forward_line (&end);
|
||||
text = gtk_text_iter_get_visible_text (&start, &end);
|
||||
direction = pango_find_base_dir (text, -1);
|
||||
direction = _gtk_pango_find_base_dir (text, -1);
|
||||
|
||||
g_free (text);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user