| line |
true |
false |
branch |
|
25
|
0 |
2518 |
if (!o) return fallback; |
|
26
|
2518 |
0 |
if (o->kind == PDFMAKE_INT) return (int16_t)o->as.i; |
|
27
|
0 |
0 |
if (o->kind == PDFMAKE_REAL) return (int16_t)o->as.r; |
|
32
|
0 |
90 |
if (!o) return fallback; |
|
33
|
90 |
0 |
if (o->kind == PDFMAKE_INT) return (int32_t)o->as.i; |
|
34
|
0 |
0 |
if (o->kind == PDFMAKE_REAL) return (int32_t)o->as.r; |
|
52
|
0 |
0 |
if (!descriptor || descriptor->kind != PDFMAKE_DICT) return; |
|
|
0 |
0 |
if (!descriptor || descriptor->kind != PDFMAKE_DICT) return; |
|
66
|
0 |
0 |
if (mw) out->default_width = int_of(mw, out->default_width); |
|
98
|
45 |
0 |
if (!font_dict || font_dict->kind != PDFMAKE_DICT || !arena) return -1; |
|
|
45 |
0 |
if (!font_dict || font_dict->kind != PDFMAKE_DICT || !arena) return -1; |
|
|
0 |
45 |
if (!font_dict || font_dict->kind != PDFMAKE_DICT || !arena) return -1; |
|
107
|
45 |
0 |
if (fd && fd->kind == PDFMAKE_DICT) { |
|
|
0 |
45 |
if (fd && fd->kind == PDFMAKE_DICT) { |
|
115
|
45 |
0 |
if (!first || !last || !widths) return -1; |
|
|
45 |
0 |
if (!first || !last || !widths) return -1; |
|
|
0 |
45 |
if (!first || !last || !widths) return -1; |
|
116
|
0 |
45 |
if (widths->kind != PDFMAKE_ARRAY) return -1; |
|
120
|
45 |
0 |
if (fc < 0 || lc < fc || fc > 0xFFFF || lc > 0xFFFF) return -1; |
|
|
45 |
0 |
if (fc < 0 || lc < fc || fc > 0xFFFF || lc > 0xFFFF) return -1; |
|
|
45 |
0 |
if (fc < 0 || lc < fc || fc > 0xFFFF || lc > 0xFFFF) return -1; |
|
|
0 |
45 |
if (fc < 0 || lc < fc || fc > 0xFFFF || lc > 0xFFFF) return -1; |
|
124
|
0 |
45 |
if (have < n) n = have; |
|
127
|
0 |
45 |
if (!table) return -1; |
|
129
|
2518 |
45 |
for (i = 0; i < n; i++) { |
|
153
|
0 |
0 |
if (*count >= *cap) { |
|
154
|
0 |
0 |
size_t new_cap = *cap ? *cap * 2 : 16; |
|
157
|
0 |
0 |
if (!n) return -1; |
|
158
|
0 |
0 |
if (*list && *count > 0) { |
|
|
0 |
0 |
if (*list && *count > 0) { |
|
174
|
0 |
0 |
if (ra->lo < rb->lo) return -1; |
|
175
|
0 |
0 |
if (ra->lo > rb->lo) return 1; |
|
187
|
0 |
0 |
if (!w_arr || w_arr->kind != PDFMAKE_ARRAY) return -1; |
|
|
0 |
0 |
if (!w_arr || w_arr->kind != PDFMAKE_ARRAY) return -1; |
|
194
|
0 |
0 |
while (i < n) { |
|
198
|
0 |
0 |
if (fc < 0 || i >= n) break; |
|
|
0 |
0 |
if (fc < 0 || i >= n) break; |
|
201
|
0 |
0 |
if (!next) break; |
|
203
|
0 |
0 |
if (next->kind == PDFMAKE_ARRAY) { |
|
209
|
0 |
0 |
for (j = 0; j < m; j++) { |
|
211
|
0 |
0 |
if (add_range(arena, &list, &count, &cap, |
|
221
|
0 |
0 |
if (lc < fc) lc = fc; |
|
222
|
0 |
0 |
if (i + 1 >= n) break; |
|
224
|
0 |
0 |
if (add_range(arena, &list, &count, &cap, |
|
232
|
0 |
0 |
if (count > 1) qsort(list, count, sizeof(*list), range_cmp); |
|
256
|
1 |
0 |
if (!font_dict || font_dict->kind != PDFMAKE_DICT || !arena) return -1; |
|
|
1 |
0 |
if (!font_dict || font_dict->kind != PDFMAKE_DICT || !arena) return -1; |
|
|
0 |
1 |
if (!font_dict || font_dict->kind != PDFMAKE_DICT || !arena) return -1; |
|
261
|
1 |
0 |
if (desc_arr && desc_arr->kind == PDFMAKE_ARRAY && pdfmake_array_len(desc_arr) > 0) { |
|
|
1 |
0 |
if (desc_arr && desc_arr->kind == PDFMAKE_ARRAY && pdfmake_array_len(desc_arr) > 0) { |
|
|
1 |
0 |
if (desc_arr && desc_arr->kind == PDFMAKE_ARRAY && pdfmake_array_len(desc_arr) > 0) { |
|
264
|
0 |
1 |
if (!cidfont) cidfont = font_dict; /* Might already be the CIDFont */ |
|
265
|
1 |
0 |
if (cidfont->kind != PDFMAKE_DICT) return -1; |
|
272
|
0 |
0 |
if (dw) out->default_width = int_of(dw, out->default_width); |
|
275
|
0 |
0 |
if (fd && fd->kind == PDFMAKE_DICT) { |
|
|
0 |
0 |
if (fd && fd->kind == PDFMAKE_DICT) { |
|
280
|
0 |
0 |
if (w_arr) parse_w_array(arena, w_arr, out); |
|
292
|
0 |
12698 |
if (!w) return 0; |
|
295
|
12692 |
6 |
if (w->table && code >= w->first_char && code <= w->last_char) { |
|
|
12692 |
0 |
if (w->table && code >= w->first_char && code <= w->last_char) { |
|
|
12692 |
0 |
if (w->table && code >= w->first_char && code <= w->last_char) { |
|
297
|
12692 |
0 |
if (v != 0) return v; |
|
301
|
0 |
6 |
if (w->ranges && w->range_count > 0) { |
|
|
0 |
0 |
if (w->ranges && w->range_count > 0) { |
|
304
|
0 |
0 |
while (lo < hi) { |
|
306
|
0 |
0 |
if (w->ranges[mid].lo <= code) lo = mid + 1; |
|
309
|
0 |
0 |
if (lo > 0) { |
|
311
|
0 |
0 |
if (code >= r->lo && code <= r->hi) return r->width; |
|
|
0 |
0 |
if (code >= r->lo && code <= r->hi) return r->width; |
|
333
|
0 |
0 |
if (!descriptor || descriptor->kind != PDFMAKE_DICT) return -1; |
|
|
0 |
0 |
if (!descriptor || descriptor->kind != PDFMAKE_DICT) return -1; |
|
338
|
0 |
0 |
if (!ref) ref = pdfmake_dict_get(descriptor, ff3_k); |
|
339
|
0 |
0 |
if (!ref || ref->kind != PDFMAKE_REF) return -1; |
|
|
0 |
0 |
if (!ref || ref->kind != PDFMAKE_REF) return -1; |
|
343
|
0 |
0 |
? 0 : -1; |
|
368
|
0 |
0 |
if (!m) { *out_is_identity = 1; return NULL; } |
|
370
|
0 |
0 |
if (m->kind == PDFMAKE_NAME) { |
|
376
|
0 |
0 |
if (m->kind != PDFMAKE_REF) return NULL; |
|
378
|
0 |
0 |
if (pdfmake_buf_init(&buf) != PDFMAKE_OK) return NULL; |
|
379
|
0 |
0 |
if (pdfmake_reader_resolve_stream(reader, m->as.ref.num, m->as.ref.gen, &buf) |
|
387
|
0 |
0 |
if (count == 0) { pdfmake_buf_free(&buf); return NULL; } |
|
390
|
0 |
0 |
if (!map) { pdfmake_buf_free(&buf); return NULL; } |
|
393
|
0 |
0 |
for (i = 0; i < count; i++) { |
|
415
|
46 |
0 |
if (!arena || !reader || !font_dict || !out) return -1; |
|
|
46 |
0 |
if (!arena || !reader || !font_dict || !out) return -1; |
|
|
46 |
0 |
if (!arena || !reader || !font_dict || !out) return -1; |
|
|
0 |
46 |
if (!arena || !reader || !font_dict || !out) return -1; |
|
420
|
1 |
45 |
if (is_cid) { |
|
423
|
1 |
0 |
if (df_arr && df_arr->kind == PDFMAKE_ARRAY && |
|
426
|
1 |
0 |
if (cidfont && cidfont->kind == PDFMAKE_DICT) { |
|
|
0 |
1 |
if (cidfont && cidfont->kind == PDFMAKE_DICT) { |
|
434
|
45 |
1 |
if (!descriptor || descriptor->kind != PDFMAKE_DICT) return -1; |
|
|
45 |
0 |
if (!descriptor || descriptor->kind != PDFMAKE_DICT) return -1; |
|
436
|
0 |
0 |
if (pdfmake_buf_init(&ttf_buf) != PDFMAKE_OK) return -1; |
|
437
|
0 |
0 |
if (fetch_font_file_stream(reader, arena, descriptor, &ttf_buf) != 0) { |
|
447
|
0 |
0 |
if (!ttf) { |
|
453
|
0 |
0 |
if (ttf->has_os2 && ttf->units_per_em) { |
|
|
0 |
0 |
if (ttf->has_os2 && ttf->units_per_em) { |
|
456
|
0 |
0 |
if (ttf->s_cap_height) |
|
458
|
0 |
0 |
if (ttf->s_x_height) |
|
460
|
0 |
0 |
} else if (ttf->units_per_em) { |
|
465
|
0 |
0 |
if (is_cid) { |
|
480
|
0 |
0 |
if (is_identity) { |
|
483
|
0 |
0 |
if (!is_identity && !cidmap) { |
|
|
0 |
0 |
if (!is_identity && !cidmap) { |
|
496
|
0 |
0 |
if (!merged) { pdfmake_buf_free(&ttf_buf); return 0; } |
|
498
|
0 |
0 |
if (out->ranges && out->range_count) |
|
|
0 |
0 |
if (out->ranges && out->range_count) |
|
502
|
0 |
0 |
for (cid = 0; cid < cid_count; cid++) { |
|
503
|
0 |
0 |
uint16_t gid = is_identity ? (uint16_t)cid : cidmap[cid]; |
|
507
|
0 |
0 |
if (gid == 0) continue; |
|
509
|
0 |
0 |
if (w == 0) continue; |
|
513
|
0 |
0 |
for (j = 0; j < out->range_count; j++) { |
|
514
|
0 |
0 |
if (cid >= out->ranges[j].lo && cid <= out->ranges[j].hi) { |
|
|
0 |
0 |
if (cid >= out->ranges[j].lo && cid <= out->ranges[j].hi) { |
|
519
|
0 |
0 |
if (covered) continue; |
|
528
|
0 |
0 |
if (out_count > 1) { |
|
545
|
0 |
0 |
if (!byte_to_unicode) { |
|
553
|
0 |
0 |
tbl_len = table ? (size_t)(last - first + 1) : 0; |
|
556
|
0 |
0 |
if (!table) { |
|
558
|
0 |
0 |
if (!table) { pdfmake_buf_free(&ttf_buf); return 0; } |
|
563
|
0 |
0 |
} else if (first > 0 || last < 255) { |
|
|
0 |
0 |
} else if (first > 0 || last < 255) { |
|
567
|
0 |
0 |
if (!expanded) { pdfmake_buf_free(&ttf_buf); return 0; } |
|
569
|
0 |
0 |
for (i = 0; i < tbl_len; i++) |
|
578
|
0 |
0 |
for (code = 0; code < 256; code++) { |
|
582
|
0 |
0 |
if (table[code] != 0) continue; /* honour PDF /Widths */ |
|
584
|
0 |
0 |
if (uni == 0) continue; |
|
586
|
0 |
0 |
if (gid == 0) continue; |
|
588
|
0 |
0 |
if (w == 0) continue; |