diff options
author | Robin Watts <robin.watts@artifex.com> | 2013-05-27 12:53:03 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2013-05-27 14:02:07 +0100 |
commit | 4fc3c0324e080c3df7455a9ba8fcb60d6baba7eb (patch) | |
tree | a8ee8ed65a8ff19de431cfead76244e982c318d3 /android/jni | |
parent | 868a21fe07d4ac760a3bc429edefe860b8255b6d (diff) | |
download | mupdf-4fc3c0324e080c3df7455a9ba8fcb60d6baba7eb.tar.xz |
Treat multiple whitespace in search strings as single.
Skip over successive whitespace in search string.
Make android use text_search.c
Diffstat (limited to 'android/jni')
-rw-r--r-- | android/jni/mupdf.c | 34 |
1 files changed, 1 insertions, 33 deletions
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 @@ -954,25 +954,6 @@ textlen(fz_text_page *page) } 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) { int count = 0; @@ -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) { |