summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2015-10-07 17:03:12 +0200
committerTor Andersson <tor.andersson@artifex.com>2015-12-11 12:11:31 +0100
commite3275837d5738c5092b2e452829919e31ad553e5 (patch)
tree0b1ffed536e6887236c4e50cbb808808bbe2684e /platform
parentc22e6a6dc2bf6acbac955bd5fbdd896329dfd725 (diff)
downloadmupdf-e3275837d5738c5092b2e452829919e31ad553e5.tar.xz
Rename structured text structs and functions to 'stext'.
Less risk of confusion with the text type used in the device interface.
Diffstat (limited to 'platform')
-rw-r--r--platform/android/jni/mupdf.c74
-rw-r--r--platform/ios/Classes/MuPageViewNormal.m24
-rw-r--r--platform/ios/Classes/MuPageViewReflow.m18
-rw-r--r--platform/ios/common.m12
-rw-r--r--platform/x11/pdfapp.c26
-rw-r--r--platform/x11/pdfapp.h4
6 files changed, 79 insertions, 79 deletions
diff --git a/platform/android/jni/mupdf.c b/platform/android/jni/mupdf.c
index 72214597..1afd5c65 100644
--- a/platform/android/jni/mupdf.c
+++ b/platform/android/jni/mupdf.c
@@ -1042,36 +1042,36 @@ JNI_FN(MuPDFCore_updatePageInternal)(JNIEnv *env, jobject thiz, jobject bitmap,
}
static int
-charat(fz_context *ctx, fz_text_page *page, int idx)
+charat(fz_context *ctx, fz_stext_page *page, int idx)
{
fz_char_and_box cab;
- return fz_text_char_at(ctx, &cab, page, idx)->c;
+ return fz_stext_char_at(ctx, &cab, page, idx)->c;
}
static fz_rect
-bboxcharat(fz_context *ctx, fz_text_page *page, int idx)
+bboxcharat(fz_context *ctx, fz_stext_page *page, int idx)
{
fz_char_and_box cab;
- return fz_text_char_at(ctx, &cab, page, idx)->bbox;
+ return fz_stext_char_at(ctx, &cab, page, idx)->bbox;
}
static int
-textlen(fz_text_page *page)
+textlen(fz_stext_page *page)
{
int len = 0;
int block_num;
for (block_num = 0; block_num < page->len; block_num++)
{
- fz_text_block *block;
- fz_text_line *line;
+ fz_stext_block *block;
+ fz_stext_line *line;
if (page->blocks[block_num].type != FZ_PAGE_BLOCK_TEXT)
continue;
block = page->blocks[block_num].u.text;
for (line = block->lines; line < block->lines + block->len; line++)
{
- fz_text_span *span;
+ fz_stext_span *span;
for (span = line->first_span; span; span = span->next)
{
@@ -1209,8 +1209,8 @@ JNI_FN(MuPDFCore_searchPage)(JNIEnv * env, jobject thiz, jstring jtext)
jmethodID ctor;
jobjectArray arr;
jobject rect;
- fz_text_sheet *sheet = NULL;
- fz_text_page *text = NULL;
+ fz_stext_sheet *sheet = NULL;
+ fz_stext_page *text = NULL;
fz_device *dev = NULL;
float zoom;
fz_matrix ctm;
@@ -1242,19 +1242,19 @@ JNI_FN(MuPDFCore_searchPage)(JNIEnv * env, jobject thiz, jstring jtext)
zoom = glo->resolution / 72;
fz_scale(&ctm, zoom, zoom);
- sheet = fz_new_text_sheet(ctx);
- text = fz_new_text_page(ctx);
- dev = fz_new_text_device(ctx, sheet, text);
+ sheet = fz_new_stext_sheet(ctx);
+ text = fz_new_stext_page(ctx);
+ dev = fz_new_stext_device(ctx, sheet, text);
fz_run_page(ctx, pc->page, dev, &ctm, NULL);
fz_drop_device(ctx, dev);
dev = NULL;
- hit_count = fz_search_text_page(ctx, text, str, glo->hit_bbox, MAX_SEARCH_HITS);
+ hit_count = fz_search_stext_page(ctx, text, str, glo->hit_bbox, MAX_SEARCH_HITS);
}
fz_always(ctx)
{
- fz_drop_text_page(ctx, text);
- fz_drop_text_sheet(ctx, sheet);
+ fz_drop_stext_page(ctx, text);
+ fz_drop_stext_sheet(ctx, sheet);
fz_drop_device(ctx, dev);
}
fz_catch(ctx)
@@ -1301,8 +1301,8 @@ JNI_FN(MuPDFCore_text)(JNIEnv * env, jobject thiz)
jclass textBlockClass;
jmethodID ctor;
jobjectArray barr = NULL;
- fz_text_sheet *sheet = NULL;
- fz_text_page *text = NULL;
+ fz_stext_sheet *sheet = NULL;
+ fz_stext_page *text = NULL;
fz_device *dev = NULL;
float zoom;
fz_matrix ctm;
@@ -1332,9 +1332,9 @@ JNI_FN(MuPDFCore_text)(JNIEnv * env, jobject thiz)
zoom = glo->resolution / 72;
fz_scale(&ctm, zoom, zoom);
- sheet = fz_new_text_sheet(ctx);
- text = fz_new_text_page(ctx);
- dev = fz_new_text_device(ctx, sheet, text);
+ sheet = fz_new_stext_sheet(ctx);
+ text = fz_new_stext_page(ctx);
+ dev = fz_new_stext_device(ctx, sheet, text);
fz_run_page(ctx, pc->page, dev, &ctm, NULL);
fz_drop_device(ctx, dev);
dev = NULL;
@@ -1344,7 +1344,7 @@ JNI_FN(MuPDFCore_text)(JNIEnv * env, jobject thiz)
for (b = 0; b < text->len; b++)
{
- fz_text_block *block;
+ fz_stext_block *block;
jobjectArray *larr;
if (text->blocks[b].type != FZ_PAGE_BLOCK_TEXT)
@@ -1355,9 +1355,9 @@ JNI_FN(MuPDFCore_text)(JNIEnv * env, jobject thiz)
for (l = 0; l < block->len; l++)
{
- fz_text_line *line = &block->lines[l];
+ fz_stext_line *line = &block->lines[l];
jobjectArray *sarr;
- fz_text_span *span;
+ fz_stext_span *span;
int len = 0;
for (span = line->first_span; span; span = span->next)
@@ -1373,9 +1373,9 @@ JNI_FN(MuPDFCore_text)(JNIEnv * env, jobject thiz)
for (c = 0; c < span->len; c++)
{
- fz_text_char *ch = &span->text[c];
+ fz_stext_char *ch = &span->text[c];
fz_rect bbox;
- fz_text_char_bbox(ctx, &bbox, span, c);
+ fz_stext_char_bbox(ctx, &bbox, span, c);
jobject cobj = (*env)->NewObject(env, textCharClass, ctor, bbox.x0, bbox.y0, bbox.x1, bbox.y1, ch->c);
if (cobj == NULL) fz_throw(ctx, FZ_ERROR_GENERIC, "NewObjectfailed");
@@ -1397,8 +1397,8 @@ JNI_FN(MuPDFCore_text)(JNIEnv * env, jobject thiz)
}
fz_always(ctx)
{
- fz_drop_text_page(ctx, text);
- fz_drop_text_sheet(ctx, sheet);
+ fz_drop_stext_page(ctx, text);
+ fz_drop_stext_sheet(ctx, sheet);
fz_drop_device(ctx, dev);
}
fz_catch(ctx)
@@ -1417,8 +1417,8 @@ JNI_FN(MuPDFCore_text)(JNIEnv * env, jobject thiz)
JNIEXPORT jbyteArray JNICALL
JNI_FN(MuPDFCore_textAsHtml)(JNIEnv * env, jobject thiz)
{
- fz_text_sheet *sheet = NULL;
- fz_text_page *text = NULL;
+ fz_stext_sheet *sheet = NULL;
+ fz_stext_page *text = NULL;
fz_device *dev = NULL;
fz_matrix ctm;
globals *glo = get_globals(env, thiz);
@@ -1440,9 +1440,9 @@ JNI_FN(MuPDFCore_textAsHtml)(JNIEnv * env, jobject thiz)
int b, l, s, c;
ctm = fz_identity;
- sheet = fz_new_text_sheet(ctx);
- text = fz_new_text_page(ctx);
- dev = fz_new_text_device(ctx, sheet, text);
+ sheet = fz_new_stext_sheet(ctx);
+ text = fz_new_stext_page(ctx);
+ dev = fz_new_stext_device(ctx, sheet, text);
fz_run_page(ctx, pc->page, dev, &ctm, NULL);
fz_drop_device(ctx, dev);
dev = NULL;
@@ -1462,10 +1462,10 @@ JNI_FN(MuPDFCore_textAsHtml)(JNIEnv * env, jobject thiz)
//fz_printf(ctx, out, "p{margin:0;padding:0;}\n");
fz_printf(ctx, out, "</style>\n");
fz_printf(ctx, out, "<body style=\"margin:0\"><div style=\"padding:10px\" id=\"content\">");
- fz_print_text_page_html(ctx, out, text);
+ fz_print_stext_page_html(ctx, out, text);
fz_printf(ctx, out, "</div></body>\n");
fz_printf(ctx, out, "<style>\n");
- fz_print_text_sheet(ctx, out, sheet);
+ fz_print_stext_sheet(ctx, out, sheet);
fz_printf(ctx, out, "</style>\n</html>\n");
fz_drop_output(ctx, out);
out = NULL;
@@ -1478,8 +1478,8 @@ JNI_FN(MuPDFCore_textAsHtml)(JNIEnv * env, jobject thiz)
}
fz_always(ctx)
{
- fz_drop_text_page(ctx, text);
- fz_drop_text_sheet(ctx, sheet);
+ fz_drop_stext_page(ctx, text);
+ fz_drop_stext_sheet(ctx, sheet);
fz_drop_device(ctx, dev);
fz_drop_output(ctx, out);
fz_drop_buffer(ctx, buf);
diff --git a/platform/ios/Classes/MuPageViewNormal.m b/platform/ios/Classes/MuPageViewNormal.m
index 429785fe..f82c3413 100644
--- a/platform/ios/Classes/MuPageViewNormal.m
+++ b/platform/ios/Classes/MuPageViewNormal.m
@@ -56,8 +56,8 @@ static NSArray *enumerateAnnotations(fz_document *doc, fz_page *page)
static NSArray *enumerateWords(fz_document *doc, fz_page *page)
{
- fz_text_sheet *sheet = NULL;
- fz_text_page *text = NULL;
+ fz_stext_sheet *sheet = NULL;
+ fz_stext_page *text = NULL;
fz_device *dev = NULL;
NSMutableArray *lns = [NSMutableArray array];
NSMutableArray *wds;
@@ -74,16 +74,16 @@ static NSArray *enumerateWords(fz_document *doc, fz_page *page)
{
int b, l, c;
- sheet = fz_new_text_sheet(ctx);
- text = fz_new_text_page(ctx);
- dev = fz_new_text_device(ctx, sheet, text);
+ sheet = fz_new_stext_sheet(ctx);
+ text = fz_new_stext_page(ctx);
+ dev = fz_new_stext_device(ctx, sheet, text);
fz_run_page(ctx, page, dev, &fz_identity, NULL);
fz_drop_device(ctx, dev);
dev = NULL;
for (b = 0; b < text->len; b++)
{
- fz_text_block *block;
+ fz_stext_block *block;
if (text->blocks[b].type != FZ_PAGE_BLOCK_TEXT)
continue;
@@ -92,8 +92,8 @@ static NSArray *enumerateWords(fz_document *doc, fz_page *page)
for (l = 0; l < block->len; l++)
{
- fz_text_line *line = &block->lines[l];
- fz_text_span *span;
+ fz_stext_line *line = &block->lines[l];
+ fz_stext_span *span;
wds = [NSMutableArray array];
if (!wds)
@@ -107,11 +107,11 @@ static NSArray *enumerateWords(fz_document *doc, fz_page *page)
{
for (c = 0; c < span->len; c++)
{
- fz_text_char *ch = &span->text[c];
+ fz_stext_char *ch = &span->text[c];
fz_rect bbox;
CGRect rect;
- fz_text_char_bbox(ctx, &bbox, span, c);
+ fz_stext_char_bbox(ctx, &bbox, span, c);
rect = CGRectMake(bbox.x0, bbox.y0, bbox.x1 - bbox.x0, bbox.y1 - bbox.y0);
if (ch->c != ' ')
@@ -138,8 +138,8 @@ static NSArray *enumerateWords(fz_document *doc, fz_page *page)
}
fz_always(ctx);
{
- fz_drop_text_page(ctx, text);
- fz_drop_text_sheet(ctx, sheet);
+ fz_drop_stext_page(ctx, text);
+ fz_drop_stext_sheet(ctx, sheet);
fz_drop_device(ctx, dev);
}
fz_catch(ctx)
diff --git a/platform/ios/Classes/MuPageViewReflow.m b/platform/ios/Classes/MuPageViewReflow.m
index 44f4f4ae..2c093fd9 100644
--- a/platform/ios/Classes/MuPageViewReflow.m
+++ b/platform/ios/Classes/MuPageViewReflow.m
@@ -5,8 +5,8 @@ NSString *textAsHtml(fz_document *doc, int pageNum)
{
NSString *str = nil;
fz_page *page = NULL;
- fz_text_sheet *sheet = NULL;
- fz_text_page *text = NULL;
+ fz_stext_sheet *sheet = NULL;
+ fz_stext_page *text = NULL;
fz_device *dev = NULL;
fz_matrix ctm;
fz_buffer *buf = NULL;
@@ -22,9 +22,9 @@ NSString *textAsHtml(fz_document *doc, int pageNum)
fz_try(ctx)
{
ctm = fz_identity;
- sheet = fz_new_text_sheet(ctx);
- text = fz_new_text_page(ctx);
- dev = fz_new_text_device(ctx, sheet, text);
+ sheet = fz_new_stext_sheet(ctx);
+ text = fz_new_stext_page(ctx);
+ dev = fz_new_stext_device(ctx, sheet, text);
page = fz_load_page(ctx, doc, pageNum);
fz_run_page(ctx, page, dev, &ctm, NULL);
fz_drop_device(ctx, dev);
@@ -45,10 +45,10 @@ NSString *textAsHtml(fz_document *doc, int pageNum)
//fz_printf(ctx, out, "p{margin:0;padding:0;}\n");
fz_printf(ctx, out, "</style>\n");
fz_printf(ctx, out, "<body style=\"margin:0\"><div style=\"padding:10px\" id=\"content\">");
- fz_print_text_page_html(ctx, out, text);
+ fz_print_stext_page_html(ctx, out, text);
fz_printf(ctx, out, "</div></body>\n");
fz_printf(ctx, out, "<style>\n");
- fz_print_text_sheet(ctx, out, sheet);
+ fz_print_stext_sheet(ctx, out, sheet);
fz_printf(ctx, out, "</style>\n</html>\n");
out = NULL;
@@ -57,8 +57,8 @@ NSString *textAsHtml(fz_document *doc, int pageNum)
}
fz_always(ctx)
{
- fz_drop_text_page(ctx, text);
- fz_drop_text_sheet(ctx, sheet);
+ fz_drop_stext_page(ctx, text);
+ fz_drop_stext_sheet(ctx, sheet);
fz_drop_device(ctx, dev);
fz_drop_output(ctx, out);
fz_drop_buffer(ctx, buf);
diff --git a/platform/ios/common.m b/platform/ios/common.m
index 6f62329a..6ee3653f 100644
--- a/platform/ios/common.m
+++ b/platform/ios/common.m
@@ -21,16 +21,16 @@ int search_page(fz_document *doc, int number, char *needle, fz_cookie *cookie)
{
fz_page *page = fz_load_page(ctx, doc, number);
- fz_text_sheet *sheet = fz_new_text_sheet(ctx);
- fz_text_page *text = fz_new_text_page(ctx);
- fz_device *dev = fz_new_text_device(ctx, sheet, text);
+ fz_stext_sheet *sheet = fz_new_stext_sheet(ctx);
+ fz_stext_page *text = fz_new_stext_page(ctx);
+ fz_device *dev = fz_new_stext_device(ctx, sheet, text);
fz_run_page(ctx, page, dev, &fz_identity, cookie);
fz_drop_device(ctx, dev);
- hit_count = fz_search_text_page(ctx, text, needle, hit_bbox, nelem(hit_bbox));
+ hit_count = fz_search_stext_page(ctx, text, needle, hit_bbox, nelem(hit_bbox));
- fz_drop_text_page(ctx, text);
- fz_drop_text_sheet(ctx, sheet);
+ fz_drop_stext_page(ctx, text);
+ fz_drop_stext_sheet(ctx, sheet);
fz_drop_page(ctx, page);
return hit_count;
diff --git a/platform/x11/pdfapp.c b/platform/x11/pdfapp.c
index 5a036d04..be8ab751 100644
--- a/platform/x11/pdfapp.c
+++ b/platform/x11/pdfapp.c
@@ -479,10 +479,10 @@ void pdfapp_close(pdfapp_t *app)
fz_drop_display_list(app->ctx, app->annotations_list);
app->annotations_list = NULL;
- fz_drop_text_page(app->ctx, app->page_text);
+ fz_drop_stext_page(app->ctx, app->page_text);
app->page_text = NULL;
- fz_drop_text_sheet(app->ctx, app->page_sheet);
+ fz_drop_stext_sheet(app->ctx, app->page_sheet);
app->page_sheet = NULL;
fz_drop_link(app->ctx, app->page_links);
@@ -660,8 +660,8 @@ static void pdfapp_loadpage(pdfapp_t *app, int no_cache)
fz_drop_display_list(app->ctx, app->page_list);
fz_drop_display_list(app->ctx, app->annotations_list);
- fz_drop_text_page(app->ctx, app->page_text);
- fz_drop_text_sheet(app->ctx, app->page_sheet);
+ fz_drop_stext_page(app->ctx, app->page_text);
+ fz_drop_stext_sheet(app->ctx, app->page_sheet);
fz_drop_link(app->ctx, app->page_links);
fz_drop_page(app->ctx, app->page);
@@ -879,12 +879,12 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage, int repai
app->hit_count = 0;
/* Extract text */
- app->page_sheet = fz_new_text_sheet(app->ctx);
- app->page_text = fz_new_text_page(app->ctx);
+ app->page_sheet = fz_new_stext_sheet(app->ctx);
+ app->page_text = fz_new_stext_page(app->ctx);
if (app->page_list || app->annotations_list)
{
- tdev = fz_new_text_device(app->ctx, app->page_sheet, app->page_text);
+ tdev = fz_new_stext_device(app->ctx, app->page_sheet, app->page_text);
pdfapp_runpage(app, tdev, &fz_identity, &fz_infinite_rect, &cookie);
fz_drop_device(app->ctx, tdev);
}
@@ -1060,7 +1060,7 @@ static void pdfapp_search_in_direction(pdfapp_t *app, enum panning *panto, int d
pdfapp_showpage(app, 1, 0, 0, 0, 1);
}
- app->hit_count = fz_search_text_page(app->ctx, app->page_text, app->search, app->hit_bbox, nelem(app->hit_bbox));
+ app->hit_count = fz_search_stext_page(app->ctx, app->page_text, app->search, app->hit_bbox, nelem(app->hit_bbox));
if (app->hit_count > 0)
{
*panto = dir == 1 ? PAN_TO_TOP : PAN_TO_BOTTOM;
@@ -1884,7 +1884,7 @@ void pdfapp_oncopy(pdfapp_t *app, unsigned short *ucsbuf, int ucslen)
{
fz_rect hitbox;
fz_matrix ctm;
- fz_text_page *page = app->page_text;
+ fz_stext_page *page = app->page_text;
int c, i, p, need_newline;
int block_num;
@@ -1900,9 +1900,9 @@ void pdfapp_oncopy(pdfapp_t *app, unsigned short *ucsbuf, int ucslen)
for (block_num = 0; block_num < page->len; block_num++)
{
- fz_text_line *line;
- fz_text_block *block;
- fz_text_span *span;
+ fz_stext_line *line;
+ fz_stext_block *block;
+ fz_stext_span *span;
if (page->blocks[block_num].type != FZ_PAGE_BLOCK_TEXT)
continue;
@@ -1916,7 +1916,7 @@ void pdfapp_oncopy(pdfapp_t *app, unsigned short *ucsbuf, int ucslen)
{
for (i = 0; i < span->len; i++)
{
- fz_text_char_bbox(app->ctx, &hitbox, span, i);
+ fz_stext_char_bbox(app->ctx, &hitbox, span, i);
fz_transform_rect(&hitbox, &ctm);
c = span->text[i].c;
if (c < 32)
diff --git a/platform/x11/pdfapp.h b/platform/x11/pdfapp.h
index 6a81f871..803ca351 100644
--- a/platform/x11/pdfapp.h
+++ b/platform/x11/pdfapp.h
@@ -86,8 +86,8 @@ struct pdfapp_s
fz_rect page_bbox;
fz_display_list *page_list;
fz_display_list *annotations_list;
- fz_text_page *page_text;
- fz_text_sheet *page_sheet;
+ fz_stext_page *page_text;
+ fz_stext_sheet *page_sheet;
fz_link *page_links;
int errored;
int incomplete;