Lines 13-19
Link Here
|
13 |
#pragma GCC diagnostic push |
13 |
#pragma GCC diagnostic push |
14 |
#pragma GCC diagnostic ignored "-Wunused-parameter" |
14 |
#pragma GCC diagnostic ignored "-Wunused-parameter" |
15 |
#pragma GCC diagnostic ignored "-Wshadow" |
15 |
#pragma GCC diagnostic ignored "-Wshadow" |
16 |
@@ -3913,8 +3907,7 @@ CAMLprim value ml_platform (value unit_v |
16 |
@@ -189,8 +183,8 @@ struct page { |
|
|
17 |
int agen; |
18 |
int pageno; |
19 |
int pdimno; |
20 |
- fz_text_page *text; |
21 |
- fz_text_sheet *sheet; |
22 |
+ fz_stext_page *text; |
23 |
+ fz_stext_sheet *sheet; |
24 |
fz_page *fzpage; |
25 |
fz_display_list *dlist; |
26 |
int slinkcount; |
27 |
@@ -199,7 +193,7 @@ struct page { |
28 |
struct annot *annots; |
29 |
struct mark { |
30 |
int i; |
31 |
- fz_text_span *span; |
32 |
+ fz_stext_span *span; |
33 |
} fmark, lmark; |
34 |
}; |
35 |
|
36 |
@@ -531,10 +525,10 @@ static void freepage (struct page *page) |
37 |
{ |
38 |
if (!page) return; |
39 |
if (page->text) { |
40 |
- fz_drop_text_page (state.ctx, page->text); |
41 |
+ fz_drop_stext_page (state.ctx, page->text); |
42 |
} |
43 |
if (page->sheet) { |
44 |
- fz_drop_text_sheet (state.ctx, page->sheet); |
45 |
+ fz_drop_stext_sheet (state.ctx, page->sheet); |
46 |
} |
47 |
if (page->slinks) { |
48 |
free (page->slinks); |
49 |
@@ -1307,11 +1301,11 @@ static void process_outline (void) |
50 |
} |
51 |
} |
52 |
|
53 |
-static char *strofspan (fz_text_span *span) |
54 |
+static char *strofspan (fz_stext_span *span) |
55 |
{ |
56 |
char *p; |
57 |
char utf8[10]; |
58 |
- fz_text_char *ch; |
59 |
+ fz_stext_char *ch; |
60 |
size_t size = 0, cap = 80; |
61 |
|
62 |
p = malloc (cap + 1); |
63 |
@@ -1332,7 +1326,7 @@ static char *strofspan (fz_text_span *sp |
64 |
return p; |
65 |
} |
66 |
|
67 |
-static int matchspan (regex_t *re, fz_text_span *span, |
68 |
+static int matchspan (regex_t *re, fz_stext_span *span, |
69 |
int stop, int pageno, double start) |
70 |
{ |
71 |
int ret; |
72 |
@@ -1372,8 +1366,8 @@ static int matchspan (regex_t *re, fz_te |
73 |
b = MAX (0, b-1); |
74 |
} |
75 |
|
76 |
- fz_text_char_bbox (state.ctx, &sb, span, a); |
77 |
- fz_text_char_bbox (state.ctx, &eb, span, b); |
78 |
+ fz_stext_char_bbox (state.ctx, &sb, span, a); |
79 |
+ fz_stext_char_bbox (state.ctx, &eb, span, b); |
80 |
|
81 |
p1.x = sb.x0; |
82 |
p1.y = sb.y0; |
83 |
@@ -1411,8 +1405,8 @@ static int matchspan (regex_t *re, fz_te |
84 |
|
85 |
static int compareblocks (const void *l, const void *r) |
86 |
{ |
87 |
- fz_text_block const *ls = l; |
88 |
- fz_text_block const *rs = r; |
89 |
+ fz_stext_block const *ls = l; |
90 |
+ fz_stext_block const *rs = r; |
91 |
return ls->bbox.y0 - rs->bbox.y0; |
92 |
} |
93 |
|
94 |
@@ -1421,8 +1415,8 @@ static void search (regex_t *re, int pag |
95 |
{ |
96 |
int i, j; |
97 |
fz_device *tdev; |
98 |
- fz_text_page *text; |
99 |
- fz_text_sheet *sheet; |
100 |
+ fz_stext_page *text; |
101 |
+ fz_stext_sheet *sheet; |
102 |
struct pagedim *pdim, *pdimprev; |
103 |
int stop = 0, niters = 0; |
104 |
double start, end; |
105 |
@@ -1458,9 +1452,9 @@ static void search (regex_t *re, int pag |
106 |
pdim = pdimprev; |
107 |
found: |
108 |
|
109 |
- sheet = fz_new_text_sheet (state.ctx); |
110 |
- text = fz_new_text_page (state.ctx); |
111 |
- tdev = fz_new_text_device (state.ctx, sheet, text); |
112 |
+ sheet = fz_new_stext_sheet (state.ctx); |
113 |
+ text = fz_new_stext_page (state.ctx); |
114 |
+ tdev = fz_new_stext_device (state.ctx, sheet, text); |
115 |
|
116 |
page = fz_load_page (state.ctx, state.doc, pageno); |
117 |
{ |
118 |
@@ -1474,15 +1468,15 @@ static void search (regex_t *re, int pag |
119 |
for (j = 0; j < text->len; ++j) { |
120 |
int k; |
121 |
fz_page_block *pb; |
122 |
- fz_text_block *block; |
123 |
+ fz_stext_block *block; |
124 |
|
125 |
pb = &text->blocks[forward ? j : text->len - 1 - j]; |
126 |
if (pb->type != FZ_PAGE_BLOCK_TEXT) continue; |
127 |
block = pb->u.text; |
128 |
|
129 |
for (k = 0; k < block->len; ++k) { |
130 |
- fz_text_line *line; |
131 |
- fz_text_span *span; |
132 |
+ fz_stext_line *line; |
133 |
+ fz_stext_span *span; |
134 |
|
135 |
if (forward) { |
136 |
line = &block->lines[k]; |
137 |
@@ -1511,8 +1505,8 @@ static void search (regex_t *re, int pag |
138 |
y = INT_MAX; |
139 |
} |
140 |
endloop: |
141 |
- fz_drop_text_page (state.ctx, text); |
142 |
- fz_drop_text_sheet (state.ctx, sheet); |
143 |
+ fz_drop_stext_page (state.ctx, text); |
144 |
+ fz_drop_stext_sheet (state.ctx, sheet); |
145 |
fz_drop_page (state.ctx, page); |
146 |
} |
147 |
end = now (); |
148 |
@@ -2010,9 +2004,9 @@ static void showsel (struct page *page, |
149 |
int seen = 0; |
150 |
fz_irect bbox; |
151 |
fz_rect rect; |
152 |
- fz_text_line *line; |
153 |
+ fz_stext_line *line; |
154 |
fz_page_block *pageb; |
155 |
- fz_text_block *block; |
156 |
+ fz_stext_block *block; |
157 |
struct mark first, last; |
158 |
unsigned char selcolor[] = {15,15,15,140}; |
159 |
|
160 |
@@ -2036,7 +2030,7 @@ static void showsel (struct page *page, |
161 |
for (line = block->lines; |
162 |
line < block->lines + block->len; |
163 |
++line) { |
164 |
- fz_text_span *span; |
165 |
+ fz_stext_span *span; |
166 |
rect = fz_empty_rect; |
167 |
|
168 |
for (span = line->first_span; span; span = span->next) { |
169 |
@@ -2066,7 +2060,7 @@ static void showsel (struct page *page, |
170 |
for (i = j; i <= k; ++i) { |
171 |
fz_rect bbox1; |
172 |
fz_union_rect (&rect, |
173 |
- fz_text_char_bbox (state.ctx, &bbox1, |
174 |
+ fz_stext_char_bbox (state.ctx, &bbox1, |
175 |
span, i)); |
176 |
} |
177 |
fz_round_rect (&bbox, &rect); |
178 |
@@ -2216,7 +2210,7 @@ static int compareslinks (const void *l, |
179 |
static void droptext (struct page *page) |
180 |
{ |
181 |
if (page->text) { |
182 |
- fz_drop_text_page (state.ctx, page->text); |
183 |
+ fz_drop_stext_page (state.ctx, page->text); |
184 |
page->fmark.i = -1; |
185 |
page->lmark.i = -1; |
186 |
page->fmark.span = NULL; |
187 |
@@ -2224,7 +2218,7 @@ static void droptext (struct page *page) |
188 |
page->text = NULL; |
189 |
} |
190 |
if (page->sheet) { |
191 |
- fz_drop_text_sheet (state.ctx, page->sheet); |
192 |
+ fz_drop_stext_sheet (state.ctx, page->sheet); |
193 |
page->sheet = NULL; |
194 |
} |
195 |
} |
196 |
@@ -2252,7 +2246,7 @@ static void ensureannots (struct page *p |
197 |
|
198 |
for (annot = fz_first_annot (state.ctx, page->fzpage); |
199 |
annot; |
200 |
- annot = fz_next_annot (state.ctx, page->fzpage, annot)) { |
201 |
+ annot = fz_next_annot (state.ctx, annot)) { |
202 |
count++; |
203 |
} |
204 |
|
205 |
@@ -2265,10 +2259,10 @@ static void ensureannots (struct page *p |
206 |
|
207 |
for (annot = fz_first_annot (state.ctx, page->fzpage), i = 0; |
208 |
annot; |
209 |
- annot = fz_next_annot (state.ctx, page->fzpage, annot), i++) { |
210 |
+ annot = fz_next_annot (state.ctx, annot), i++) { |
211 |
fz_rect rect; |
212 |
|
213 |
- fz_bound_annot (state.ctx, page->fzpage, annot, &rect); |
214 |
+ fz_bound_annot (state.ctx, annot, &rect); |
215 |
page->annots[i].annot = annot; |
216 |
fz_round_rect (&page->annots[i].bbox, &rect); |
217 |
} |
218 |
@@ -2325,10 +2319,7 @@ static void ensureslinks (struct page *p |
219 |
} |
220 |
for (j = 0; j < page->annotcount; ++j, ++i) { |
221 |
fz_rect rect; |
222 |
- fz_bound_annot (state.ctx, |
223 |
- page->fzpage, |
224 |
- page->annots[j].annot, |
225 |
- &rect); |
226 |
+ fz_bound_annot (state.ctx, page->annots[j].annot, &rect); |
227 |
fz_transform_rect (&rect, &ctm); |
228 |
fz_round_rect (&page->slinks[i].bbox, &rect); |
229 |
|
230 |
@@ -2647,16 +2638,14 @@ static void ensuretext (struct page *pag |
231 |
fz_matrix ctm; |
232 |
fz_device *tdev; |
233 |
|
234 |
- page->text = fz_new_text_page (state.ctx); |
235 |
- page->sheet = fz_new_text_sheet (state.ctx); |
236 |
- tdev = fz_new_text_device (state.ctx, page->sheet, page->text); |
237 |
+ page->text = fz_new_stext_page (state.ctx); |
238 |
+ page->sheet = fz_new_stext_sheet (state.ctx); |
239 |
+ tdev = fz_new_stext_device (state.ctx, page->sheet, page->text); |
240 |
ctm = pagectm (page); |
241 |
- fz_begin_page (state.ctx, tdev, &fz_infinite_rect, &ctm); |
242 |
fz_run_display_list (state.ctx, page->dlist, |
243 |
tdev, &ctm, &fz_infinite_rect, NULL); |
244 |
qsort (page->text->blocks, page->text->len, |
245 |
sizeof (*page->text->blocks), compareblocks); |
246 |
- fz_end_page (state.ctx, tdev); |
247 |
fz_drop_device (state.ctx, tdev); |
248 |
} |
249 |
} |
250 |
@@ -3049,13 +3038,13 @@ CAMLprim value ml_whatsunder (value ptr_ |
251 |
else { |
252 |
fz_rect *b; |
253 |
fz_page_block *pageb; |
254 |
- fz_text_block *block; |
255 |
+ fz_stext_block *block; |
256 |
|
257 |
ensuretext (page); |
258 |
for (pageb = page->text->blocks; |
259 |
pageb < page->text->blocks + page->text->len; |
260 |
++pageb) { |
261 |
- fz_text_line *line; |
262 |
+ fz_stext_line *line; |
263 |
if (pageb->type != FZ_PAGE_BLOCK_TEXT) continue; |
264 |
block = pageb->u.text; |
265 |
|
266 |
@@ -3066,7 +3055,7 @@ CAMLprim value ml_whatsunder (value ptr_ |
267 |
for (line = block->lines; |
268 |
line < block->lines + block->len; |
269 |
++line) { |
270 |
- fz_text_span *span; |
271 |
+ fz_stext_span *span; |
272 |
|
273 |
b = &line->bbox; |
274 |
if (!(x >= b->x0 && x <= b->x1 && y >= b->y0 && y <= b->y1)) |
275 |
@@ -3081,12 +3070,12 @@ CAMLprim value ml_whatsunder (value ptr_ |
276 |
|
277 |
for (charnum = 0; charnum < span->len; ++charnum) { |
278 |
fz_rect bbox; |
279 |
- fz_text_char_bbox (state.ctx, &bbox, span, charnum); |
280 |
+ fz_stext_char_bbox (state.ctx, &bbox, span, charnum); |
281 |
b = &bbox; |
282 |
|
283 |
if (x >= b->x0 && x <= b->x1 |
284 |
&& y >= b->y0 && y <= b->y1) { |
285 |
- fz_text_style *style = span->text->style; |
286 |
+ fz_stext_style *style = span->text->style; |
287 |
const char *n2 = |
288 |
style->font |
289 |
? style->font->name |
290 |
@@ -3164,9 +3153,9 @@ CAMLprim value ml_markunder (value ptr_v |
291 |
CAMLlocal1 (ret_v); |
292 |
fz_rect *b; |
293 |
struct page *page; |
294 |
- fz_text_line *line; |
295 |
+ fz_stext_line *line; |
296 |
fz_page_block *pageb; |
297 |
- fz_text_block *block; |
298 |
+ fz_stext_block *block; |
299 |
struct pagedim *pdim; |
300 |
int mark = Int_val (mark_v); |
301 |
char *s = String_val (ptr_v); |
302 |
@@ -3242,7 +3231,7 @@ CAMLprim value ml_markunder (value ptr_v |
303 |
for (line = block->lines; |
304 |
line < block->lines + block->len; |
305 |
++line) { |
306 |
- fz_text_span *span; |
307 |
+ fz_stext_span *span; |
308 |
|
309 |
b = &line->bbox; |
310 |
if (!(x >= b->x0 && x <= b->x1 && y >= b->y0 && y <= b->y1)) |
311 |
@@ -3267,7 +3256,7 @@ CAMLprim value ml_markunder (value ptr_v |
312 |
|
313 |
for (charnum = 0; charnum < span->len; ++charnum) { |
314 |
fz_rect bbox; |
315 |
- fz_text_char_bbox (state.ctx, &bbox, span, charnum); |
316 |
+ fz_stext_char_bbox (state.ctx, &bbox, span, charnum); |
317 |
b = &bbox; |
318 |
|
319 |
if (x >= b->x0 && x <= b->x1 && y >= b->y0 && y <= b->y1) { |
320 |
@@ -3383,10 +3372,10 @@ CAMLprim value ml_seltext (value ptr_v, |
321 |
struct pagedim *pdim; |
322 |
char *s = String_val (ptr_v); |
323 |
int i, x0, x1, y0, y1, fi, li; |
324 |
- fz_text_line *line; |
325 |
+ fz_stext_line *line; |
326 |
fz_page_block *pageb; |
327 |
- fz_text_block *block; |
328 |
- fz_text_span *span, *fspan, *lspan; |
329 |
+ fz_stext_block *block; |
330 |
+ fz_stext_span *span, *fspan, *lspan; |
331 |
|
332 |
if (trylock ("ml_seltext")) { |
333 |
goto done; |
334 |
@@ -3426,7 +3415,7 @@ CAMLprim value ml_seltext (value ptr_v, |
335 |
|
336 |
for (span = line->first_span; span; span = span->next) { |
337 |
for (i = 0; i < span->len; ++i) { |
338 |
- fz_text_char_bbox (state.ctx, &b, span, i); |
339 |
+ fz_stext_char_bbox (state.ctx, &b, span, i); |
340 |
|
341 |
if (x0 >= b.x0 && x0 <= b.x1 |
342 |
&& y0 >= b.y0 && y0 <= b.y1) { |
343 |
@@ -3465,7 +3454,7 @@ CAMLprim value ml_seltext (value ptr_v, |
344 |
CAMLreturn (Val_unit); |
345 |
} |
346 |
|
347 |
-static int UNUSED_ATTR pipespan (FILE *f, fz_text_span *span, int a, int b) |
348 |
+static int UNUSED_ATTR pipespan (FILE *f, fz_stext_span *span, int a, int b) |
349 |
{ |
350 |
char buf[4]; |
351 |
int i, len, ret; |
352 |
@@ -3589,9 +3578,9 @@ CAMLprim value ml_copysel (value fd_v, v |
353 |
FILE *f; |
354 |
int seen = 0; |
355 |
struct page *page; |
356 |
- fz_text_line *line; |
357 |
+ fz_stext_line *line; |
358 |
fz_page_block *pageb; |
359 |
- fz_text_block *block; |
360 |
+ fz_stext_block *block; |
361 |
int fd = Int_val (fd_v); |
362 |
char *s = String_val (ptr_v); |
363 |
|
364 |
@@ -3621,7 +3610,7 @@ CAMLprim value ml_copysel (value fd_v, v |
365 |
for (line = block->lines; |
366 |
line < block->lines + block->len; |
367 |
++line) { |
368 |
- fz_text_span *span; |
369 |
+ fz_stext_span *span; |
370 |
|
371 |
for (span = line->first_span; span; span = span->next) { |
372 |
int a, b; |
373 |
@@ -3913,8 +3902,7 @@ CAMLprim value ml_platform (value unit_v |
17 |
platid = pilinux; |
374 |
platid = pilinux; |
18 |
#elif defined __CYGWIN__ |
375 |
#elif defined __CYGWIN__ |
19 |
platid = picygwin; |
376 |
platid = picygwin; |
Lines 23-25
Link Here
|
23 |
platid = pibsd; |
380 |
platid = pibsd; |
24 |
#elif defined __sun__ |
381 |
#elif defined __sun__ |
25 |
platid = pisun; |
382 |
platid = pisun; |
|
|
383 |
@@ -4185,7 +4173,7 @@ CAMLprim value ml_savedoc (value path_v) |
384 |
pdf_document *pdf = pdf_specifics (state.ctx, state.doc); |
385 |
|
386 |
if (pdf) { |
387 |
- pdf_write_document (state.ctx, pdf, String_val (path_v), NULL); |
388 |
+ pdf_save_document (state.ctx, pdf, String_val (path_v), NULL); |
389 |
} |
390 |
CAMLreturn (Val_unit); |
391 |
} |
392 |
@@ -4400,10 +4388,10 @@ CAMLprim value ml_init (value csock_v, v |
393 |
#endif |
394 |
} |
395 |
else { |
396 |
- unsigned int len; |
397 |
- void *base = pdf_lookup_substitute_font (state.ctx, 0, 0, 0, 0, &len); |
398 |
+ int len; |
399 |
+ const char *data = pdf_lookup_substitute_font (state.ctx, 0, 0, 0, 0, &len); |
400 |
|
401 |
- state.face = load_builtin_font (base, len); |
402 |
+ state.face = load_builtin_font (data, len); |
403 |
} |
404 |
if (!state.face) _exit (1); |
405 |
|