Rev 1897 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1897 | Rev 3959 | ||
---|---|---|---|
Line 161... | Line 161... | ||
161 | * |
161 | * |
162 | * Note: This stream does not guarantee that the output will never |
162 | * Note: This stream does not guarantee that the output will never |
163 | * exceed max_column. In particular, if a single word is larger than |
163 | * exceed max_column. In particular, if a single word is larger than |
164 | * max_column it will not be broken up. |
164 | * max_column it will not be broken up. |
165 | */ |
165 | */ |
- | 166 | ||
- | 167 | typedef enum _cairo_word_wrap_state { |
|
- | 168 | WRAP_STATE_DELIMITER, |
|
- | 169 | WRAP_STATE_WORD, |
|
- | 170 | WRAP_STATE_STRING, |
|
- | 171 | WRAP_STATE_HEXSTRING |
|
- | 172 | } cairo_word_wrap_state_t; |
|
- | 173 | ||
- | 174 | ||
166 | typedef struct _word_wrap_stream { |
175 | typedef struct _word_wrap_stream { |
167 | cairo_output_stream_t base; |
176 | cairo_output_stream_t base; |
168 | cairo_output_stream_t *output; |
177 | cairo_output_stream_t *output; |
169 | int max_column; |
178 | int max_column; |
170 | int column; |
179 | int column; |
171 | cairo_bool_t last_write_was_space; |
180 | cairo_word_wrap_state_t state; |
172 | cairo_bool_t in_hexstring; |
181 | cairo_bool_t in_escape; |
173 | cairo_bool_t empty_hexstring; |
182 | int escape_digits; |
174 | } word_wrap_stream_t; |
183 | } word_wrap_stream_t; |
Line -... | Line 184... | ||
- | 184 | ||
- | 185 | ||
- | 186 | ||
175 | 187 | /* Emit word bytes up to the next delimiter character */ |
|
- | 188 | static int |
|
176 | static int |
189 | _word_wrap_stream_count_word_up_to (word_wrap_stream_t *stream, |
177 | _count_word_up_to (const unsigned char *s, int length) |
190 | const unsigned char *data, int length) |
- | 191 | { |
|
178 | { |
192 | const unsigned char *s = data; |
Line 179... | Line 193... | ||
179 | int word = 0; |
193 | int count = 0; |
180 | 194 | ||
181 | while (length--) { |
195 | while (length--) { |
182 | if (! (_cairo_isspace (*s) || *s == '<')) { |
196 | if (_cairo_isspace (*s) || *s == '<' || *s == '(') { |
183 | s++; |
- | |
184 | word++; |
- | |
185 | } else { |
197 | stream->state = WRAP_STATE_DELIMITER; |
- | 198 | break; |
|
- | 199 | } |
|
- | 200 | ||
- | 201 | count++; |
|
186 | return word; |
202 | stream->column++; |
Line -... | Line 203... | ||
- | 203 | s++; |
|
- | 204 | } |
|
- | 205 | ||
187 | } |
206 | if (count) |
188 | } |
207 | _cairo_output_stream_write (stream->output, data, count); |
Line 189... | Line 208... | ||
189 | 208 | ||
190 | return word; |
209 | return count; |
191 | } |
210 | } |
192 | 211 | ||
- | 212 | ||
193 | 213 | /* Emit hexstring bytes up to either the end of the ASCII hexstring or the number |
|
194 | /* Count up to either the end of the ASCII hexstring or the number |
214 | * of columns remaining. |
- | 215 | */ |
|
195 | * of columns remaining. |
216 | static int |
- | 217 | _word_wrap_stream_count_hexstring_up_to (word_wrap_stream_t *stream, |
|
Line 196... | Line 218... | ||
196 | */ |
218 | const unsigned char *data, int length) |
- | 219 | { |
|
- | 220 | const unsigned char *s = data; |
|
197 | static int |
221 | int count = 0; |
- | 222 | cairo_bool_t newline = FALSE; |
|
198 | _count_hexstring_up_to (const unsigned char *s, int length, int columns) |
223 | |
199 | { |
224 | while (length--) { |
200 | int word = 0; |
- | |
Line 201... | Line 225... | ||
201 | 225 | count++; |
|
202 | while (length--) { |
226 | stream->column++; |
203 | if (*s++ != '>') |
227 | if (*s == '>') { |
204 | word++; |
228 | stream->state = WRAP_STATE_DELIMITER; |
- | 229 | break; |
|
- | 230 | } |
|
- | 231 | ||
- | 232 | if (stream->column > stream->max_column) { |
|
- | 233 | newline = TRUE; |
|
Line -... | Line 234... | ||
- | 234 | break; |
|
- | 235 | } |
|
- | 236 | s++; |
|
- | 237 | } |
|
- | 238 | ||
- | 239 | if (count) |
|
- | 240 | _cairo_output_stream_write (stream->output, data, count); |
|
- | 241 | ||
- | 242 | if (newline) { |
|
- | 243 | _cairo_output_stream_printf (stream->output, "\n"); |
|
- | 244 | stream->column = 0; |
|
- | 245 | } |
|
- | 246 | ||
- | 247 | return count; |
|
- | 248 | } |
|
- | 249 | ||
- | 250 | /* Count up to either the end of the string or the number of columns |
|
- | 251 | * remaining. |
|
- | 252 | */ |
|
- | 253 | static int |
|
- | 254 | _word_wrap_stream_count_string_up_to (word_wrap_stream_t *stream, |
|
- | 255 | const unsigned char *data, int length) |
|
- | 256 | { |
|
- | 257 | const unsigned char *s = data; |
|
- | 258 | int count = 0; |
|
- | 259 | cairo_bool_t newline = FALSE; |
|
- | 260 | ||
- | 261 | while (length--) { |
|
- | 262 | count++; |
|
- | 263 | stream->column++; |
|
- | 264 | if (!stream->in_escape) { |
|
- | 265 | if (*s == ')') { |
|
- | 266 | stream->state = WRAP_STATE_DELIMITER; |
|
- | 267 | break; |
|
- | 268 | } |
|
- | 269 | if (*s == '\\') { |
|
- | 270 | stream->in_escape = TRUE; |
|
- | 271 | stream->escape_digits = 0; |
|
- | 272 | } else if (stream->column > stream->max_column) { |
|
- | 273 | newline = TRUE; |
|
- | 274 | break; |
|
- | 275 | } |
|
- | 276 | } else { |
|
- | 277 | if (!_cairo_isdigit(*s) || ++stream->escape_digits == 3) |
|
- | 278 | stream->in_escape = FALSE; |
|
- | 279 | } |
|
- | 280 | s++; |
|
- | 281 | } |
|
- | 282 | ||
205 | else |
283 | if (count) |
206 | return word; |
284 | _cairo_output_stream_write (stream->output, data, count); |
Line 207... | Line 285... | ||
207 | 285 | ||
208 | columns--; |
286 | if (newline) { |
209 | if (columns < 0 && word > 1) |
287 | _cairo_output_stream_printf (stream->output, "\\\n"); |
210 | return word; |
288 | stream->column = 0; |
211 | } |
289 | } |
212 | 290 | ||
213 | return word; |
- | |
214 | } |
291 | return count; |
Line 215... | Line 292... | ||
215 | 292 | } |
|
216 | static cairo_status_t |
293 | |
217 | _word_wrap_stream_write (cairo_output_stream_t *base, |
294 | static cairo_status_t |
218 | const unsigned char *data, |
- | |
219 | unsigned int length) |
295 | _word_wrap_stream_write (cairo_output_stream_t *base, |
220 | { |
296 | const unsigned char *data, |
221 | word_wrap_stream_t *stream = (word_wrap_stream_t *) base; |
297 | unsigned int length) |
222 | cairo_bool_t newline; |
298 | { |
223 | int word; |
299 | word_wrap_stream_t *stream = (word_wrap_stream_t *) base; |
224 | 300 | int count; |
|
225 | while (length) { |
- | |
226 | if (*data == '<') { |
301 | |
227 | stream->in_hexstring = TRUE; |
302 | while (length) { |
- | 303 | switch (stream->state) { |
|
228 | stream->empty_hexstring = TRUE; |
304 | case WRAP_STATE_WORD: |
229 | stream->last_write_was_space = FALSE; |
- | |
230 | data++; |
305 | count = _word_wrap_stream_count_word_up_to (stream, data, length); |
231 | length--; |
- | |
232 | _cairo_output_stream_printf (stream->output, "<"); |
- | |
233 | stream->column++; |
306 | break; |
234 | } else if (*data == '>') { |
307 | case WRAP_STATE_HEXSTRING: |
235 | stream->in_hexstring = FALSE; |
308 | count = _word_wrap_stream_count_hexstring_up_to (stream, data, length); |
- | 309 | break; |
|
- | 310 | case WRAP_STATE_STRING: |
|
- | 311 | count = _word_wrap_stream_count_string_up_to (stream, data, length); |
|
- | 312 | break; |
|
- | 313 | case WRAP_STATE_DELIMITER: |
|
- | 314 | count = 1; |
|
236 | stream->last_write_was_space = FALSE; |
315 | stream->column++; |
- | 316 | if (*data == '\n' || stream->column >= stream->max_column) { |
|
237 | data++; |
317 | _cairo_output_stream_printf (stream->output, "\n"); |
238 | length--; |
318 | stream->column = 0; |
239 | _cairo_output_stream_printf (stream->output, ">"); |
- | |
240 | stream->column++; |
- | |
241 | } else if (_cairo_isspace (*data)) { |
- | |
242 | newline = (*data == '\n' || *data == '\r'); |
- | |
243 | if (! newline && stream->column >= stream->max_column) { |
- | |
244 | _cairo_output_stream_printf (stream->output, "\n"); |
- | |
245 | stream->column = 0; |
- | |
246 | } |
- | |
247 | _cairo_output_stream_write (stream->output, data, 1); |
- | |
248 | data++; |
- | |
249 | length--; |
- | |
250 | if (newline) { |
- | |
251 | stream->column = 0; |
- | |
252 | } |
- | |
253 | else |
- | |
254 | stream->column++; |
- | |
255 | stream->last_write_was_space = TRUE; |
- | |
256 | } else { |
- | |
257 | if (stream->in_hexstring) { |
- | |
258 | word = _count_hexstring_up_to (data, length, |
- | |
259 | MAX (stream->max_column - stream->column, 0)); |
- | |
260 | } else { |
- | |
261 | word = _count_word_up_to (data, length); |
319 | } else if (*data == '<') { |
262 | } |
320 | stream->state = WRAP_STATE_HEXSTRING; |
263 | /* Don't wrap if this word is a continuation of a non hex |
- | |
264 | * string word from a previous call to write. */ |
321 | } else if (*data == '(') { |
265 | if (stream->column + word >= stream->max_column) { |
322 | stream->state = WRAP_STATE_STRING; |
266 | if (stream->last_write_was_space || |
323 | } else if (!_cairo_isspace (*data)) { |
267 | (stream->in_hexstring && !stream->empty_hexstring)) |
- | |
268 | { |
- | |
269 | _cairo_output_stream_printf (stream->output, "\n"); |
- | |
270 | stream->column = 0; |
324 | stream->state = WRAP_STATE_WORD; |
- | 325 | } |
|
- | 326 | if (*data != '\n') |
|
271 | } |
327 | _cairo_output_stream_write (stream->output, data, 1); |
Line 272... | Line 328... | ||
272 | } |
328 | break; |
273 | _cairo_output_stream_write (stream->output, data, word); |
329 | |
Line 310... | Line 366... | ||
310 | NULL, |
366 | NULL, |
311 | _word_wrap_stream_close); |
367 | _word_wrap_stream_close); |
312 | stream->output = output; |
368 | stream->output = output; |
313 | stream->max_column = max_column; |
369 | stream->max_column = max_column; |
314 | stream->column = 0; |
370 | stream->column = 0; |
315 | stream->last_write_was_space = FALSE; |
371 | stream->state = WRAP_STATE_DELIMITER; |
316 | stream->in_hexstring = FALSE; |
372 | stream->in_escape = FALSE; |
317 | stream->empty_hexstring = TRUE; |
373 | stream->escape_digits = 0; |
Line 318... | Line 374... | ||
318 | 374 | ||
319 | return &stream->base; |
375 | return &stream->base; |
Line 320... | Line 376... | ||
320 | } |
376 | } |
Line 435... | Line 491... | ||
435 | * stroked, simply pass %CAIRO_LINE_CAP_ROUND which will guarantee that |
491 | * stroked, simply pass %CAIRO_LINE_CAP_ROUND which will guarantee that |
436 | * the stroke workaround will not modify the path being emitted. |
492 | * the stroke workaround will not modify the path being emitted. |
437 | */ |
493 | */ |
438 | static cairo_status_t |
494 | static cairo_status_t |
439 | _cairo_pdf_operators_emit_path (cairo_pdf_operators_t *pdf_operators, |
495 | _cairo_pdf_operators_emit_path (cairo_pdf_operators_t *pdf_operators, |
440 | cairo_path_fixed_t *path, |
496 | const cairo_path_fixed_t*path, |
441 | cairo_matrix_t *path_transform, |
497 | cairo_matrix_t *path_transform, |
442 | cairo_line_cap_t line_cap) |
498 | cairo_line_cap_t line_cap) |
443 | { |
499 | { |
444 | cairo_output_stream_t *word_wrap; |
500 | cairo_output_stream_t *word_wrap; |
445 | cairo_status_t status, status2; |
501 | cairo_status_t status, status2; |
Line 456... | Line 512... | ||
456 | info.line_cap = line_cap; |
512 | info.line_cap = line_cap; |
457 | if (_cairo_path_fixed_is_rectangle (path, &box)) { |
513 | if (_cairo_path_fixed_is_rectangle (path, &box)) { |
458 | status = _cairo_pdf_path_rectangle (&info, &box); |
514 | status = _cairo_pdf_path_rectangle (&info, &box); |
459 | } else { |
515 | } else { |
460 | status = _cairo_path_fixed_interpret (path, |
516 | status = _cairo_path_fixed_interpret (path, |
461 | CAIRO_DIRECTION_FORWARD, |
- | |
462 | _cairo_pdf_path_move_to, |
517 | _cairo_pdf_path_move_to, |
463 | _cairo_pdf_path_line_to, |
518 | _cairo_pdf_path_line_to, |
464 | _cairo_pdf_path_curve_to, |
519 | _cairo_pdf_path_curve_to, |
465 | _cairo_pdf_path_close_path, |
520 | _cairo_pdf_path_close_path, |
466 | &info); |
521 | &info); |
Line 473... | Line 528... | ||
473 | return status; |
528 | return status; |
474 | } |
529 | } |
Line 475... | Line 530... | ||
475 | 530 | ||
476 | cairo_int_status_t |
531 | cairo_int_status_t |
477 | _cairo_pdf_operators_clip (cairo_pdf_operators_t *pdf_operators, |
532 | _cairo_pdf_operators_clip (cairo_pdf_operators_t *pdf_operators, |
478 | cairo_path_fixed_t *path, |
533 | const cairo_path_fixed_t *path, |
479 | cairo_fill_rule_t fill_rule) |
534 | cairo_fill_rule_t fill_rule) |
480 | { |
535 | { |
481 | const char *pdf_operator; |
536 | const char *pdf_operator; |
Line 706... | Line 761... | ||
706 | cairo_matrix_scale (m, s, s); |
761 | cairo_matrix_scale (m, s, s); |
707 | } |
762 | } |
Line 708... | Line 763... | ||
708 | 763 | ||
709 | static cairo_int_status_t |
764 | static cairo_int_status_t |
710 | _cairo_pdf_operators_emit_stroke (cairo_pdf_operators_t *pdf_operators, |
765 | _cairo_pdf_operators_emit_stroke (cairo_pdf_operators_t *pdf_operators, |
711 | cairo_path_fixed_t *path, |
766 | const cairo_path_fixed_t *path, |
712 | const cairo_stroke_style_t *style, |
767 | const cairo_stroke_style_t *style, |
713 | const cairo_matrix_t *ctm, |
768 | const cairo_matrix_t *ctm, |
714 | const cairo_matrix_t *ctm_inverse, |
769 | const cairo_matrix_t *ctm_inverse, |
715 | const char *pdf_operator) |
770 | const char *pdf_operator) |
716 | { |
771 | { |
717 | cairo_status_t status; |
772 | cairo_int_status_t status; |
718 | cairo_matrix_t m, path_transform; |
773 | cairo_matrix_t m, path_transform; |
719 | cairo_bool_t has_ctm = TRUE; |
774 | cairo_bool_t has_ctm = TRUE; |
Line 720... | Line 775... | ||
720 | double scale = 1.0; |
775 | double scale = 1.0; |
Line 797... | Line 852... | ||
797 | return _cairo_output_stream_get_status (pdf_operators->stream); |
852 | return _cairo_output_stream_get_status (pdf_operators->stream); |
798 | } |
853 | } |
Line 799... | Line 854... | ||
799 | 854 | ||
800 | cairo_int_status_t |
855 | cairo_int_status_t |
801 | _cairo_pdf_operators_stroke (cairo_pdf_operators_t *pdf_operators, |
856 | _cairo_pdf_operators_stroke (cairo_pdf_operators_t *pdf_operators, |
802 | cairo_path_fixed_t *path, |
857 | const cairo_path_fixed_t *path, |
803 | const cairo_stroke_style_t *style, |
858 | const cairo_stroke_style_t *style, |
804 | const cairo_matrix_t *ctm, |
859 | const cairo_matrix_t *ctm, |
805 | const cairo_matrix_t *ctm_inverse) |
860 | const cairo_matrix_t *ctm_inverse) |
806 | { |
861 | { |
Line 812... | Line 867... | ||
812 | "S"); |
867 | "S"); |
813 | } |
868 | } |
Line 814... | Line 869... | ||
814 | 869 | ||
815 | cairo_int_status_t |
870 | cairo_int_status_t |
816 | _cairo_pdf_operators_fill (cairo_pdf_operators_t *pdf_operators, |
871 | _cairo_pdf_operators_fill (cairo_pdf_operators_t *pdf_operators, |
817 | cairo_path_fixed_t *path, |
872 | const cairo_path_fixed_t *path, |
818 | cairo_fill_rule_t fill_rule) |
873 | cairo_fill_rule_t fill_rule) |
819 | { |
874 | { |
820 | const char *pdf_operator; |
875 | const char *pdf_operator; |
Line 851... | Line 906... | ||
851 | return _cairo_output_stream_get_status (pdf_operators->stream); |
906 | return _cairo_output_stream_get_status (pdf_operators->stream); |
852 | } |
907 | } |
Line 853... | Line 908... | ||
853 | 908 | ||
854 | cairo_int_status_t |
909 | cairo_int_status_t |
855 | _cairo_pdf_operators_fill_stroke (cairo_pdf_operators_t *pdf_operators, |
910 | _cairo_pdf_operators_fill_stroke (cairo_pdf_operators_t *pdf_operators, |
856 | cairo_path_fixed_t *path, |
911 | const cairo_path_fixed_t *path, |
857 | cairo_fill_rule_t fill_rule, |
912 | cairo_fill_rule_t fill_rule, |
858 | const cairo_stroke_style_t *style, |
913 | const cairo_stroke_style_t *style, |
859 | const cairo_matrix_t *ctm, |
914 | const cairo_matrix_t *ctm, |
860 | const cairo_matrix_t *ctm_inverse) |
915 | const cairo_matrix_t *ctm_inverse) |
Line 878... | Line 933... | ||
878 | ctm, |
933 | ctm, |
879 | ctm_inverse, |
934 | ctm_inverse, |
880 | operator); |
935 | operator); |
881 | } |
936 | } |
Line -... | Line 937... | ||
- | 937 | ||
- | 938 | static void |
|
- | 939 | _cairo_pdf_operators_emit_glyph_index (cairo_pdf_operators_t *pdf_operators, |
|
- | 940 | cairo_output_stream_t *stream, |
|
- | 941 | unsigned int glyph) |
|
- | 942 | { |
|
- | 943 | if (pdf_operators->is_latin) { |
|
- | 944 | if (glyph == '(' || glyph == ')' || glyph == '\\') |
|
- | 945 | _cairo_output_stream_printf (stream, "\\%c", glyph); |
|
- | 946 | else if (glyph >= 0x20 && glyph <= 0x7e) |
|
- | 947 | _cairo_output_stream_printf (stream, "%c", glyph); |
|
- | 948 | else |
|
- | 949 | _cairo_output_stream_printf (stream, "\\%03o", glyph); |
|
- | 950 | } else { |
|
- | 951 | _cairo_output_stream_printf (stream, |
|
- | 952 | "%0*x", |
|
- | 953 | pdf_operators->hex_width, |
|
- | 954 | glyph); |
|
- | 955 | } |
|
- | 956 | } |
|
882 | 957 | ||
Line 883... | Line 958... | ||
883 | #define GLYPH_POSITION_TOLERANCE 0.001 |
958 | #define GLYPH_POSITION_TOLERANCE 0.001 |
884 | 959 | ||
885 | /* Emit the string of glyphs using the 'Tj' operator. This requires |
960 | /* Emit the string of glyphs using the 'Tj' operator. This requires |
886 | * that the glyphs are positioned at their natural glyph advances. */ |
961 | * that the glyphs are positioned at their natural glyph advances. */ |
887 | static cairo_status_t |
962 | static cairo_status_t |
888 | _cairo_pdf_operators_emit_glyph_string (cairo_pdf_operators_t *pdf_operators, |
963 | _cairo_pdf_operators_emit_glyph_string (cairo_pdf_operators_t *pdf_operators, |
889 | cairo_output_stream_t *stream) |
964 | cairo_output_stream_t *stream) |
Line 890... | Line 965... | ||
890 | { |
965 | { |
891 | int i; |
966 | int i; |
892 | 967 | ||
893 | _cairo_output_stream_printf (stream, "<"); |
968 | _cairo_output_stream_printf (stream, "%s", pdf_operators->is_latin ? "(" : "<"); |
894 | for (i = 0; i < pdf_operators->num_glyphs; i++) { |
- | |
895 | _cairo_output_stream_printf (stream, |
969 | for (i = 0; i < pdf_operators->num_glyphs; i++) { |
896 | "%0*x", |
970 | _cairo_pdf_operators_emit_glyph_index (pdf_operators, |
897 | pdf_operators->hex_width, |
971 | stream, |
898 | pdf_operators->glyphs[i].glyph_index); |
972 | pdf_operators->glyphs[i].glyph_index); |
Line 899... | Line 973... | ||
899 | pdf_operators->cur_x += pdf_operators->glyphs[i].x_advance; |
973 | pdf_operators->cur_x += pdf_operators->glyphs[i].x_advance; |
900 | } |
974 | } |
Line 901... | Line 975... | ||
901 | _cairo_output_stream_printf (stream, ">Tj\n"); |
975 | _cairo_output_stream_printf (stream, "%sTj\n", pdf_operators->is_latin ? ")" : ">"); |
Line 916... | Line 990... | ||
916 | cairo_pdf_operators_t *pdf_operators, |
990 | cairo_pdf_operators_t *pdf_operators, |
917 | cairo_output_stream_t *stream) |
991 | cairo_output_stream_t *stream) |
918 | { |
992 | { |
919 | int i; |
993 | int i; |
Line 920... | Line 994... | ||
920 | 994 | ||
921 | _cairo_output_stream_printf (stream, "[<"); |
995 | _cairo_output_stream_printf (stream, "[%s", pdf_operators->is_latin ? "(" : "<"); |
922 | for (i = 0; i < pdf_operators->num_glyphs; i++) { |
996 | for (i = 0; i < pdf_operators->num_glyphs; i++) { |
923 | if (pdf_operators->glyphs[i].x_position != pdf_operators->cur_x) |
997 | if (pdf_operators->glyphs[i].x_position != pdf_operators->cur_x) |
924 | { |
998 | { |
925 | double delta = pdf_operators->glyphs[i].x_position - pdf_operators->cur_x; |
999 | double delta = pdf_operators->glyphs[i].x_position - pdf_operators->cur_x; |
Line 932... | Line 1006... | ||
932 | * that we keep track of the accumulated rounding error in |
1006 | * that we keep track of the accumulated rounding error in |
933 | * the PDF interpreter and compensate for it when |
1007 | * the PDF interpreter and compensate for it when |
934 | * calculating subsequent deltas. |
1008 | * calculating subsequent deltas. |
935 | */ |
1009 | */ |
936 | rounded_delta = _cairo_lround (delta); |
1010 | rounded_delta = _cairo_lround (delta); |
- | 1011 | if (abs(rounded_delta) < 3) |
|
- | 1012 | rounded_delta = 0; |
|
937 | if (rounded_delta != 0) { |
1013 | if (rounded_delta != 0) { |
- | 1014 | if (pdf_operators->is_latin) { |
|
- | 1015 | _cairo_output_stream_printf (stream, |
|
- | 1016 | ")%d(", |
|
- | 1017 | rounded_delta); |
|
- | 1018 | } else { |
|
938 | _cairo_output_stream_printf (stream, |
1019 | _cairo_output_stream_printf (stream, |
939 | ">%d<", |
1020 | ">%d<", |
940 | rounded_delta); |
1021 | rounded_delta); |
941 | } |
1022 | } |
- | 1023 | } |
|
Line 942... | Line 1024... | ||
942 | 1024 | ||
943 | /* Convert the rounded delta back to text |
1025 | /* Convert the rounded delta back to text |
944 | * space before adding to the current text |
1026 | * space before adding to the current text |
945 | * position. */ |
1027 | * position. */ |
946 | delta = rounded_delta/-1000.0; |
1028 | delta = rounded_delta/-1000.0; |
947 | pdf_operators->cur_x += delta; |
1029 | pdf_operators->cur_x += delta; |
Line 948... | Line 1030... | ||
948 | } |
1030 | } |
949 | 1031 | ||
950 | _cairo_output_stream_printf (stream, |
- | |
951 | "%0*x", |
1032 | _cairo_pdf_operators_emit_glyph_index (pdf_operators, |
952 | pdf_operators->hex_width, |
1033 | stream, |
953 | pdf_operators->glyphs[i].glyph_index); |
1034 | pdf_operators->glyphs[i].glyph_index); |
954 | pdf_operators->cur_x += pdf_operators->glyphs[i].x_advance; |
1035 | pdf_operators->cur_x += pdf_operators->glyphs[i].x_advance; |
Line 955... | Line 1036... | ||
955 | } |
1036 | } |
956 | _cairo_output_stream_printf (stream, ">]TJ\n"); |
1037 | _cairo_output_stream_printf (stream, "%s]TJ\n", pdf_operators->is_latin ? ")" : ">"); |
Line 957... | Line 1038... | ||
957 | 1038 | ||
Line 1126... | Line 1207... | ||
1126 | if (unlikely (status)) |
1207 | if (unlikely (status)) |
1127 | return status; |
1208 | return status; |
1128 | } |
1209 | } |
1129 | pdf_operators->font_id = subset_glyph->font_id; |
1210 | pdf_operators->font_id = subset_glyph->font_id; |
1130 | pdf_operators->subset_id = subset_glyph->subset_id; |
1211 | pdf_operators->subset_id = subset_glyph->subset_id; |
- | 1212 | pdf_operators->is_latin = subset_glyph->is_latin; |
|
Line 1131... | Line 1213... | ||
1131 | 1213 | ||
1132 | if (subset_glyph->is_composite) |
1214 | if (subset_glyph->is_composite) |
1133 | pdf_operators->hex_width = 4; |
1215 | pdf_operators->hex_width = 4; |
1134 | else |
1216 | else |