summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/java/mupdf_native.c2
-rw-r--r--platform/win32/libmupdf.vcproj4
-rw-r--r--platform/x11/pdfapp.c61
-rw-r--r--platform/x11/pdfapp.h1
4 files changed, 22 insertions, 46 deletions
diff --git a/platform/java/mupdf_native.c b/platform/java/mupdf_native.c
index bed3358d..ce5e6fea 100644
--- a/platform/java/mupdf_native.c
+++ b/platform/java/mupdf_native.c
@@ -5111,8 +5111,6 @@ FUN(Page_textAsHtml)(JNIEnv *env, jobject self)
fz_run_page(ctx, page, dev, &ctm, NULL);
fz_close_device(ctx, dev);
- fz_analyze_text(ctx, sheet, text);
-
buf = fz_new_buffer(ctx, 256);
out = fz_new_output_with_buffer(ctx, buf);
fz_write_printf(ctx, out, "<html>\n");
diff --git a/platform/win32/libmupdf.vcproj b/platform/win32/libmupdf.vcproj
index fc195fce..3add80ed 100644
--- a/platform/win32/libmupdf.vcproj
+++ b/platform/win32/libmupdf.vcproj
@@ -1869,10 +1869,6 @@
>
</File>
<File
- RelativePath="..\..\source\fitz\stext-paragraph.c"
- >
- </File>
- <File
RelativePath="..\..\source\fitz\stext-search.c"
>
</File>
diff --git a/platform/x11/pdfapp.c b/platform/x11/pdfapp.c
index 61366a44..6b08c4aa 100644
--- a/platform/x11/pdfapp.c
+++ b/platform/x11/pdfapp.c
@@ -470,9 +470,6 @@ void pdfapp_close(pdfapp_t *app)
fz_drop_stext_page(app->ctx, app->page_text);
app->page_text = NULL;
- fz_drop_stext_sheet(app->ctx, app->page_sheet);
- app->page_sheet = NULL;
-
fz_drop_link(app->ctx, app->page_links);
app->page_links = NULL;
@@ -655,14 +652,12 @@ 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_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);
app->page_list = NULL;
app->annotations_list = NULL;
app->page_text = NULL;
- app->page_sheet = NULL;
app->page_links = NULL;
app->page = NULL;
app->page_bbox.x0 = 0;
@@ -875,12 +870,11 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage, int repai
app->hit_count = 0;
/* Extract text */
- app->page_sheet = fz_new_stext_sheet(app->ctx);
app->page_text = fz_new_stext_page(app->ctx, fz_bound_page(app->ctx, app->page, &mediabox));
if (app->page_list || app->annotations_list)
{
- tdev = fz_new_stext_device(app->ctx, app->page_sheet, app->page_text, NULL);
+ tdev = fz_new_stext_device(app->ctx, app->page_text, NULL);
pdfapp_runpage(app, tdev, &fz_identity, &fz_infinite_rect, &cookie);
fz_close_device(app->ctx, tdev);
fz_drop_device(app->ctx, tdev);
@@ -1905,8 +1899,10 @@ void pdfapp_oncopy(pdfapp_t *app, unsigned short *ucsbuf, int ucslen)
fz_rect hitbox;
fz_matrix ctm;
fz_stext_page *page = app->page_text;
- int c, i, p, need_newline;
- int block_num;
+ int p, need_newline;
+ fz_stext_block *block;
+ fz_stext_line *line;
+ fz_stext_char *ch;
int x0 = app->selr.x0;
int x1 = app->selr.x1;
@@ -1918,50 +1914,37 @@ void pdfapp_oncopy(pdfapp_t *app, unsigned short *ucsbuf, int ucslen)
p = 0;
need_newline = 0;
- for (block_num = 0; block_num < page->len; block_num++)
+ for (block = page->first_block; block; block = block->next)
{
- fz_stext_line *line;
- fz_stext_block *block;
- fz_stext_span *span;
-
- if (page->blocks[block_num].type != FZ_PAGE_BLOCK_TEXT)
+ if (block->type != FZ_STEXT_BLOCK_TEXT)
continue;
- block = page->blocks[block_num].u.text;
- for (line = block->lines; line < block->lines + block->len; line++)
+ for (line = block->u.t.first_line; line; line = line->next)
{
int saw_text = 0;
-
- for (span = line->first_span; span; span = span->next)
+ for (ch = line->first_char; ch; ch = ch->next)
{
- for (i = 0; i < span->len; i++)
+ int c = ch->c;
+ fz_stext_char_bbox(app->ctx, &hitbox, line, ch);
+ if (c < 32)
+ c = 0xFFFD;
+ if (hitbox.x1 >= x0 && hitbox.x0 <= x1 && hitbox.y1 >= y0 && hitbox.y0 <= y1)
{
- fz_stext_char_bbox(app->ctx, &hitbox, span, i);
- fz_transform_rect(&hitbox, &ctm);
- c = span->text[i].c;
- if (c < 32)
- c = '?';
- if (hitbox.x1 >= x0 && hitbox.x0 <= x1 && hitbox.y1 >= y0 && hitbox.y0 <= y1)
+ saw_text = 1;
+ if (need_newline)
{
- saw_text = 1;
-
- if (need_newline)
- {
#if defined(_WIN32) || defined(_WIN64)
- if (p < ucslen - 1)
- ucsbuf[p++] = '\r';
+ if (p < ucslen - 1)
+ ucsbuf[p++] = '\r';
#endif
- if (p < ucslen - 1)
- ucsbuf[p++] = '\n';
- need_newline = 0;
- }
-
if (p < ucslen - 1)
- ucsbuf[p++] = c;
+ ucsbuf[p++] = '\n';
+ need_newline = 0;
}
+ if (p < ucslen - 1)
+ ucsbuf[p++] = c;
}
}
-
if (saw_text)
need_newline = 1;
}
diff --git a/platform/x11/pdfapp.h b/platform/x11/pdfapp.h
index 28a83481..09d8f16a 100644
--- a/platform/x11/pdfapp.h
+++ b/platform/x11/pdfapp.h
@@ -91,7 +91,6 @@ struct pdfapp_s
fz_display_list *page_list;
fz_display_list *annotations_list;
fz_stext_page *page_text;
- fz_stext_sheet *page_sheet;
fz_link *page_links;
int errored;
int incomplete;