| 1 |
|
| /* |
| 2 |
|
| * pdfmake_content.c — Content stream builder implementation. |
| 3 |
|
| * |
| 4 |
|
| * Implements all PDF content stream operators per Annex A. |
| 5 |
|
| * Each function appends the operator with its operands to a buffer. |
| 6 |
|
| */ |
| 7 |
|
| |
| 8 |
|
| #include "pdfmake_content.h" |
| 9 |
|
| #include "pdfmake_writer.h" |
| 10 |
|
| #include <stdlib.h> |
| 11 |
|
| #include <string.h> |
| 12 |
|
| #include <stdio.h> |
| 13 |
|
| |
| 14 |
|
| /*---------------------------------------------------------------------------- |
| 15 |
|
| * Internal helpers |
| 16 |
|
| *--------------------------------------------------------------------------*/ |
| 17 |
|
| |
| 18 |
|
| /* Append a formatted number (removes trailing zeros for cleaner output). */ |
| 19 |
68883 |
| static pdfmake_err_t append_number(pdfmake_buf_t *buf, double val) |
| 20 |
|
| { |
| 21 |
|
| char tmp[32]; |
| 22 |
68883 |
| int len = pdfmake_format_real(tmp, val); |
| 23 |
68883 |
▶ | if (len < 0) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (len < 0) return PDFMAKE_EINVAL; |
0 |
68883 |
68883 |
|
| 24 |
68883 |
| return pdfmake_buf_append(buf, (const uint8_t *)tmp, (size_t)len); |
| 25 |
|
| } |
| 26 |
|
| |
| 27 |
|
| /* Append a name (with leading /). */ |
| 28 |
9363 |
| static pdfmake_err_t append_name(pdfmake_buf_t *buf, const char *name) |
| 29 |
|
| { |
| 30 |
9363 |
▶ | if (pdfmake_buf_append_byte(buf, '/') != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_buf_append_byte(buf, '/') != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
9363 |
9363 |
|
| 31 |
9363 |
| return pdfmake_buf_append_cstr(buf, name); |
| 32 |
|
| } |
| 33 |
|
| |
| 34 |
|
| /* Append a space. */ |
| 35 |
87578 |
| static PDFMAKE_INLINE pdfmake_err_t append_space(pdfmake_buf_t *buf) |
| 36 |
|
| { |
| 37 |
87578 |
| return pdfmake_buf_append_byte(buf, ' '); |
| 38 |
|
| } |
| 39 |
|
| |
| 40 |
|
| /* Append a newline. */ |
| 41 |
62123 |
| static PDFMAKE_INLINE pdfmake_err_t append_newline(pdfmake_buf_t *buf) |
| 42 |
|
| { |
| 43 |
62123 |
| return pdfmake_buf_append_byte(buf, '\n'); |
| 44 |
|
| } |
| 45 |
|
| |
| 46 |
|
| /* Append a simple operator (no operands). */ |
| 47 |
62123 |
| static pdfmake_err_t append_op(pdfmake_buf_t *buf, const char *op) |
| 48 |
|
| { |
| 49 |
62123 |
▶ | if (pdfmake_buf_append_cstr(buf, op) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_buf_append_cstr(buf, op) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
62123 |
62123 |
|
| 50 |
62123 |
| return append_newline(buf); |
| 51 |
|
| } |
| 52 |
|
| |
| 53 |
|
| /* Append a PDF string (with escaping). */ |
| 54 |
9345 |
| static pdfmake_err_t append_string(pdfmake_buf_t *buf, |
| 55 |
|
| const uint8_t *str, size_t len) |
| 56 |
|
| { |
| 57 |
|
| size_t i; |
| 58 |
9345 |
▶ | if (pdfmake_buf_append_byte(buf, '(') != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_buf_append_byte(buf, '(') != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
9345 |
9345 |
|
| 59 |
|
| |
| 60 |
147105 |
▶ | for (i = 0; i < len; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < len; i++) { |
137760 |
9345 |
147105 |
|
| 61 |
137760 |
| uint8_t ch = str[i]; |
| 62 |
137760 |
| switch (ch) { |
| 63 |
2 |
| case '(': |
| 64 |
|
| case ')': |
| 65 |
|
| case '\\': |
| 66 |
2 |
▶ | if (pdfmake_buf_append_byte(buf, '\\') != PDFMAKE_OK) |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_buf_append_byte(buf, '\\') != PDFMAKE_OK) |
0 |
2 |
2 |
|
| 67 |
0 |
| return PDFMAKE_EINVAL; |
| 68 |
2 |
▶ | if (pdfmake_buf_append_byte(buf, ch) != PDFMAKE_OK) |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_buf_append_byte(buf, ch) != PDFMAKE_OK) |
0 |
2 |
2 |
|
| 69 |
0 |
| return PDFMAKE_EINVAL; |
| 70 |
2 |
| break; |
| 71 |
0 |
| case '\n': |
| 72 |
0 |
▶ | if (pdfmake_buf_append_cstr(buf, "\\n") != PDFMAKE_OK) |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_buf_append_cstr(buf, "\\n") != PDFMAKE_OK) |
0 |
0 |
0 |
|
| 73 |
0 |
| return PDFMAKE_EINVAL; |
| 74 |
0 |
| break; |
| 75 |
0 |
| case '\r': |
| 76 |
0 |
▶ | if (pdfmake_buf_append_cstr(buf, "\\r") != PDFMAKE_OK) |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_buf_append_cstr(buf, "\\r") != PDFMAKE_OK) |
0 |
0 |
0 |
|
| 77 |
0 |
| return PDFMAKE_EINVAL; |
| 78 |
0 |
| break; |
| 79 |
0 |
| case '\t': |
| 80 |
0 |
▶ | if (pdfmake_buf_append_cstr(buf, "\\t") != PDFMAKE_OK) |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_buf_append_cstr(buf, "\\t") != PDFMAKE_OK) |
0 |
0 |
0 |
|
| 81 |
0 |
| return PDFMAKE_EINVAL; |
| 82 |
0 |
| break; |
| 83 |
137758 |
| default: |
| 84 |
137758 |
▶ | if (pdfmake_buf_append_byte(buf, ch) != PDFMAKE_OK) |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_buf_append_byte(buf, ch) != PDFMAKE_OK) |
0 |
137758 |
137758 |
|
| 85 |
0 |
| return PDFMAKE_EINVAL; |
| 86 |
|
| } |
| 87 |
|
| } |
| 88 |
|
| |
| 89 |
9345 |
| return pdfmake_buf_append_byte(buf, ')'); |
| 90 |
|
| } |
| 91 |
|
| |
| 92 |
|
| /*---------------------------------------------------------------------------- |
| 93 |
|
| * Lifecycle |
| 94 |
|
| *--------------------------------------------------------------------------*/ |
| 95 |
|
| |
| 96 |
760 |
| pdfmake_content_t *pdfmake_content_new(pdfmake_arena_t *arena) |
| 97 |
|
| { |
| 98 |
|
| pdfmake_content_t *c; |
| 99 |
760 |
▶ | if (!arena) return NULL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!arena) return NULL; |
0 |
760 |
760 |
|
| 100 |
|
| |
| 101 |
760 |
| c = malloc(sizeof(pdfmake_content_t)); |
| 102 |
760 |
▶ | if (!c) return NULL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return NULL; |
0 |
760 |
760 |
|
| 103 |
|
| |
| 104 |
760 |
| c->arena = arena; |
| 105 |
760 |
▶ | if (pdfmake_buf_init(&c->buf) != PDFMAKE_OK) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_buf_init(&c->buf) != PDFMAKE_OK) { |
0 |
760 |
760 |
|
| 106 |
0 |
| free(c); |
| 107 |
0 |
| return NULL; |
| 108 |
|
| } |
| 109 |
|
| |
| 110 |
760 |
| return c; |
| 111 |
|
| } |
| 112 |
|
| |
| 113 |
760 |
| void pdfmake_content_free(pdfmake_content_t *c) |
| 114 |
|
| { |
| 115 |
760 |
▶ | if (!c) return; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return; |
0 |
760 |
760 |
|
| 116 |
760 |
| pdfmake_buf_free(&c->buf); |
| 117 |
760 |
| free(c); |
| 118 |
|
| } |
| 119 |
|
| |
| 120 |
711 |
| const uint8_t *pdfmake_content_data(pdfmake_content_t *c) |
| 121 |
|
| { |
| 122 |
711 |
▶ | if (!c) return NULL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return NULL; |
0 |
711 |
711 |
|
| 123 |
|
| /* Ensure null-termination for string use */ |
| 124 |
711 |
▶ | if (pdfmake_buf_append_byte(&c->buf, '\0') != PDFMAKE_OK) |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_buf_append_byte(&c->buf, '\0') != PDFMAKE_OK) |
0 |
711 |
711 |
|
| 125 |
0 |
| return NULL; |
| 126 |
711 |
| c->buf.len--; /* Don't count the null in length */ |
| 127 |
711 |
| return c->buf.data; |
| 128 |
|
| } |
| 129 |
|
| |
| 130 |
716 |
| size_t pdfmake_content_len(pdfmake_content_t *c) |
| 131 |
|
| { |
| 132 |
716 |
▶ | return c ? c->buf.len : 0; |
Branch: 1 branch
| Branch | True | False | Total |
| return c ? c->buf.len : 0; |
716 |
0 |
716 |
|
| 133 |
|
| } |
| 134 |
|
| |
| 135 |
41 |
| void pdfmake_content_clear(pdfmake_content_t *c) |
| 136 |
|
| { |
| 137 |
41 |
▶ | if (c) pdfmake_buf_clear(&c->buf); |
Branch: 1 branch
| Branch | True | False | Total |
| if (c) pdfmake_buf_clear(&c->buf); |
41 |
0 |
41 |
|
| 138 |
41 |
| } |
| 139 |
|
| |
| 140 |
|
| /*---------------------------------------------------------------------------- |
| 141 |
|
| * General graphics state operators (§8.4.4) |
| 142 |
|
| *--------------------------------------------------------------------------*/ |
| 143 |
|
| |
| 144 |
130 |
| pdfmake_err_t pdfmake_gs_q(pdfmake_content_t *c) |
| 145 |
|
| { |
| 146 |
130 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
130 |
130 |
|
| 147 |
130 |
| return append_op(&c->buf, "q"); |
| 148 |
|
| } |
| 149 |
|
| |
| 150 |
130 |
| pdfmake_err_t pdfmake_gs_Q(pdfmake_content_t *c) |
| 151 |
|
| { |
| 152 |
130 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
130 |
130 |
|
| 153 |
130 |
| return append_op(&c->buf, "Q"); |
| 154 |
|
| } |
| 155 |
|
| |
| 156 |
23 |
| pdfmake_err_t pdfmake_gs_cm(pdfmake_content_t *c, |
| 157 |
|
| double a, double b, double c_, |
| 158 |
|
| double d, double e, double f) |
| 159 |
|
| { |
| 160 |
|
| pdfmake_buf_t *buf; |
| 161 |
23 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
23 |
23 |
|
| 162 |
23 |
| buf = &c->buf; |
| 163 |
|
| |
| 164 |
23 |
▶ | if (append_number(buf, a) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, a) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
23 |
23 |
|
| 165 |
23 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
23 |
23 |
|
| 166 |
23 |
▶ | if (append_number(buf, b) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, b) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
23 |
23 |
|
| 167 |
23 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
23 |
23 |
|
| 168 |
23 |
▶ | if (append_number(buf, c_) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, c_) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
23 |
23 |
|
| 169 |
23 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
23 |
23 |
|
| 170 |
23 |
▶ | if (append_number(buf, d) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, d) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
23 |
23 |
|
| 171 |
23 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
23 |
23 |
|
| 172 |
23 |
▶ | if (append_number(buf, e) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, e) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
23 |
23 |
|
| 173 |
23 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
23 |
23 |
|
| 174 |
23 |
▶ | if (append_number(buf, f) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, f) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
23 |
23 |
|
| 175 |
23 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
23 |
23 |
|
| 176 |
23 |
| return append_op(buf, "cm"); |
| 177 |
|
| } |
| 178 |
|
| |
| 179 |
65 |
| pdfmake_err_t pdfmake_gs_w(pdfmake_content_t *c, double width) |
| 180 |
|
| { |
| 181 |
|
| pdfmake_buf_t *buf; |
| 182 |
65 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
65 |
65 |
|
| 183 |
65 |
| buf = &c->buf; |
| 184 |
|
| |
| 185 |
65 |
▶ | if (append_number(buf, width) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, width) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
65 |
65 |
|
| 186 |
65 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
65 |
65 |
|
| 187 |
65 |
| return append_op(buf, "w"); |
| 188 |
|
| } |
| 189 |
|
| |
| 190 |
18 |
| pdfmake_err_t pdfmake_gs_J(pdfmake_content_t *c, int cap) |
| 191 |
|
| { |
| 192 |
|
| char tmp[16]; |
| 193 |
18 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
18 |
18 |
|
| 194 |
18 |
| snprintf(tmp, sizeof(tmp), "%d J\n", cap); |
| 195 |
18 |
| return pdfmake_buf_append_cstr(&c->buf, tmp); |
| 196 |
|
| } |
| 197 |
|
| |
| 198 |
3 |
| pdfmake_err_t pdfmake_gs_j(pdfmake_content_t *c, int join) |
| 199 |
|
| { |
| 200 |
|
| char tmp[16]; |
| 201 |
3 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 202 |
3 |
| snprintf(tmp, sizeof(tmp), "%d j\n", join); |
| 203 |
3 |
| return pdfmake_buf_append_cstr(&c->buf, tmp); |
| 204 |
|
| } |
| 205 |
|
| |
| 206 |
3 |
| pdfmake_err_t pdfmake_gs_M(pdfmake_content_t *c, double limit) |
| 207 |
|
| { |
| 208 |
|
| pdfmake_buf_t *buf; |
| 209 |
3 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 210 |
3 |
| buf = &c->buf; |
| 211 |
|
| |
| 212 |
3 |
▶ | if (append_number(buf, limit) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, limit) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 213 |
3 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 214 |
3 |
| return append_op(buf, "M"); |
| 215 |
|
| } |
| 216 |
|
| |
| 217 |
8 |
| pdfmake_err_t pdfmake_gs_d(pdfmake_content_t *c, |
| 218 |
|
| const double *array, size_t count, |
| 219 |
|
| double phase) |
| 220 |
|
| { |
| 221 |
|
| pdfmake_buf_t *buf; |
| 222 |
|
| size_t i; |
| 223 |
8 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
8 |
8 |
|
| 224 |
8 |
| buf = &c->buf; |
| 225 |
|
| |
| 226 |
8 |
▶ | if (pdfmake_buf_append_byte(buf, '[') != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_buf_append_byte(buf, '[') != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
8 |
8 |
|
| 227 |
24 |
▶ | for (i = 0; i < count; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < count; i++) { |
16 |
8 |
24 |
|
| 228 |
16 |
▶ | if (i > 0 && append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 2 branches
| Branch | True | False | Total |
| if (i > 0 && append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
8 |
8 |
16 |
| if (i > 0 && append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
8 |
8 |
|
| 229 |
16 |
▶ | if (append_number(buf, array[i]) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, array[i]) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
16 |
16 |
|
| 230 |
|
| } |
| 231 |
8 |
▶ | if (pdfmake_buf_append_cstr(buf, "] ") != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_buf_append_cstr(buf, "] ") != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
8 |
8 |
|
| 232 |
8 |
▶ | if (append_number(buf, phase) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, phase) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
8 |
8 |
|
| 233 |
8 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
8 |
8 |
|
| 234 |
8 |
| return append_op(buf, "d"); |
| 235 |
|
| } |
| 236 |
|
| |
| 237 |
1 |
| pdfmake_err_t pdfmake_gs_ri(pdfmake_content_t *c, const char *intent) |
| 238 |
|
| { |
| 239 |
|
| pdfmake_buf_t *buf; |
| 240 |
1 |
▶ | if (!c || !intent) return PDFMAKE_EINVAL; |
Branch: 2 branches
| Branch | True | False | Total |
| if (!c || !intent) return PDFMAKE_EINVAL; |
1 |
0 |
1 |
| if (!c || !intent) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 241 |
1 |
| buf = &c->buf; |
| 242 |
|
| |
| 243 |
1 |
▶ | if (append_name(buf, intent) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_name(buf, intent) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 244 |
1 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 245 |
1 |
| return append_op(buf, "ri"); |
| 246 |
|
| } |
| 247 |
|
| |
| 248 |
1 |
| pdfmake_err_t pdfmake_gs_i(pdfmake_content_t *c, double flatness) |
| 249 |
|
| { |
| 250 |
|
| pdfmake_buf_t *buf; |
| 251 |
1 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 252 |
1 |
| buf = &c->buf; |
| 253 |
|
| |
| 254 |
1 |
▶ | if (append_number(buf, flatness) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, flatness) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 255 |
1 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 256 |
1 |
| return append_op(buf, "i"); |
| 257 |
|
| } |
| 258 |
|
| |
| 259 |
1 |
| pdfmake_err_t pdfmake_gs_gs(pdfmake_content_t *c, const char *name) |
| 260 |
|
| { |
| 261 |
|
| pdfmake_buf_t *buf; |
| 262 |
1 |
▶ | if (!c || !name) return PDFMAKE_EINVAL; |
Branch: 2 branches
| Branch | True | False | Total |
| if (!c || !name) return PDFMAKE_EINVAL; |
1 |
0 |
1 |
| if (!c || !name) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 263 |
1 |
| buf = &c->buf; |
| 264 |
|
| |
| 265 |
1 |
▶ | if (append_name(buf, name) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_name(buf, name) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 266 |
1 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 267 |
1 |
| return append_op(buf, "gs"); |
| 268 |
|
| } |
| 269 |
|
| |
| 270 |
|
| /*---------------------------------------------------------------------------- |
| 271 |
|
| * Path construction operators (§8.5.2) |
| 272 |
|
| *--------------------------------------------------------------------------*/ |
| 273 |
|
| |
| 274 |
1841 |
| pdfmake_err_t pdfmake_path_m(pdfmake_content_t *c, double x, double y) |
| 275 |
|
| { |
| 276 |
|
| pdfmake_buf_t *buf; |
| 277 |
1841 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
1841 |
1841 |
|
| 278 |
1841 |
| buf = &c->buf; |
| 279 |
|
| |
| 280 |
1841 |
▶ | if (append_number(buf, x) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, x) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1841 |
1841 |
|
| 281 |
1841 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1841 |
1841 |
|
| 282 |
1841 |
▶ | if (append_number(buf, y) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, y) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1841 |
1841 |
|
| 283 |
1841 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1841 |
1841 |
|
| 284 |
1841 |
| return append_op(buf, "m"); |
| 285 |
|
| } |
| 286 |
|
| |
| 287 |
1839 |
| pdfmake_err_t pdfmake_path_l(pdfmake_content_t *c, double x, double y) |
| 288 |
|
| { |
| 289 |
|
| pdfmake_buf_t *buf; |
| 290 |
1839 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
1839 |
1839 |
|
| 291 |
1839 |
| buf = &c->buf; |
| 292 |
|
| |
| 293 |
1839 |
▶ | if (append_number(buf, x) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, x) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1839 |
1839 |
|
| 294 |
1839 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1839 |
1839 |
|
| 295 |
1839 |
▶ | if (append_number(buf, y) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, y) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1839 |
1839 |
|
| 296 |
1839 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1839 |
1839 |
|
| 297 |
1839 |
| return append_op(buf, "l"); |
| 298 |
|
| } |
| 299 |
|
| |
| 300 |
13 |
| pdfmake_err_t pdfmake_path_c(pdfmake_content_t *c, |
| 301 |
|
| double x1, double y1, |
| 302 |
|
| double x2, double y2, |
| 303 |
|
| double x3, double y3) |
| 304 |
|
| { |
| 305 |
|
| pdfmake_buf_t *buf; |
| 306 |
13 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
13 |
13 |
|
| 307 |
13 |
| buf = &c->buf; |
| 308 |
|
| |
| 309 |
13 |
▶ | if (append_number(buf, x1) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, x1) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
13 |
13 |
|
| 310 |
13 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
13 |
13 |
|
| 311 |
13 |
▶ | if (append_number(buf, y1) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, y1) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
13 |
13 |
|
| 312 |
13 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
13 |
13 |
|
| 313 |
13 |
▶ | if (append_number(buf, x2) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, x2) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
13 |
13 |
|
| 314 |
13 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
13 |
13 |
|
| 315 |
13 |
▶ | if (append_number(buf, y2) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, y2) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
13 |
13 |
|
| 316 |
13 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
13 |
13 |
|
| 317 |
13 |
▶ | if (append_number(buf, x3) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, x3) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
13 |
13 |
|
| 318 |
13 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
13 |
13 |
|
| 319 |
13 |
▶ | if (append_number(buf, y3) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, y3) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
13 |
13 |
|
| 320 |
13 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
13 |
13 |
|
| 321 |
13 |
| return append_op(buf, "c"); |
| 322 |
|
| } |
| 323 |
|
| |
| 324 |
1 |
| pdfmake_err_t pdfmake_path_v(pdfmake_content_t *c, |
| 325 |
|
| double x2, double y2, |
| 326 |
|
| double x3, double y3) |
| 327 |
|
| { |
| 328 |
|
| pdfmake_buf_t *buf; |
| 329 |
1 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 330 |
1 |
| buf = &c->buf; |
| 331 |
|
| |
| 332 |
1 |
▶ | if (append_number(buf, x2) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, x2) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 333 |
1 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 334 |
1 |
▶ | if (append_number(buf, y2) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, y2) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 335 |
1 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 336 |
1 |
▶ | if (append_number(buf, x3) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, x3) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 337 |
1 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 338 |
1 |
▶ | if (append_number(buf, y3) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, y3) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 339 |
1 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 340 |
1 |
| return append_op(buf, "v"); |
| 341 |
|
| } |
| 342 |
|
| |
| 343 |
1 |
| pdfmake_err_t pdfmake_path_y(pdfmake_content_t *c, |
| 344 |
|
| double x1, double y1, |
| 345 |
|
| double x3, double y3) |
| 346 |
|
| { |
| 347 |
|
| pdfmake_buf_t *buf; |
| 348 |
1 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 349 |
1 |
| buf = &c->buf; |
| 350 |
|
| |
| 351 |
1 |
▶ | if (append_number(buf, x1) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, x1) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 352 |
1 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 353 |
1 |
▶ | if (append_number(buf, y1) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, y1) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 354 |
1 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 355 |
1 |
▶ | if (append_number(buf, x3) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, x3) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 356 |
1 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 357 |
1 |
▶ | if (append_number(buf, y3) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, y3) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 358 |
1 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 359 |
1 |
| return append_op(buf, "y"); |
| 360 |
|
| } |
| 361 |
|
| |
| 362 |
85 |
| pdfmake_err_t pdfmake_path_re(pdfmake_content_t *c, |
| 363 |
|
| double x, double y, |
| 364 |
|
| double width, double height) |
| 365 |
|
| { |
| 366 |
|
| pdfmake_buf_t *buf; |
| 367 |
85 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
85 |
85 |
|
| 368 |
85 |
| buf = &c->buf; |
| 369 |
|
| |
| 370 |
85 |
▶ | if (append_number(buf, x) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, x) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
85 |
85 |
|
| 371 |
85 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
85 |
85 |
|
| 372 |
85 |
▶ | if (append_number(buf, y) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, y) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
85 |
85 |
|
| 373 |
85 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
85 |
85 |
|
| 374 |
85 |
▶ | if (append_number(buf, width) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, width) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
85 |
85 |
|
| 375 |
85 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
85 |
85 |
|
| 376 |
85 |
▶ | if (append_number(buf, height) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, height) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
85 |
85 |
|
| 377 |
85 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
85 |
85 |
|
| 378 |
85 |
| return append_op(buf, "re"); |
| 379 |
|
| } |
| 380 |
|
| |
| 381 |
2 |
| pdfmake_err_t pdfmake_path_h(pdfmake_content_t *c) |
| 382 |
|
| { |
| 383 |
2 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
2 |
2 |
|
| 384 |
2 |
| return append_op(&c->buf, "h"); |
| 385 |
|
| } |
| 386 |
|
| |
| 387 |
|
| /*---------------------------------------------------------------------------- |
| 388 |
|
| * Path painting operators (§8.5.3) |
| 389 |
|
| *--------------------------------------------------------------------------*/ |
| 390 |
|
| |
| 391 |
1873 |
| pdfmake_err_t pdfmake_paint_S(pdfmake_content_t *c) |
| 392 |
|
| { |
| 393 |
1873 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
1873 |
1873 |
|
| 394 |
1873 |
| return append_op(&c->buf, "S"); |
| 395 |
|
| } |
| 396 |
|
| |
| 397 |
2 |
| pdfmake_err_t pdfmake_paint_s(pdfmake_content_t *c) |
| 398 |
|
| { |
| 399 |
2 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
2 |
2 |
|
| 400 |
2 |
| return append_op(&c->buf, "s"); |
| 401 |
|
| } |
| 402 |
|
| |
| 403 |
53 |
| pdfmake_err_t pdfmake_paint_f(pdfmake_content_t *c) |
| 404 |
|
| { |
| 405 |
53 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
53 |
53 |
|
| 406 |
53 |
| return append_op(&c->buf, "f"); |
| 407 |
|
| } |
| 408 |
|
| |
| 409 |
1 |
| pdfmake_err_t pdfmake_paint_f_star(pdfmake_content_t *c) |
| 410 |
|
| { |
| 411 |
1 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 412 |
1 |
| return append_op(&c->buf, "f*"); |
| 413 |
|
| } |
| 414 |
|
| |
| 415 |
4 |
| pdfmake_err_t pdfmake_paint_B(pdfmake_content_t *c) |
| 416 |
|
| { |
| 417 |
4 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
4 |
4 |
|
| 418 |
4 |
| return append_op(&c->buf, "B"); |
| 419 |
|
| } |
| 420 |
|
| |
| 421 |
1 |
| pdfmake_err_t pdfmake_paint_B_star(pdfmake_content_t *c) |
| 422 |
|
| { |
| 423 |
1 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 424 |
1 |
| return append_op(&c->buf, "B*"); |
| 425 |
|
| } |
| 426 |
|
| |
| 427 |
1 |
| pdfmake_err_t pdfmake_paint_b(pdfmake_content_t *c) |
| 428 |
|
| { |
| 429 |
1 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 430 |
1 |
| return append_op(&c->buf, "b"); |
| 431 |
|
| } |
| 432 |
|
| |
| 433 |
1 |
| pdfmake_err_t pdfmake_paint_b_star(pdfmake_content_t *c) |
| 434 |
|
| { |
| 435 |
1 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 436 |
1 |
| return append_op(&c->buf, "b*"); |
| 437 |
|
| } |
| 438 |
|
| |
| 439 |
2 |
| pdfmake_err_t pdfmake_paint_n(pdfmake_content_t *c) |
| 440 |
|
| { |
| 441 |
2 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
2 |
2 |
|
| 442 |
2 |
| return append_op(&c->buf, "n"); |
| 443 |
|
| } |
| 444 |
|
| |
| 445 |
|
| /*---------------------------------------------------------------------------- |
| 446 |
|
| * Clipping operators (§8.5.4) |
| 447 |
|
| *--------------------------------------------------------------------------*/ |
| 448 |
|
| |
| 449 |
1 |
| pdfmake_err_t pdfmake_clip_W(pdfmake_content_t *c) |
| 450 |
|
| { |
| 451 |
1 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 452 |
1 |
| return append_op(&c->buf, "W"); |
| 453 |
|
| } |
| 454 |
|
| |
| 455 |
1 |
| pdfmake_err_t pdfmake_clip_W_star(pdfmake_content_t *c) |
| 456 |
|
| { |
| 457 |
1 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 458 |
1 |
| return append_op(&c->buf, "W*"); |
| 459 |
|
| } |
| 460 |
|
| |
| 461 |
|
| /*---------------------------------------------------------------------------- |
| 462 |
|
| * Colour operators (§8.6) |
| 463 |
|
| *--------------------------------------------------------------------------*/ |
| 464 |
|
| |
| 465 |
1 |
| pdfmake_err_t pdfmake_color_CS(pdfmake_content_t *c, const char *name) |
| 466 |
|
| { |
| 467 |
|
| pdfmake_buf_t *buf; |
| 468 |
1 |
▶ | if (!c || !name) return PDFMAKE_EINVAL; |
Branch: 2 branches
| Branch | True | False | Total |
| if (!c || !name) return PDFMAKE_EINVAL; |
1 |
0 |
1 |
| if (!c || !name) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 469 |
1 |
| buf = &c->buf; |
| 470 |
|
| |
| 471 |
1 |
▶ | if (append_name(buf, name) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_name(buf, name) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 472 |
1 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 473 |
1 |
| return append_op(buf, "CS"); |
| 474 |
|
| } |
| 475 |
|
| |
| 476 |
1 |
| pdfmake_err_t pdfmake_color_cs(pdfmake_content_t *c, const char *name) |
| 477 |
|
| { |
| 478 |
|
| pdfmake_buf_t *buf; |
| 479 |
1 |
▶ | if (!c || !name) return PDFMAKE_EINVAL; |
Branch: 2 branches
| Branch | True | False | Total |
| if (!c || !name) return PDFMAKE_EINVAL; |
1 |
0 |
1 |
| if (!c || !name) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 480 |
1 |
| buf = &c->buf; |
| 481 |
|
| |
| 482 |
1 |
▶ | if (append_name(buf, name) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_name(buf, name) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 483 |
1 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 484 |
1 |
| return append_op(buf, "cs"); |
| 485 |
|
| } |
| 486 |
|
| |
| 487 |
0 |
| pdfmake_err_t pdfmake_color_SC(pdfmake_content_t *c, |
| 488 |
|
| const double *components, size_t count) |
| 489 |
|
| { |
| 490 |
|
| pdfmake_buf_t *buf; |
| 491 |
|
| size_t i; |
| 492 |
0 |
▶ | if (!c || !components || count == 0) return PDFMAKE_EINVAL; |
Branch: 3 branches
| Branch | True | False | Total |
| if (!c || !components || count == 0) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
| if (!c || !components || count == 0) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
| if (!c || !components || count == 0) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 493 |
0 |
| buf = &c->buf; |
| 494 |
|
| |
| 495 |
0 |
▶ | for (i = 0; i < count; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < count; i++) { |
0 |
0 |
0 |
|
| 496 |
0 |
▶ | if (append_number(buf, components[i]) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, components[i]) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 497 |
0 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 498 |
|
| } |
| 499 |
0 |
| return append_op(buf, "SC"); |
| 500 |
|
| } |
| 501 |
|
| |
| 502 |
0 |
| pdfmake_err_t pdfmake_color_sc(pdfmake_content_t *c, |
| 503 |
|
| const double *components, size_t count) |
| 504 |
|
| { |
| 505 |
|
| pdfmake_buf_t *buf; |
| 506 |
|
| size_t i; |
| 507 |
0 |
▶ | if (!c || !components || count == 0) return PDFMAKE_EINVAL; |
Branch: 3 branches
| Branch | True | False | Total |
| if (!c || !components || count == 0) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
| if (!c || !components || count == 0) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
| if (!c || !components || count == 0) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 508 |
0 |
| buf = &c->buf; |
| 509 |
|
| |
| 510 |
0 |
▶ | for (i = 0; i < count; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < count; i++) { |
0 |
0 |
0 |
|
| 511 |
0 |
▶ | if (append_number(buf, components[i]) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, components[i]) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 512 |
0 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 513 |
|
| } |
| 514 |
0 |
| return append_op(buf, "sc"); |
| 515 |
|
| } |
| 516 |
|
| |
| 517 |
0 |
| pdfmake_err_t pdfmake_color_SCN(pdfmake_content_t *c, |
| 518 |
|
| const double *components, size_t count, |
| 519 |
|
| const char *name) |
| 520 |
|
| { |
| 521 |
|
| pdfmake_buf_t *buf; |
| 522 |
|
| size_t i; |
| 523 |
0 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 524 |
0 |
| buf = &c->buf; |
| 525 |
|
| |
| 526 |
0 |
▶ | if (components && count > 0) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (components && count > 0) { |
0 |
0 |
0 |
| if (components && count > 0) { |
0 |
0 |
0 |
|
| 527 |
0 |
▶ | for (i = 0; i < count; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < count; i++) { |
0 |
0 |
0 |
|
| 528 |
0 |
▶ | if (append_number(buf, components[i]) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, components[i]) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 529 |
0 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 530 |
|
| } |
| 531 |
|
| } |
| 532 |
0 |
▶ | if (name) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (name) { |
0 |
0 |
0 |
|
| 533 |
0 |
▶ | if (append_name(buf, name) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_name(buf, name) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 534 |
0 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 535 |
|
| } |
| 536 |
0 |
| return append_op(buf, "SCN"); |
| 537 |
|
| } |
| 538 |
|
| |
| 539 |
0 |
| pdfmake_err_t pdfmake_color_scn(pdfmake_content_t *c, |
| 540 |
|
| const double *components, size_t count, |
| 541 |
|
| const char *name) |
| 542 |
|
| { |
| 543 |
|
| pdfmake_buf_t *buf; |
| 544 |
|
| size_t i; |
| 545 |
0 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 546 |
0 |
| buf = &c->buf; |
| 547 |
|
| |
| 548 |
0 |
▶ | if (components && count > 0) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (components && count > 0) { |
0 |
0 |
0 |
| if (components && count > 0) { |
0 |
0 |
0 |
|
| 549 |
0 |
▶ | for (i = 0; i < count; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < count; i++) { |
0 |
0 |
0 |
|
| 550 |
0 |
▶ | if (append_number(buf, components[i]) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, components[i]) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 551 |
0 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 552 |
|
| } |
| 553 |
|
| } |
| 554 |
0 |
▶ | if (name) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (name) { |
0 |
0 |
0 |
|
| 555 |
0 |
▶ | if (append_name(buf, name) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_name(buf, name) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 556 |
0 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 557 |
|
| } |
| 558 |
0 |
| return append_op(buf, "scn"); |
| 559 |
|
| } |
| 560 |
|
| |
| 561 |
4 |
| pdfmake_err_t pdfmake_color_G(pdfmake_content_t *c, double gray) |
| 562 |
|
| { |
| 563 |
|
| pdfmake_buf_t *buf; |
| 564 |
4 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
4 |
4 |
|
| 565 |
4 |
| buf = &c->buf; |
| 566 |
|
| |
| 567 |
4 |
▶ | if (append_number(buf, gray) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, gray) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
4 |
4 |
|
| 568 |
4 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
4 |
4 |
|
| 569 |
4 |
| return append_op(buf, "G"); |
| 570 |
|
| } |
| 571 |
|
| |
| 572 |
3 |
| pdfmake_err_t pdfmake_color_g(pdfmake_content_t *c, double gray) |
| 573 |
|
| { |
| 574 |
|
| pdfmake_buf_t *buf; |
| 575 |
3 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 576 |
3 |
| buf = &c->buf; |
| 577 |
|
| |
| 578 |
3 |
▶ | if (append_number(buf, gray) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, gray) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 579 |
3 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 580 |
3 |
| return append_op(buf, "g"); |
| 581 |
|
| } |
| 582 |
|
| |
| 583 |
63 |
| pdfmake_err_t pdfmake_color_RG(pdfmake_content_t *c, |
| 584 |
|
| double r, double g, double b) |
| 585 |
|
| { |
| 586 |
|
| pdfmake_buf_t *buf; |
| 587 |
63 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
63 |
63 |
|
| 588 |
63 |
| buf = &c->buf; |
| 589 |
|
| |
| 590 |
63 |
▶ | if (append_number(buf, r) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, r) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
63 |
63 |
|
| 591 |
63 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
63 |
63 |
|
| 592 |
63 |
▶ | if (append_number(buf, g) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, g) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
63 |
63 |
|
| 593 |
63 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
63 |
63 |
|
| 594 |
63 |
▶ | if (append_number(buf, b) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, b) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
63 |
63 |
|
| 595 |
63 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
63 |
63 |
|
| 596 |
63 |
| return append_op(buf, "RG"); |
| 597 |
|
| } |
| 598 |
|
| |
| 599 |
9263 |
| pdfmake_err_t pdfmake_color_rg(pdfmake_content_t *c, |
| 600 |
|
| double r, double g, double b) |
| 601 |
|
| { |
| 602 |
|
| pdfmake_buf_t *buf; |
| 603 |
9263 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
9263 |
9263 |
|
| 604 |
9263 |
| buf = &c->buf; |
| 605 |
|
| |
| 606 |
9263 |
▶ | if (append_number(buf, r) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, r) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
9263 |
9263 |
|
| 607 |
9263 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
9263 |
9263 |
|
| 608 |
9263 |
▶ | if (append_number(buf, g) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, g) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
9263 |
9263 |
|
| 609 |
9263 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
9263 |
9263 |
|
| 610 |
9263 |
▶ | if (append_number(buf, b) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, b) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
9263 |
9263 |
|
| 611 |
9263 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
9263 |
9263 |
|
| 612 |
9263 |
| return append_op(buf, "rg"); |
| 613 |
|
| } |
| 614 |
|
| |
| 615 |
3 |
| pdfmake_err_t pdfmake_color_K(pdfmake_content_t *c, |
| 616 |
|
| double c_, double m, double y, double k) |
| 617 |
|
| { |
| 618 |
|
| pdfmake_buf_t *buf; |
| 619 |
3 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 620 |
3 |
| buf = &c->buf; |
| 621 |
|
| |
| 622 |
3 |
▶ | if (append_number(buf, c_) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, c_) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 623 |
3 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 624 |
3 |
▶ | if (append_number(buf, m) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, m) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 625 |
3 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 626 |
3 |
▶ | if (append_number(buf, y) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, y) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 627 |
3 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 628 |
3 |
▶ | if (append_number(buf, k) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, k) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 629 |
3 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 630 |
3 |
| return append_op(buf, "K"); |
| 631 |
|
| } |
| 632 |
|
| |
| 633 |
3 |
| pdfmake_err_t pdfmake_color_k(pdfmake_content_t *c, |
| 634 |
|
| double c_, double m, double y, double k) |
| 635 |
|
| { |
| 636 |
|
| pdfmake_buf_t *buf; |
| 637 |
3 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 638 |
3 |
| buf = &c->buf; |
| 639 |
|
| |
| 640 |
3 |
▶ | if (append_number(buf, c_) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, c_) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 641 |
3 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 642 |
3 |
▶ | if (append_number(buf, m) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, m) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 643 |
3 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 644 |
3 |
▶ | if (append_number(buf, y) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, y) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 645 |
3 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 646 |
3 |
▶ | if (append_number(buf, k) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, k) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 647 |
3 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 648 |
3 |
| return append_op(buf, "k"); |
| 649 |
|
| } |
| 650 |
|
| |
| 651 |
|
| /*---------------------------------------------------------------------------- |
| 652 |
|
| * Text object operators (§9.4) |
| 653 |
|
| *--------------------------------------------------------------------------*/ |
| 654 |
|
| |
| 655 |
9320 |
| pdfmake_err_t pdfmake_text_BT(pdfmake_content_t *c) |
| 656 |
|
| { |
| 657 |
9320 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
9320 |
9320 |
|
| 658 |
9320 |
| return append_op(&c->buf, "BT"); |
| 659 |
|
| } |
| 660 |
|
| |
| 661 |
9320 |
| pdfmake_err_t pdfmake_text_ET(pdfmake_content_t *c) |
| 662 |
|
| { |
| 663 |
9320 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
9320 |
9320 |
|
| 664 |
9320 |
| return append_op(&c->buf, "ET"); |
| 665 |
|
| } |
| 666 |
|
| |
| 667 |
|
| /*---------------------------------------------------------------------------- |
| 668 |
|
| * Text state operators (§9.3) |
| 669 |
|
| *--------------------------------------------------------------------------*/ |
| 670 |
|
| |
| 671 |
1 |
| pdfmake_err_t pdfmake_text_Tc(pdfmake_content_t *c, double spacing) |
| 672 |
|
| { |
| 673 |
|
| pdfmake_buf_t *buf; |
| 674 |
1 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 675 |
1 |
| buf = &c->buf; |
| 676 |
|
| |
| 677 |
1 |
▶ | if (append_number(buf, spacing) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, spacing) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 678 |
1 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 679 |
1 |
| return append_op(buf, "Tc"); |
| 680 |
|
| } |
| 681 |
|
| |
| 682 |
1 |
| pdfmake_err_t pdfmake_text_Tw(pdfmake_content_t *c, double spacing) |
| 683 |
|
| { |
| 684 |
|
| pdfmake_buf_t *buf; |
| 685 |
1 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 686 |
1 |
| buf = &c->buf; |
| 687 |
|
| |
| 688 |
1 |
▶ | if (append_number(buf, spacing) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, spacing) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 689 |
1 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 690 |
1 |
| return append_op(buf, "Tw"); |
| 691 |
|
| } |
| 692 |
|
| |
| 693 |
1 |
| pdfmake_err_t pdfmake_text_Tz(pdfmake_content_t *c, double scale) |
| 694 |
|
| { |
| 695 |
|
| pdfmake_buf_t *buf; |
| 696 |
1 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 697 |
1 |
| buf = &c->buf; |
| 698 |
|
| |
| 699 |
1 |
▶ | if (append_number(buf, scale) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, scale) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 700 |
1 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 701 |
1 |
| return append_op(buf, "Tz"); |
| 702 |
|
| } |
| 703 |
|
| |
| 704 |
4 |
| pdfmake_err_t pdfmake_text_TL(pdfmake_content_t *c, double leading) |
| 705 |
|
| { |
| 706 |
|
| pdfmake_buf_t *buf; |
| 707 |
4 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
4 |
4 |
|
| 708 |
4 |
| buf = &c->buf; |
| 709 |
|
| |
| 710 |
4 |
▶ | if (append_number(buf, leading) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, leading) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
4 |
4 |
|
| 711 |
4 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
4 |
4 |
|
| 712 |
4 |
| return append_op(buf, "TL"); |
| 713 |
|
| } |
| 714 |
|
| |
| 715 |
9324 |
| pdfmake_err_t pdfmake_text_Tf(pdfmake_content_t *c, |
| 716 |
|
| const char *font_name, double size) |
| 717 |
|
| { |
| 718 |
|
| pdfmake_buf_t *buf; |
| 719 |
9324 |
▶ | if (!c || !font_name) return PDFMAKE_EINVAL; |
Branch: 2 branches
| Branch | True | False | Total |
| if (!c || !font_name) return PDFMAKE_EINVAL; |
9324 |
0 |
9324 |
| if (!c || !font_name) return PDFMAKE_EINVAL; |
0 |
9324 |
9324 |
|
| 720 |
9324 |
| buf = &c->buf; |
| 721 |
|
| |
| 722 |
9324 |
▶ | if (append_name(buf, font_name) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_name(buf, font_name) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
9324 |
9324 |
|
| 723 |
9324 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
9324 |
9324 |
|
| 724 |
9324 |
▶ | if (append_number(buf, size) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, size) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
9324 |
9324 |
|
| 725 |
9324 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
9324 |
9324 |
|
| 726 |
9324 |
| return append_op(buf, "Tf"); |
| 727 |
|
| } |
| 728 |
|
| |
| 729 |
3 |
| pdfmake_err_t pdfmake_text_Tr(pdfmake_content_t *c, int mode) |
| 730 |
|
| { |
| 731 |
|
| char tmp[16]; |
| 732 |
3 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 733 |
3 |
| snprintf(tmp, sizeof(tmp), "%d Tr\n", mode); |
| 734 |
3 |
| return pdfmake_buf_append_cstr(&c->buf, tmp); |
| 735 |
|
| } |
| 736 |
|
| |
| 737 |
3 |
| pdfmake_err_t pdfmake_text_Ts(pdfmake_content_t *c, double rise) |
| 738 |
|
| { |
| 739 |
|
| pdfmake_buf_t *buf; |
| 740 |
3 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 741 |
3 |
| buf = &c->buf; |
| 742 |
|
| |
| 743 |
3 |
▶ | if (append_number(buf, rise) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, rise) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 744 |
3 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 745 |
3 |
| return append_op(buf, "Ts"); |
| 746 |
|
| } |
| 747 |
|
| |
| 748 |
|
| /*---------------------------------------------------------------------------- |
| 749 |
|
| * Text positioning operators (§9.4.2) |
| 750 |
|
| *--------------------------------------------------------------------------*/ |
| 751 |
|
| |
| 752 |
8131 |
| pdfmake_err_t pdfmake_text_Td(pdfmake_content_t *c, double tx, double ty) |
| 753 |
|
| { |
| 754 |
|
| pdfmake_buf_t *buf; |
| 755 |
8131 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
8131 |
8131 |
|
| 756 |
8131 |
| buf = &c->buf; |
| 757 |
|
| |
| 758 |
8131 |
▶ | if (append_number(buf, tx) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, tx) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
8131 |
8131 |
|
| 759 |
8131 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
8131 |
8131 |
|
| 760 |
8131 |
▶ | if (append_number(buf, ty) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, ty) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
8131 |
8131 |
|
| 761 |
8131 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
8131 |
8131 |
|
| 762 |
8131 |
| return append_op(buf, "Td"); |
| 763 |
|
| } |
| 764 |
|
| |
| 765 |
1 |
| pdfmake_err_t pdfmake_text_TD(pdfmake_content_t *c, double tx, double ty) |
| 766 |
|
| { |
| 767 |
|
| pdfmake_buf_t *buf; |
| 768 |
1 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 769 |
1 |
| buf = &c->buf; |
| 770 |
|
| |
| 771 |
1 |
▶ | if (append_number(buf, tx) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, tx) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 772 |
1 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 773 |
1 |
▶ | if (append_number(buf, ty) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, ty) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 774 |
1 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 775 |
1 |
| return append_op(buf, "TD"); |
| 776 |
|
| } |
| 777 |
|
| |
| 778 |
1209 |
| pdfmake_err_t pdfmake_text_Tm(pdfmake_content_t *c, |
| 779 |
|
| double a, double b, double c_, |
| 780 |
|
| double d, double e, double f) |
| 781 |
|
| { |
| 782 |
|
| pdfmake_buf_t *buf; |
| 783 |
1209 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
1209 |
1209 |
|
| 784 |
1209 |
| buf = &c->buf; |
| 785 |
|
| |
| 786 |
1209 |
▶ | if (append_number(buf, a) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, a) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1209 |
1209 |
|
| 787 |
1209 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1209 |
1209 |
|
| 788 |
1209 |
▶ | if (append_number(buf, b) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, b) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1209 |
1209 |
|
| 789 |
1209 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1209 |
1209 |
|
| 790 |
1209 |
▶ | if (append_number(buf, c_) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, c_) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1209 |
1209 |
|
| 791 |
1209 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1209 |
1209 |
|
| 792 |
1209 |
▶ | if (append_number(buf, d) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, d) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1209 |
1209 |
|
| 793 |
1209 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1209 |
1209 |
|
| 794 |
1209 |
▶ | if (append_number(buf, e) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, e) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1209 |
1209 |
|
| 795 |
1209 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1209 |
1209 |
|
| 796 |
1209 |
▶ | if (append_number(buf, f) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, f) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1209 |
1209 |
|
| 797 |
1209 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1209 |
1209 |
|
| 798 |
1209 |
| return append_op(buf, "Tm"); |
| 799 |
|
| } |
| 800 |
|
| |
| 801 |
2 |
| pdfmake_err_t pdfmake_text_Tstar(pdfmake_content_t *c) |
| 802 |
|
| { |
| 803 |
2 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
2 |
2 |
|
| 804 |
2 |
| return append_op(&c->buf, "T*"); |
| 805 |
|
| } |
| 806 |
|
| |
| 807 |
|
| /*---------------------------------------------------------------------------- |
| 808 |
|
| * Text showing operators (§9.4.3) |
| 809 |
|
| *--------------------------------------------------------------------------*/ |
| 810 |
|
| |
| 811 |
9338 |
| pdfmake_err_t pdfmake_text_Tj(pdfmake_content_t *c, |
| 812 |
|
| const uint8_t *str, size_t len) |
| 813 |
|
| { |
| 814 |
|
| pdfmake_buf_t *buf; |
| 815 |
9338 |
▶ | if (!c || !str) return PDFMAKE_EINVAL; |
Branch: 2 branches
| Branch | True | False | Total |
| if (!c || !str) return PDFMAKE_EINVAL; |
9338 |
0 |
9338 |
| if (!c || !str) return PDFMAKE_EINVAL; |
0 |
9338 |
9338 |
|
| 816 |
9338 |
| buf = &c->buf; |
| 817 |
|
| |
| 818 |
9338 |
▶ | if (append_string(buf, str, len) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_string(buf, str, len) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
9338 |
9338 |
|
| 819 |
9338 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
9338 |
9338 |
|
| 820 |
9338 |
| return append_op(buf, "Tj"); |
| 821 |
|
| } |
| 822 |
|
| |
| 823 |
0 |
| pdfmake_err_t pdfmake_text_Tj_cstr(pdfmake_content_t *c, const char *str) |
| 824 |
|
| { |
| 825 |
0 |
▶ | if (!str) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!str) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 826 |
0 |
| return pdfmake_text_Tj(c, (const uint8_t *)str, strlen(str)); |
| 827 |
|
| } |
| 828 |
|
| |
| 829 |
|
| /* Tj with the operand written as a hex string. |
| 830 |
|
| * |
| 831 |
|
| * A composite font under Identity-H is shown two bytes per glyph, and those |
| 832 |
|
| * bytes are glyph ids, not text: half of them are NUL for any Latin subset. |
| 833 |
|
| * A literal string can carry them, but it puts raw NULs and escapes into a |
| 834 |
|
| * content stream that other passes here read and rewrite. Hex keeps the |
| 835 |
|
| * stream printable at the cost of one byte per nibble. */ |
| 836 |
3 |
| pdfmake_err_t pdfmake_text_Tj_hex(pdfmake_content_t *c, |
| 837 |
|
| const uint8_t *str, size_t len) |
| 838 |
|
| { |
| 839 |
|
| static const char hexdig[] = "0123456789ABCDEF"; |
| 840 |
|
| pdfmake_buf_t *buf; |
| 841 |
|
| size_t i; |
| 842 |
|
| |
| 843 |
3 |
▶ | if (!c || !str) return PDFMAKE_EINVAL; |
Branch: 2 branches
| Branch | True | False | Total |
| if (!c || !str) return PDFMAKE_EINVAL; |
3 |
0 |
3 |
| if (!c || !str) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 844 |
3 |
| buf = &c->buf; |
| 845 |
|
| |
| 846 |
3 |
▶ | if (pdfmake_buf_append_byte(buf, '<') != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_buf_append_byte(buf, '<') != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 847 |
19 |
▶ | for (i = 0; i < len; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < len; i++) { |
16 |
3 |
19 |
|
| 848 |
16 |
▶ | if (pdfmake_buf_append_byte(buf, hexdig[str[i] >> 4]) != PDFMAKE_OK) |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_buf_append_byte(buf, hexdig[str[i] >> 4]) != PDFMAKE_OK) |
0 |
16 |
16 |
|
| 849 |
0 |
| return PDFMAKE_EINVAL; |
| 850 |
16 |
▶ | if (pdfmake_buf_append_byte(buf, hexdig[str[i] & 0x0F]) != PDFMAKE_OK) |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_buf_append_byte(buf, hexdig[str[i] & 0x0F]) != PDFMAKE_OK) |
0 |
16 |
16 |
|
| 851 |
0 |
| return PDFMAKE_EINVAL; |
| 852 |
|
| } |
| 853 |
3 |
▶ | if (pdfmake_buf_append_byte(buf, '>') != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_buf_append_byte(buf, '>') != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 854 |
3 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 855 |
3 |
| return append_op(buf, "Tj"); |
| 856 |
|
| } |
| 857 |
|
| |
| 858 |
2 |
| pdfmake_err_t pdfmake_text_TJ(pdfmake_content_t *c, pdfmake_obj_t *array) |
| 859 |
|
| { |
| 860 |
|
| pdfmake_buf_t *buf; |
| 861 |
|
| size_t len; |
| 862 |
|
| size_t i; |
| 863 |
2 |
▶ | if (!c || !array) return PDFMAKE_EINVAL; |
Branch: 2 branches
| Branch | True | False | Total |
| if (!c || !array) return PDFMAKE_EINVAL; |
2 |
0 |
2 |
| if (!c || !array) return PDFMAKE_EINVAL; |
0 |
2 |
2 |
|
| 864 |
2 |
▶ | if (array->kind != PDFMAKE_ARRAY) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (array->kind != PDFMAKE_ARRAY) return PDFMAKE_EINVAL; |
0 |
2 |
2 |
|
| 865 |
|
| |
| 866 |
2 |
| buf = &c->buf; |
| 867 |
|
| |
| 868 |
2 |
▶ | if (pdfmake_buf_append_byte(buf, '[') != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_buf_append_byte(buf, '[') != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
2 |
2 |
|
| 869 |
|
| |
| 870 |
2 |
| len = pdfmake_array_len(array); |
| 871 |
10 |
▶ | for (i = 0; i < len; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < len; i++) { |
8 |
2 |
10 |
|
| 872 |
8 |
| pdfmake_obj_t *elem = pdfmake_array_get(array, i); |
| 873 |
8 |
▶ | if (!elem) continue; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!elem) continue; |
0 |
8 |
8 |
|
| 874 |
|
| |
| 875 |
8 |
▶ | if (elem->kind == PDFMAKE_STR) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (elem->kind == PDFMAKE_STR) { |
5 |
3 |
8 |
|
| 876 |
5 |
▶ | if (append_string(buf, elem->as.str.bytes, elem->as.str.len) |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_string(buf, elem->as.str.bytes, elem->as.str.len) |
0 |
5 |
5 |
|
| 877 |
0 |
| != PDFMAKE_OK) return PDFMAKE_EINVAL; |
| 878 |
3 |
▶ | } else if (elem->kind == PDFMAKE_INT) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (elem->kind == PDFMAKE_INT) { |
0 |
3 |
3 |
|
| 879 |
|
| char tmp[32]; |
| 880 |
0 |
| snprintf(tmp, sizeof(tmp), "%ld", (long)elem->as.i); |
| 881 |
0 |
▶ | if (pdfmake_buf_append_cstr(buf, tmp) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_buf_append_cstr(buf, tmp) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 882 |
3 |
▶ | } else if (elem->kind == PDFMAKE_REAL) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (elem->kind == PDFMAKE_REAL) { |
3 |
0 |
3 |
|
| 883 |
3 |
▶ | if (append_number(buf, elem->as.r) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, elem->as.r) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
3 |
3 |
|
| 884 |
|
| } |
| 885 |
|
| } |
| 886 |
|
| |
| 887 |
2 |
▶ | if (pdfmake_buf_append_cstr(buf, "] TJ\n") != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_buf_append_cstr(buf, "] TJ\n") != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
2 |
2 |
|
| 888 |
2 |
| return PDFMAKE_OK; |
| 889 |
|
| } |
| 890 |
|
| |
| 891 |
1 |
| pdfmake_err_t pdfmake_text_apostrophe(pdfmake_content_t *c, |
| 892 |
|
| const uint8_t *str, size_t len) |
| 893 |
|
| { |
| 894 |
|
| pdfmake_buf_t *buf; |
| 895 |
1 |
▶ | if (!c || !str) return PDFMAKE_EINVAL; |
Branch: 2 branches
| Branch | True | False | Total |
| if (!c || !str) return PDFMAKE_EINVAL; |
1 |
0 |
1 |
| if (!c || !str) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 896 |
1 |
| buf = &c->buf; |
| 897 |
|
| |
| 898 |
1 |
▶ | if (append_string(buf, str, len) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_string(buf, str, len) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 899 |
1 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 900 |
1 |
| return append_op(buf, "'"); |
| 901 |
|
| } |
| 902 |
|
| |
| 903 |
1 |
| pdfmake_err_t pdfmake_text_quote(pdfmake_content_t *c, |
| 904 |
|
| double aw, double ac, |
| 905 |
|
| const uint8_t *str, size_t len) |
| 906 |
|
| { |
| 907 |
|
| pdfmake_buf_t *buf; |
| 908 |
1 |
▶ | if (!c || !str) return PDFMAKE_EINVAL; |
Branch: 2 branches
| Branch | True | False | Total |
| if (!c || !str) return PDFMAKE_EINVAL; |
1 |
0 |
1 |
| if (!c || !str) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 909 |
1 |
| buf = &c->buf; |
| 910 |
|
| |
| 911 |
1 |
▶ | if (append_number(buf, aw) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, aw) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 912 |
1 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 913 |
1 |
▶ | if (append_number(buf, ac) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_number(buf, ac) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 914 |
1 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 915 |
1 |
▶ | if (append_string(buf, str, len) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_string(buf, str, len) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 916 |
1 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 917 |
1 |
| return append_op(buf, "\""); |
| 918 |
|
| } |
| 919 |
|
| |
| 920 |
|
| /*---------------------------------------------------------------------------- |
| 921 |
|
| * XObject operator (§8.8) |
| 922 |
|
| *--------------------------------------------------------------------------*/ |
| 923 |
|
| |
| 924 |
19 |
| pdfmake_err_t pdfmake_xobj_Do(pdfmake_content_t *c, const char *name) |
| 925 |
|
| { |
| 926 |
|
| pdfmake_buf_t *buf; |
| 927 |
19 |
▶ | if (!c || !name) return PDFMAKE_EINVAL; |
Branch: 2 branches
| Branch | True | False | Total |
| if (!c || !name) return PDFMAKE_EINVAL; |
19 |
0 |
19 |
| if (!c || !name) return PDFMAKE_EINVAL; |
0 |
19 |
19 |
|
| 928 |
19 |
| buf = &c->buf; |
| 929 |
|
| |
| 930 |
19 |
▶ | if (append_name(buf, name) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_name(buf, name) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
19 |
19 |
|
| 931 |
19 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
19 |
19 |
|
| 932 |
19 |
| return append_op(buf, "Do"); |
| 933 |
|
| } |
| 934 |
|
| |
| 935 |
|
| /*---------------------------------------------------------------------------- |
| 936 |
|
| * Marked content operators (§14.6) |
| 937 |
|
| *--------------------------------------------------------------------------*/ |
| 938 |
|
| |
| 939 |
0 |
| pdfmake_err_t pdfmake_mc_MP(pdfmake_content_t *c, const char *tag) |
| 940 |
|
| { |
| 941 |
|
| pdfmake_buf_t *buf; |
| 942 |
0 |
▶ | if (!c || !tag) return PDFMAKE_EINVAL; |
Branch: 2 branches
| Branch | True | False | Total |
| if (!c || !tag) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
| if (!c || !tag) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 943 |
0 |
| buf = &c->buf; |
| 944 |
|
| |
| 945 |
0 |
▶ | if (append_name(buf, tag) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_name(buf, tag) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 946 |
0 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 947 |
0 |
| return append_op(buf, "MP"); |
| 948 |
|
| } |
| 949 |
|
| |
| 950 |
0 |
| pdfmake_err_t pdfmake_mc_DP(pdfmake_content_t *c, |
| 951 |
|
| const char *tag, const char *props) |
| 952 |
|
| { |
| 953 |
|
| pdfmake_buf_t *buf; |
| 954 |
0 |
▶ | if (!c || !tag || !props) return PDFMAKE_EINVAL; |
Branch: 3 branches
| Branch | True | False | Total |
| if (!c || !tag || !props) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
| if (!c || !tag || !props) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
| if (!c || !tag || !props) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 955 |
0 |
| buf = &c->buf; |
| 956 |
|
| |
| 957 |
0 |
▶ | if (append_name(buf, tag) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_name(buf, tag) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 958 |
0 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 959 |
0 |
▶ | if (append_name(buf, props) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_name(buf, props) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 960 |
0 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 961 |
0 |
| return append_op(buf, "DP"); |
| 962 |
|
| } |
| 963 |
|
| |
| 964 |
1 |
| pdfmake_err_t pdfmake_mc_BMC(pdfmake_content_t *c, const char *tag) |
| 965 |
|
| { |
| 966 |
|
| pdfmake_buf_t *buf; |
| 967 |
1 |
▶ | if (!c || !tag) return PDFMAKE_EINVAL; |
Branch: 2 branches
| Branch | True | False | Total |
| if (!c || !tag) return PDFMAKE_EINVAL; |
1 |
0 |
1 |
| if (!c || !tag) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 968 |
1 |
| buf = &c->buf; |
| 969 |
|
| |
| 970 |
1 |
▶ | if (append_name(buf, tag) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_name(buf, tag) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 971 |
1 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 972 |
1 |
| return append_op(buf, "BMC"); |
| 973 |
|
| } |
| 974 |
|
| |
| 975 |
7 |
| pdfmake_err_t pdfmake_mc_BDC(pdfmake_content_t *c, |
| 976 |
|
| const char *tag, const char *props) |
| 977 |
|
| { |
| 978 |
|
| pdfmake_buf_t *buf; |
| 979 |
7 |
▶ | if (!c || !tag || !props) return PDFMAKE_EINVAL; |
Branch: 3 branches
| Branch | True | False | Total |
| if (!c || !tag || !props) return PDFMAKE_EINVAL; |
7 |
0 |
7 |
| if (!c || !tag || !props) return PDFMAKE_EINVAL; |
7 |
0 |
7 |
| if (!c || !tag || !props) return PDFMAKE_EINVAL; |
0 |
7 |
7 |
|
| 980 |
7 |
| buf = &c->buf; |
| 981 |
|
| |
| 982 |
7 |
▶ | if (append_name(buf, tag) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_name(buf, tag) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
7 |
7 |
|
| 983 |
7 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
7 |
7 |
|
| 984 |
7 |
▶ | if (append_name(buf, props) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_name(buf, props) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
7 |
7 |
|
| 985 |
7 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
7 |
7 |
|
| 986 |
7 |
| return append_op(buf, "BDC"); |
| 987 |
|
| } |
| 988 |
|
| |
| 989 |
8 |
| pdfmake_err_t pdfmake_mc_EMC(pdfmake_content_t *c) |
| 990 |
|
| { |
| 991 |
8 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
8 |
8 |
|
| 992 |
8 |
| return append_op(&c->buf, "EMC"); |
| 993 |
|
| } |
| 994 |
|
| |
| 995 |
|
| /*---------------------------------------------------------------------------- |
| 996 |
|
| * Shading operator (§8.7.4) |
| 997 |
|
| *--------------------------------------------------------------------------*/ |
| 998 |
|
| |
| 999 |
1 |
| pdfmake_err_t pdfmake_sh(pdfmake_content_t *c, const char *name) |
| 1000 |
|
| { |
| 1001 |
|
| pdfmake_buf_t *buf; |
| 1002 |
1 |
▶ | if (!c || !name) return PDFMAKE_EINVAL; |
Branch: 2 branches
| Branch | True | False | Total |
| if (!c || !name) return PDFMAKE_EINVAL; |
1 |
0 |
1 |
| if (!c || !name) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 1003 |
1 |
| buf = &c->buf; |
| 1004 |
|
| |
| 1005 |
1 |
▶ | if (append_name(buf, name) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_name(buf, name) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 1006 |
1 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 1007 |
1 |
| return append_op(buf, "sh"); |
| 1008 |
|
| } |
| 1009 |
|
| |
| 1010 |
|
| /*---------------------------------------------------------------------------- |
| 1011 |
|
| * Inline image operators (§8.9.7) |
| 1012 |
|
| *--------------------------------------------------------------------------*/ |
| 1013 |
|
| |
| 1014 |
0 |
| pdfmake_err_t pdfmake_inline_BI(pdfmake_content_t *c) |
| 1015 |
|
| { |
| 1016 |
0 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 1017 |
0 |
| return append_op(&c->buf, "BI"); |
| 1018 |
|
| } |
| 1019 |
|
| |
| 1020 |
0 |
| pdfmake_err_t pdfmake_inline_key(pdfmake_content_t *c, |
| 1021 |
|
| const char *key, const char *value) |
| 1022 |
|
| { |
| 1023 |
|
| pdfmake_buf_t *buf; |
| 1024 |
0 |
▶ | if (!c || !key || !value) return PDFMAKE_EINVAL; |
Branch: 3 branches
| Branch | True | False | Total |
| if (!c || !key || !value) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
| if (!c || !key || !value) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
| if (!c || !key || !value) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 1025 |
0 |
| buf = &c->buf; |
| 1026 |
|
| |
| 1027 |
0 |
▶ | if (append_name(buf, key) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_name(buf, key) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 1028 |
0 |
▶ | if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (append_space(buf) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 1029 |
|
| /* Value might be a name or integer - just pass through */ |
| 1030 |
0 |
▶ | if (pdfmake_buf_append_cstr(buf, value) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_buf_append_cstr(buf, value) != PDFMAKE_OK) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 1031 |
0 |
| return append_newline(buf); |
| 1032 |
|
| } |
| 1033 |
|
| |
| 1034 |
0 |
| pdfmake_err_t pdfmake_inline_ID(pdfmake_content_t *c) |
| 1035 |
|
| { |
| 1036 |
0 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 1037 |
|
| /* ID followed by single space before data */ |
| 1038 |
0 |
| return pdfmake_buf_append_cstr(&c->buf, "ID "); |
| 1039 |
|
| } |
| 1040 |
|
| |
| 1041 |
0 |
| pdfmake_err_t pdfmake_inline_data(pdfmake_content_t *c, |
| 1042 |
|
| const uint8_t *data, size_t len) |
| 1043 |
|
| { |
| 1044 |
0 |
▶ | if (!c || !data) return PDFMAKE_EINVAL; |
Branch: 2 branches
| Branch | True | False | Total |
| if (!c || !data) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
| if (!c || !data) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 1045 |
0 |
| return pdfmake_buf_append(&c->buf, data, len); |
| 1046 |
|
| } |
| 1047 |
|
| |
| 1048 |
0 |
| pdfmake_err_t pdfmake_inline_EI(pdfmake_content_t *c) |
| 1049 |
|
| { |
| 1050 |
0 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
0 |
0 |
|
| 1051 |
|
| /* Single space before EI per spec */ |
| 1052 |
0 |
| return pdfmake_buf_append_cstr(&c->buf, " EI\n"); |
| 1053 |
|
| } |
| 1054 |
|
| |
| 1055 |
|
| /*---------------------------------------------------------------------------- |
| 1056 |
|
| * Compatibility operators (§8.4.5) |
| 1057 |
|
| *--------------------------------------------------------------------------*/ |
| 1058 |
|
| |
| 1059 |
1 |
| pdfmake_err_t pdfmake_compat_BX(pdfmake_content_t *c) |
| 1060 |
|
| { |
| 1061 |
1 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 1062 |
1 |
| return append_op(&c->buf, "BX"); |
| 1063 |
|
| } |
| 1064 |
|
| |
| 1065 |
1 |
| pdfmake_err_t pdfmake_compat_EX(pdfmake_content_t *c) |
| 1066 |
|
| { |
| 1067 |
1 |
▶ | if (!c) return PDFMAKE_EINVAL; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return PDFMAKE_EINVAL; |
0 |
1 |
1 |
|
| 1068 |
1 |
| return append_op(&c->buf, "EX"); |
| 1069 |
|
| } |