Implement Unicode choice on Emojier
This commit is contained in:
parent
a8719e1d2d
commit
a3692b8582
4272
ibus-HEAD.patch
4272
ibus-HEAD.patch
File diff suppressed because it is too large
Load Diff
@ -1,14 +1,16 @@
|
|||||||
From 1e358f28a2b36743847584671ef533769036b40d Mon Sep 17 00:00:00 2001
|
From c6c1e8ea01c8466dc97d7549e77538e2d7ec872a Mon Sep 17 00:00:00 2001
|
||||||
From: fujiwarat <takao.fujiwara1@gmail.com>
|
From: fujiwarat <takao.fujiwara1@gmail.com>
|
||||||
Date: Sun, 22 Oct 2017 10:45:33 +0900
|
Date: Mon, 29 Jan 2018 18:27:09 +0900
|
||||||
Subject: [PATCH] Integrate custom rendering to use HarfBuzz glyph info
|
Subject: [PATCH] Integrate custom rendering to use HarfBuzz glyph info
|
||||||
|
|
||||||
IBusFontSet offers FcFontSet, glyph info with HarfBuzz and rendering
|
IBusFontSet offers FcFontSet, glyph info with HarfBuzz and rendering
|
||||||
on Cairo context.
|
on Cairo context.
|
||||||
Current Pango changes fonts by emoji variants and draws the separated
|
Now the most issues in Pango were fixed and I appreciate the changes [1].
|
||||||
glyphs [1] but actually the emoji characters with variants can be drawn
|
However the latest changes in Pango, Fontconfig prevent users from
|
||||||
as one glyph so this class manages Fontconfig fontsets to select a font,
|
setting emoji fonts with GtkFontChooser.
|
||||||
HarfBuzz to get glyphs for emoji variants, Cairo to draw glyphs.
|
This patch can enable the selected emoji font to draw emoji chars
|
||||||
|
on Emojier.
|
||||||
|
It's under the considerations if the font setting is deleted from ibus-setup.
|
||||||
Need configure --enable-harfbuzz-for-emoji option to enable this feature.
|
Need configure --enable-harfbuzz-for-emoji option to enable this feature.
|
||||||
|
|
||||||
[1]: https://bugzilla.gnome.org/show_bug.cgi?id=780669
|
[1]: https://bugzilla.gnome.org/show_bug.cgi?id=780669
|
||||||
@ -19,10 +21,10 @@ Need configure --enable-harfbuzz-for-emoji option to enable this feature.
|
|||||||
bindings/vala/ibus-fontset-1.0.deps | 1 +
|
bindings/vala/ibus-fontset-1.0.deps | 1 +
|
||||||
configure.ac | 29 +
|
configure.ac | 29 +
|
||||||
ui/gtk3/Makefile.am | 32 +
|
ui/gtk3/Makefile.am | 32 +
|
||||||
ui/gtk3/emojier.vala | 100 +++-
|
ui/gtk3/emojier.vala | 111 ++++
|
||||||
ui/gtk3/ibusfontset.c | 1030 ++++++++++++++++++++++++++++++++
|
ui/gtk3/ibusfontset.c | 1030 ++++++++++++++++++++++++++++++++
|
||||||
ui/gtk3/ibusfontset.h | 302 ++++++++++
|
ui/gtk3/ibusfontset.h | 302 ++++++++++
|
||||||
8 files changed, 1576 insertions(+), 2 deletions(-)
|
8 files changed, 1589 insertions(+)
|
||||||
create mode 100644 bindings/vala/IBusFontSet-1.0.metadata
|
create mode 100644 bindings/vala/IBusFontSet-1.0.metadata
|
||||||
create mode 100644 bindings/vala/ibus-fontset-1.0.deps
|
create mode 100644 bindings/vala/ibus-fontset-1.0.deps
|
||||||
create mode 100644 ui/gtk3/ibusfontset.c
|
create mode 100644 ui/gtk3/ibusfontset.c
|
||||||
@ -153,11 +155,11 @@ index 00000000..129fe166
|
|||||||
@@ -0,0 +1 @@
|
@@ -0,0 +1 @@
|
||||||
+cairo
|
+cairo
|
||||||
diff --git a/configure.ac b/configure.ac
|
diff --git a/configure.ac b/configure.ac
|
||||||
index 14556a3a..6ff8f4a9 100644
|
index bd41069b..243396ff 100644
|
||||||
--- a/configure.ac
|
--- a/configure.ac
|
||||||
+++ b/configure.ac
|
+++ b/configure.ac
|
||||||
@@ -653,6 +653,34 @@ https://github.com/fujiwarat/cldr-emoji-annotation)
|
@@ -688,6 +688,34 @@ the UCD files from https://www.unicode.org/Public/UNIDATA/)
|
||||||
enable_emoji_dict="yes (enabled, use --disable-emoji-dict to disable)"
|
enable_unicode_dict="yes (enabled, use --disable-unicode-dict to disable)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
+AC_ARG_ENABLE(harfbuzz-for-emoji,
|
+AC_ARG_ENABLE(harfbuzz-for-emoji,
|
||||||
@ -191,10 +193,10 @@ index 14556a3a..6ff8f4a9 100644
|
|||||||
# Check iso-codes.
|
# Check iso-codes.
|
||||||
PKG_CHECK_MODULES(ISOCODES, [
|
PKG_CHECK_MODULES(ISOCODES, [
|
||||||
iso-codes
|
iso-codes
|
||||||
@@ -743,6 +771,7 @@ Build options:
|
@@ -780,6 +808,7 @@ Build options:
|
||||||
Enable Emoji dict $enable_emoji_dict
|
|
||||||
Unicode Emoji directory $UNICODE_EMOJI_DIR
|
|
||||||
CLDR annotation directory $EMOJI_ANNOTATION_DIR
|
CLDR annotation directory $EMOJI_ANNOTATION_DIR
|
||||||
|
Enable Unicode dict $enable_unicode_dict
|
||||||
|
UCD directory $UCD_DIR
|
||||||
+ Enable HarfBuzz for Emoji $enable_harfbuzz_for_emoji
|
+ Enable HarfBuzz for Emoji $enable_harfbuzz_for_emoji
|
||||||
Run test cases $enable_tests
|
Run test cases $enable_tests
|
||||||
])
|
])
|
||||||
@ -250,22 +252,26 @@ index 786b80e6..cd1e9c2c 100644
|
|||||||
man_seven_DATA =$(man_seven_files:.7=.7.gz)
|
man_seven_DATA =$(man_seven_files:.7=.7.gz)
|
||||||
man_sevendir = $(mandir)/man7
|
man_sevendir = $(mandir)/man7
|
||||||
diff --git a/ui/gtk3/emojier.vala b/ui/gtk3/emojier.vala
|
diff --git a/ui/gtk3/emojier.vala b/ui/gtk3/emojier.vala
|
||||||
index f3e9f15c..58a26dd6 100644
|
index 555ea68f..0a703383 100644
|
||||||
--- a/ui/gtk3/emojier.vala
|
--- a/ui/gtk3/emojier.vala
|
||||||
+++ b/ui/gtk3/emojier.vala
|
+++ b/ui/gtk3/emojier.vala
|
||||||
@@ -99,6 +99,9 @@ class IBusEmojier : Gtk.ApplicationWindow {
|
@@ -99,16 +99,103 @@ public class IBusEmojier : Gtk.ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private class EWhiteLabel : Gtk.Label {
|
private class EWhiteLabel : Gtk.Label {
|
||||||
+#if ENABLE_HARFBUZZ_FOR_EMOJI
|
+#if ENABLE_HARFBUZZ_FOR_EMOJI
|
||||||
+ IBus.RequisitionEx m_requisition;
|
+ private IBus.RequisitionEx m_requisition;
|
||||||
|
+#else
|
||||||
|
private int m_minimum_width = 0;
|
||||||
|
private int m_natural_width = 0;
|
||||||
|
private int m_minimum_height = 0;
|
||||||
|
private int m_natural_height = 0;
|
||||||
+#endif
|
+#endif
|
||||||
public EWhiteLabel(string text) {
|
public EWhiteLabel(string text) {
|
||||||
GLib.Object(
|
GLib.Object(
|
||||||
name : "IBusEmojierWhiteLabel"
|
name : "IBusEmojierWhiteLabel"
|
||||||
@@ -106,8 +109,78 @@ class IBusEmojier : Gtk.ApplicationWindow {
|
);
|
||||||
if (text != "")
|
set_label(text);
|
||||||
set_label(text);
|
|
||||||
}
|
}
|
||||||
+#if ENABLE_HARFBUZZ_FOR_EMOJI
|
+#if ENABLE_HARFBUZZ_FOR_EMOJI
|
||||||
+ private void get_preferred_size_with_hb(out int minimum_width,
|
+ private void get_preferred_size_with_hb(out int minimum_width,
|
||||||
@ -277,7 +283,8 @@ index f3e9f15c..58a26dd6 100644
|
|||||||
+ minimum_height = 0;
|
+ minimum_height = 0;
|
||||||
+ natural_height = 0;
|
+ natural_height = 0;
|
||||||
+ var text = this.get_text();
|
+ var text = this.get_text();
|
||||||
+ if (text == null || text == "")
|
+ GLib.return_if_fail (text != null);
|
||||||
|
+ if (text == "")
|
||||||
+ return;
|
+ return;
|
||||||
+ var context = this.get_pango_context();
|
+ var context = this.get_pango_context();
|
||||||
+ var language = context.get_language();
|
+ var language = context.get_language();
|
||||||
@ -288,6 +295,18 @@ index f3e9f15c..58a26dd6 100644
|
|||||||
+ natural_width = widest.width;
|
+ natural_width = widest.width;
|
||||||
+ minimum_height = widest.height;
|
+ minimum_height = widest.height;
|
||||||
+ natural_height = widest.height;
|
+ natural_height = widest.height;
|
||||||
|
+ if (minimum_width <= minimum_height)
|
||||||
|
+ natural_width = minimum_width = minimum_height;
|
||||||
|
+ if (text.length == 1) {
|
||||||
|
+ switch(text.get_char()) {
|
||||||
|
+ case '\t':
|
||||||
|
+ natural_width = minimum_width = minimum_height;
|
||||||
|
+ break;
|
||||||
|
+ case '\v':
|
||||||
|
+ natural_height = minimum_height = minimum_width;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ public override void get_preferred_width(out int minimum_width,
|
+ public override void get_preferred_width(out int minimum_width,
|
||||||
+ out int natural_width) {
|
+ out int natural_width) {
|
||||||
@ -302,12 +321,6 @@ index f3e9f15c..58a26dd6 100644
|
|||||||
+ out natural_height);
|
+ out natural_height);
|
||||||
+ }
|
+ }
|
||||||
+ public override bool draw(Cairo.Context cr) {
|
+ public override bool draw(Cairo.Context cr) {
|
||||||
+ if (m_fontset == null)
|
|
||||||
+ return true;
|
|
||||||
+ if (m_requisition == null)
|
|
||||||
+ return true;
|
|
||||||
+ if (m_requisition.cairo_lines == null)
|
|
||||||
+ return true;
|
|
||||||
+ var style_context = get_style_context();
|
+ var style_context = get_style_context();
|
||||||
+ Gtk.Allocation allocation;
|
+ Gtk.Allocation allocation;
|
||||||
+ get_allocation(out allocation);
|
+ get_allocation(out allocation);
|
||||||
@ -315,6 +328,12 @@ index f3e9f15c..58a26dd6 100644
|
|||||||
+ 0, 0,
|
+ 0, 0,
|
||||||
+ allocation.width,
|
+ allocation.width,
|
||||||
+ allocation.height);
|
+ allocation.height);
|
||||||
|
+ if (m_fontset == null)
|
||||||
|
+ return true;
|
||||||
|
+ if (m_requisition == null)
|
||||||
|
+ return true;
|
||||||
|
+ if (m_requisition.cairo_lines == null)
|
||||||
|
+ return true;
|
||||||
+ Gdk.RGBA *normal_fg = null;
|
+ Gdk.RGBA *normal_fg = null;
|
||||||
+ style_context.get(Gtk.StateFlags.NORMAL,
|
+ style_context.get(Gtk.StateFlags.NORMAL,
|
||||||
+ "color",
|
+ "color",
|
||||||
@ -336,33 +355,29 @@ index f3e9f15c..58a26dd6 100644
|
|||||||
+ normal_fg = null;
|
+ normal_fg = null;
|
||||||
+ return true;
|
+ return true;
|
||||||
+ }
|
+ }
|
||||||
|
+#else
|
||||||
|
public override void get_preferred_width(out int minimum_width,
|
||||||
|
out int natural_width) {
|
||||||
|
if (m_minimum_height == 0 && m_natural_height == 0) {
|
||||||
|
@@ -161,6 +248,7 @@ public class IBusEmojier : Gtk.ApplicationWindow {
|
||||||
|
m_minimum_height = minimum_height;
|
||||||
|
m_natural_height = natural_height;
|
||||||
|
}
|
||||||
+#endif
|
+#endif
|
||||||
}
|
}
|
||||||
- private class ESelectedLabel : Gtk.Label {
|
private class ESelectedLabel : EWhiteLabel {
|
||||||
+ private class ESelectedLabel : EWhiteLabel {
|
|
||||||
public ESelectedLabel(string text) {
|
public ESelectedLabel(string text) {
|
||||||
GLib.Object(
|
@@ -307,6 +395,9 @@ public class IBusEmojier : Gtk.ApplicationWindow {
|
||||||
name : "IBusEmojierSelectedLabel"
|
private static bool m_show_unicode = false;
|
||||||
@@ -116,7 +189,7 @@ class IBusEmojier : Gtk.ApplicationWindow {
|
private static LoadProgressObject m_unicode_progress_object;
|
||||||
set_label(text);
|
private static bool m_loaded_unicode = false;
|
||||||
}
|
|
||||||
}
|
|
||||||
- private class EGoldLabel : Gtk.Label {
|
|
||||||
+ private class EGoldLabel : EWhiteLabel {
|
|
||||||
public EGoldLabel(string text) {
|
|
||||||
GLib.Object(
|
|
||||||
name : "IBusEmojierGoldLabel"
|
|
||||||
@@ -231,6 +304,9 @@ class IBusEmojier : Gtk.ApplicationWindow {
|
|
||||||
m_category_to_emojis_dict;
|
|
||||||
private static GLib.HashTable<string, GLib.SList<string>>?
|
|
||||||
m_emoji_to_emoji_variants_dict;
|
|
||||||
+#if ENABLE_HARFBUZZ_FOR_EMOJI
|
+#if ENABLE_HARFBUZZ_FOR_EMOJI
|
||||||
+ private static IBus.FontSet m_fontset;
|
+ private static IBus.FontSet m_fontset;
|
||||||
+#endif
|
+#endif
|
||||||
|
|
||||||
private ThemedRGBA m_rgba;
|
private ThemedRGBA m_rgba;
|
||||||
private Gtk.Box m_vbox;
|
private Gtk.Box m_vbox;
|
||||||
@@ -1666,6 +1742,22 @@ class IBusEmojier : Gtk.ApplicationWindow {
|
@@ -2064,6 +2155,22 @@ public class IBusEmojier : Gtk.ApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -385,7 +400,7 @@ index f3e9f15c..58a26dd6 100644
|
|||||||
public static bool has_loaded_emoji_dict() {
|
public static bool has_loaded_emoji_dict() {
|
||||||
if (m_emoji_to_data_dict == null)
|
if (m_emoji_to_data_dict == null)
|
||||||
return false;
|
return false;
|
||||||
@@ -1696,6 +1788,10 @@ class IBusEmojier : Gtk.ApplicationWindow {
|
@@ -2094,6 +2201,10 @@ public class IBusEmojier : Gtk.ApplicationWindow {
|
||||||
int font_size = font_desc.get_size() / Pango.SCALE;
|
int font_size = font_desc.get_size() / Pango.SCALE;
|
||||||
if (font_size != 0)
|
if (font_size != 0)
|
||||||
m_emoji_font_size = font_size;
|
m_emoji_font_size = font_size;
|
||||||
@ -1741,5 +1756,5 @@ index 00000000..efcaa286
|
|||||||
+G_END_DECLS
|
+G_END_DECLS
|
||||||
+#endif
|
+#endif
|
||||||
--
|
--
|
||||||
2.13.4
|
2.14.3
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
Name: ibus
|
Name: ibus
|
||||||
Version: 1.5.17
|
Version: 1.5.17
|
||||||
Release: 6%{?dist}
|
Release: 7%{?dist}
|
||||||
Summary: Intelligent Input Bus for Linux OS
|
Summary: Intelligent Input Bus for Linux OS
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
@ -78,6 +78,7 @@ BuildRequires: qt5-qtbase-devel
|
|||||||
%endif
|
%endif
|
||||||
BuildRequires: cldr-emoji-annotation
|
BuildRequires: cldr-emoji-annotation
|
||||||
BuildRequires: unicode-emoji
|
BuildRequires: unicode-emoji
|
||||||
|
BuildRequires: unicode-ucd
|
||||||
%if %with_emoji_harfbuzz
|
%if %with_emoji_harfbuzz
|
||||||
BuildRequires: cairo-devel
|
BuildRequires: cairo-devel
|
||||||
BuildRequires: fontconfig-devel
|
BuildRequires: fontconfig-devel
|
||||||
@ -427,6 +428,9 @@ dconf update || :
|
|||||||
%{_datadir}/gtk-doc/html/*
|
%{_datadir}/gtk-doc/html/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Feb 06 2018 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.17-7
|
||||||
|
- Added Unicode typing on Emojier
|
||||||
|
|
||||||
* Sat Feb 03 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.5.17-6
|
* Sat Feb 03 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.5.17-6
|
||||||
- Switch to %%ldconfig_scriptlets
|
- Switch to %%ldconfig_scriptlets
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user