[evince/58-search-is-accentuation-mark-sensitive] pdf backend: Ignore diacritics when searching text



commit 696b6bc691fd9a243997ef9cc6a1ceb4e82f54e6
Author: Nelson Benítez León <nbenitezl gmail com>
Date:   Sat Sep 15 13:31:39 2018 +0100

    pdf backend: Ignore diacritics when searching text
    
    Ignore diacritics (accents, umlauts, diaeresis, etc.)
    when searching in case insensitive mode (default mode), as
    that would broaden the search giving more expected results.
    
    Relevant flag was added in Poppler 0.73 and was implemented
    in https://gitlab.freedesktop.org/poppler/poppler/issues/637
    
    Issue #58

 backend/pdf/ev-poppler.cc | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/backend/pdf/ev-poppler.cc b/backend/pdf/ev-poppler.cc
index 32ca1dfe..2b8c9a67 100644
--- a/backend/pdf/ev-poppler.cc
+++ b/backend/pdf/ev-poppler.cc
@@ -1960,6 +1960,11 @@ pdf_document_find_find_text_with_options (EvDocumentFind *document_find,
 
        if (options & EV_FIND_CASE_SENSITIVE)
                find_flags |= POPPLER_FIND_CASE_SENSITIVE;
+#if POPPLER_CHECK_VERSION(0, 73, 0)
+       else    /* When search is not case sensitive, do also ignore diacritics
+               to broaden our search in order to match on more expected results */
+               find_flags |= POPPLER_FIND_IGNORE_DIACRITICS;
+#endif
        if (options & EV_FIND_WHOLE_WORDS_ONLY)
                find_flags |= POPPLER_FIND_WHOLE_WORDS_ONLY;
        matches = poppler_page_find_text_with_options (poppler_page, text, (PopplerFindFlags)find_flags);


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