summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNelson Benítez León <nbenitezl@gmail.com>2021-02-12 11:47:38 -0400
committerAlbert Astals Cid <tsdgeos@yahoo.es>2021-02-12 23:33:09 +0000
commit282b9ea0c0db18ed8177e2123996569d232c12a0 (patch)
tree55e9e239cc8735940f94bb04a53450e30940d635
parent2e62feafbc5095cedf948aefdf771d328d978de9 (diff)
glib: keep same visual appearance between displayed and copied text
When copying text from displayed document to the clipboard, we want a normalization that preserves 'canonical equivalence' i.e. that the text after normalization is not visually different than the original text. Our previous normalization was just preserving unicode 'compatibility'. Relevant documentation: * https://www.win.tue.nl/~aeb/linux/uc/nfc_vs_nfd.html * https://en.wikipedia.org/wiki/Unicode_equivalence * https://developer.gnome.org/glib/stable/glib-Unicode-Manipulation.html#g-utf8-normalize Issue #724
-rw-r--r--glib/demo/selections.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/glib/demo/selections.c b/glib/demo/selections.c
index 0a52572e..9c878e5d 100644
--- a/glib/demo/selections.c
+++ b/glib/demo/selections.c
@@ -133,7 +133,10 @@ static void pgd_selections_update_selected_text(PgdSelectionsDemo *demo)
text = poppler_page_get_selected_text(demo->page, demo->style, &demo->doc_area);
if (text) {
- demo->selected_text = g_utf8_normalize(text, -1, G_NORMALIZE_NFKC);
+ /* For copying text from the document to the clipboard, we want a normalization
+ * that preserves 'canonical equivalence' i.e. that text after normalization
+ * is not visually different than the original text. Issue #724 */
+ demo->selected_text = g_utf8_normalize(text, -1, G_NORMALIZE_NFC);
g_free(text);
gtk_widget_set_sensitive(demo->copy_button, TRUE);
}