[poppler] glib/demo

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 12 23:39:14 UTC 2021


 glib/demo/selections.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 282b9ea0c0db18ed8177e2123996569d232c12a0
Author: Nelson Benítez León <nbenitezl at gmail.com>
Date:   Fri Feb 12 11:47:38 2021 -0400

    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

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);
     }


More information about the poppler mailing list