summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2013-05-27 12:53:03 +0100
committerRobin Watts <robin.watts@artifex.com>2013-05-27 14:02:07 +0100
commit4fc3c0324e080c3df7455a9ba8fcb60d6baba7eb (patch)
treea8ee8ed65a8ff19de431cfead76244e982c318d3 /android
parent868a21fe07d4ac760a3bc429edefe860b8255b6d (diff)
downloadmupdf-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')
-rw-r--r--android/jni/mupdf.c34
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)
{