[evince/gnome-3-38] keep same visual appearance between displayed and copied text



commit cb9d48855ee24e7f868bc0db303bcc887e0c71ff
Author: Nelson Benítez León <nbenitezl gmail com>
Date:   Fri Feb 12 01:25:16 2021 -0400

    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 #1085

 libview/ev-view.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/libview/ev-view.c b/libview/ev-view.c
index bff7aa1d..219d1ccc 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -10107,7 +10107,10 @@ get_selected_text (EvView *view)
 
        ev_document_doc_mutex_unlock ();
        
-       normalized_text = g_utf8_normalize (text->str, text->len, 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 #1085 */
+       normalized_text = g_utf8_normalize (text->str, text->len, G_NORMALIZE_NFC);
        g_string_free (text, TRUE);
        return normalized_text;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]