[gtk/matthiasc/for-master] imcontext: Enable font fallback for preedit
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master] imcontext: Enable font fallback for preedit
- Date: Thu, 18 Feb 2021 04:27:31 +0000 (UTC)
commit 05fe2441a7e93f3d1ebf25bfe8e6c945925da0c9
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Feb 17 22:08:43 2021 -0500
imcontext: Enable font fallback for preedit
Not doing so only invites hexboxes.
Fixes: #3678
gtk/gtkimcontextsimple.c | 9 ++++++++-
gtk/gtkimcontextwayland.c | 3 +++
2 files changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c
index 701e433c19..b8fec2f384 100644
--- a/gtk/gtkimcontextsimple.c
+++ b/gtk/gtkimcontextsimple.c
@@ -945,7 +945,14 @@ gtk_im_context_simple_get_preedit_string (GtkIMContext *context,
if (s->len)
{
- PangoAttribute *attr = pango_attr_underline_new (PANGO_UNDERLINE_SINGLE);
+ PangoAttribute *attr;
+
+ attr = pango_attr_underline_new (PANGO_UNDERLINE_SINGLE);
+ attr->start_index = 0;
+ attr->end_index = s->len;
+ pango_attr_list_insert (*attrs, attr);
+
+ attr = pango_attr_fallback_new (TRUE);
attr->start_index = 0;
attr->end_index = s->len;
pango_attr_list_insert (*attrs, attr);
diff --git a/gtk/gtkimcontextwayland.c b/gtk/gtkimcontextwayland.c
index 77264087eb..c5e0093584 100644
--- a/gtk/gtkimcontextwayland.c
+++ b/gtk/gtkimcontextwayland.c
@@ -610,6 +610,9 @@ gtk_im_context_wayland_get_preedit_string (GtkIMContext *context,
*attrs = pango_attr_list_new ();
pango_attr_list_insert (*attrs,
pango_attr_underline_new (PANGO_UNDERLINE_SINGLE));
+ /* enable fallback, since IBus will send us things like ⎄ */
+ pango_attr_list_insert (*attrs,
+ pango_attr_fallback_new (TRUE));
if (context_wayland->current_preedit.cursor_begin
!= context_wayland->current_preedit.cursor_end)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]