From 4fc3c0324e080c3df7455a9ba8fcb60d6baba7eb Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Mon, 27 May 2013 12:53:03 +0100 Subject: Treat multiple whitespace in search strings as single. Skip over successive whitespace in search string. Make android use text_search.c --- android/jni/mupdf.c | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) (limited to 'android/jni') diff --git a/android/jni/mupdf.c b/android/jni/mupdf.c index 47196840..514bdde4 100644 --- a/android/jni/mupdf.c +++ b/android/jni/mupdf.c @@ -953,25 +953,6 @@ textlen(fz_text_page *page) return len; } -static int -match(fz_text_page *page, const char *s, int n) -{ - int orig = n; - int c; - while (*s) { - s += fz_chartorune(&c, (char *)s); - if (c == ' ' && charat(page, n) == ' ') { - while (charat(page, n) == ' ') - n++; - } else { - if (tolower(c) != tolower(charat(page, n))) - return 0; - n++; - } - } - return n - orig; -} - static int countOutlineItems(fz_outline *outline) { @@ -1138,20 +1119,7 @@ JNI_FN(MuPDFCore_searchPage)(JNIEnv * env, jobject thiz, jstring jtext) fz_free_device(dev); dev = NULL; - len = textlen(text); - for (pos = 0; pos < len; pos++) - { - fz_rect rr = fz_empty_rect; - n = match(text, str, pos); - for (i = 0; i < n; i++) - { - fz_rect bbox = bboxcharat(text, pos + i); - fz_union_rect(&rr, &bbox); - } - - if (!fz_is_empty_rect(&rr) && hit_count < MAX_SEARCH_HITS) - glo->hit_bbox[hit_count++] = rr; - } + hit_count = fz_search_text_page(ctx, text, str, glo->hit_bbox, MAX_SEARCH_HITS); } fz_always(ctx) { -- cgit v1.2.3