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 33... | Line 33... | ||
33 | * Adrian Johnson |
33 | * Adrian Johnson |
34 | */ |
34 | */ |
Line 35... | Line 35... | ||
35 | 35 | ||
36 | #define _BSD_SOURCE /* for snprintf(), strdup() */ |
36 | #define _BSD_SOURCE /* for snprintf(), strdup() */ |
- | 37 | #include "cairoint.h" |
|
- | 38 | ||
37 | #include "cairoint.h" |
39 | #include "cairo-array-private.h" |
Line 38... | Line 40... | ||
38 | #include "cairo-error-private.h" |
40 | #include "cairo-error-private.h" |
Line 39... | Line 41... | ||
39 | 41 | ||
Line 144... | Line 146... | ||
144 | */ |
146 | */ |
145 | static void |
147 | static void |
146 | charstring_encode_command (cairo_array_t *data, int command) |
148 | charstring_encode_command (cairo_array_t *data, int command) |
147 | { |
149 | { |
148 | cairo_status_t status; |
150 | cairo_status_t status; |
149 | int orig_size; |
151 | unsigned int orig_size; |
150 | unsigned char buf[5]; |
152 | unsigned char buf[5]; |
151 | unsigned char *p = buf; |
153 | unsigned char *p = buf; |
Line 152... | Line 154... | ||
152 | 154 | ||
153 | if (command & 0xff00) |
155 | if (command & 0xff00) |
Line 171... | Line 173... | ||
171 | charstring_encode_integer (cairo_array_t *data, |
173 | charstring_encode_integer (cairo_array_t *data, |
172 | int i, |
174 | int i, |
173 | cairo_charstring_type_t type) |
175 | cairo_charstring_type_t type) |
174 | { |
176 | { |
175 | cairo_status_t status; |
177 | cairo_status_t status; |
176 | int orig_size; |
178 | unsigned int orig_size; |
177 | unsigned char buf[10]; |
179 | unsigned char buf[10]; |
178 | unsigned char *p = buf; |
180 | unsigned char *p = buf; |
Line 179... | Line 181... | ||
179 | 181 | ||
180 | if (i >= -107 && i <= 107) { |
182 | if (i >= -107 && i <= 107) { |
Line 405... | Line 407... | ||
405 | } |
407 | } |
406 | path_info.data = data; |
408 | path_info.data = data; |
407 | path_info.type = type; |
409 | path_info.type = type; |
408 | if (emit_path) { |
410 | if (emit_path) { |
409 | status = _cairo_path_fixed_interpret (scaled_glyph->path, |
411 | status = _cairo_path_fixed_interpret (scaled_glyph->path, |
410 | CAIRO_DIRECTION_FORWARD, |
- | |
411 | _charstring_move_to, |
412 | _charstring_move_to, |
412 | _charstring_line_to, |
413 | _charstring_line_to, |
413 | _charstring_curve_to, |
414 | _charstring_curve_to, |
414 | _charstring_close_path, |
415 | _charstring_close_path, |
415 | &path_info); |
416 | &path_info); |
Line 512... | Line 513... | ||
512 | 513 | ||
513 | _cairo_output_stream_printf (font->output, |
514 | _cairo_output_stream_printf (font->output, |
514 | "} readonly def\n" |
515 | "} readonly def\n" |
515 | "/Encoding 256 array\n" |
516 | "/Encoding 256 array\n" |
- | 517 | "0 1 255 {1 index exch /.notdef put} for\n"); |
|
- | 518 | if (font->scaled_font_subset->is_latin) { |
|
- | 519 | for (i = 1; i < 256; i++) { |
|
- | 520 | int subset_glyph = font->scaled_font_subset->latin_to_subset_glyph_index[i]; |
|
- | 521 | ||
- | 522 | if (subset_glyph > 0) { |
|
- | 523 | if (font->scaled_font_subset->glyph_names != NULL) { |
|
- | 524 | _cairo_output_stream_printf (font->output, "dup %d /%s put\n", |
|
- | 525 | i, font->scaled_font_subset->glyph_names[subset_glyph]); |
|
- | 526 | } else { |
|
- | 527 | _cairo_output_stream_printf (font->output, "dup %d /g%d put\n", i, subset_glyph); |
|
- | 528 | } |
|
- | 529 | } |
|
- | 530 | } |
|
516 | "0 1 255 {1 index exch /.notdef put} for\n"); |
531 | } else { |
517 | for (i = 1; i < font->scaled_font_subset->num_glyphs; i++) { |
532 | for (i = 1; i < font->scaled_font_subset->num_glyphs; i++) { |
518 | if (font->scaled_font_subset->glyph_names != NULL) { |
533 | if (font->scaled_font_subset->glyph_names != NULL) { |
519 | _cairo_output_stream_printf (font->output, "dup %d /%s put\n", |
534 | _cairo_output_stream_printf (font->output, "dup %d /%s put\n", |
520 | i, font->scaled_font_subset->glyph_names[i]); |
535 | i, font->scaled_font_subset->glyph_names[i]); |
521 | } else { |
536 | } else { |
522 | _cairo_output_stream_printf (font->output, "dup %d /g%d put\n", i, i); |
537 | _cairo_output_stream_printf (font->output, "dup %d /g%d put\n", i, i); |
523 | } |
538 | } |
- | 539 | } |
|
524 | } |
540 | } |
525 | _cairo_output_stream_printf (font->output, |
541 | _cairo_output_stream_printf (font->output, |
526 | "readonly def\n" |
542 | "readonly def\n" |
527 | "currentdict end\n" |
543 | "currentdict end\n" |
528 | "currentfile eexec\n"); |
544 | "currentfile eexec\n"); |
Line 610... | Line 626... | ||
610 | "dup /FontName get exch definefont pop\n" |
626 | "dup /FontName get exch definefont pop\n" |
611 | "mark currentfile closefile\n"); |
627 | "mark currentfile closefile\n"); |
Line 612... | Line 628... | ||
612 | 628 | ||
613 | fail: |
629 | fail: |
614 | status2 = _cairo_output_stream_destroy (encrypted_output); |
630 | status2 = _cairo_output_stream_destroy (encrypted_output); |
615 | if (status == CAIRO_STATUS_SUCCESS) |
631 | if (status == CAIRO_INT_STATUS_SUCCESS) |
Line 616... | Line 632... | ||
616 | status = status2; |
632 | status = status2; |
617 | 633 |