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 40... | Line 40... | ||
40 | 40 | ||
41 | #include "cairo-type3-glyph-surface-private.h" |
41 | #include "cairo-type3-glyph-surface-private.h" |
42 | #include "cairo-output-stream-private.h" |
42 | #include "cairo-output-stream-private.h" |
43 | #include "cairo-recording-surface-private.h" |
43 | #include "cairo-recording-surface-private.h" |
- | 44 | #include "cairo-analysis-surface-private.h" |
|
44 | #include "cairo-analysis-surface-private.h" |
45 | #include "cairo-default-context-private.h" |
- | 46 | #include "cairo-error-private.h" |
|
45 | #include "cairo-error-private.h" |
47 | #include "cairo-image-surface-private.h" |
Line 46... | Line 48... | ||
46 | #include "cairo-surface-clipper-private.h" |
48 | #include "cairo-surface-clipper-private.h" |
Line 47... | Line 49... | ||
47 | 49 | ||
Line 185... | Line 187... | ||
185 | 187 | ||
186 | static cairo_int_status_t |
188 | static cairo_int_status_t |
187 | _cairo_type3_glyph_surface_paint (void *abstract_surface, |
189 | _cairo_type3_glyph_surface_paint (void *abstract_surface, |
188 | cairo_operator_t op, |
190 | cairo_operator_t op, |
189 | const cairo_pattern_t *source, |
191 | const cairo_pattern_t *source, |
190 | cairo_clip_t *clip) |
192 | const cairo_clip_t *clip) |
191 | { |
193 | { |
192 | cairo_type3_glyph_surface_t *surface = abstract_surface; |
194 | cairo_type3_glyph_surface_t *surface = abstract_surface; |
193 | const cairo_surface_pattern_t *pattern; |
195 | const cairo_surface_pattern_t *pattern; |
194 | cairo_image_surface_t *image; |
196 | cairo_image_surface_t *image; |
Line 221... | Line 223... | ||
221 | static cairo_int_status_t |
223 | static cairo_int_status_t |
222 | _cairo_type3_glyph_surface_mask (void *abstract_surface, |
224 | _cairo_type3_glyph_surface_mask (void *abstract_surface, |
223 | cairo_operator_t op, |
225 | cairo_operator_t op, |
224 | const cairo_pattern_t *source, |
226 | const cairo_pattern_t *source, |
225 | const cairo_pattern_t *mask, |
227 | const cairo_pattern_t *mask, |
226 | cairo_clip_t *clip) |
228 | const cairo_clip_t *clip) |
227 | { |
229 | { |
228 | return _cairo_type3_glyph_surface_paint (abstract_surface, |
230 | return _cairo_type3_glyph_surface_paint (abstract_surface, |
229 | op, mask, |
231 | op, mask, |
230 | clip); |
232 | clip); |
231 | } |
233 | } |
Line 232... | Line 234... | ||
232 | 234 | ||
233 | static cairo_int_status_t |
235 | static cairo_int_status_t |
234 | _cairo_type3_glyph_surface_stroke (void *abstract_surface, |
236 | _cairo_type3_glyph_surface_stroke (void *abstract_surface, |
235 | cairo_operator_t op, |
237 | cairo_operator_t op, |
236 | const cairo_pattern_t *source, |
238 | const cairo_pattern_t *source, |
237 | cairo_path_fixed_t *path, |
239 | const cairo_path_fixed_t *path, |
238 | const cairo_stroke_style_t *style, |
240 | const cairo_stroke_style_t *style, |
239 | const cairo_matrix_t *ctm, |
241 | const cairo_matrix_t *ctm, |
240 | const cairo_matrix_t *ctm_inverse, |
242 | const cairo_matrix_t *ctm_inverse, |
241 | double tolerance, |
243 | double tolerance, |
242 | cairo_antialias_t antialias, |
244 | cairo_antialias_t antialias, |
243 | cairo_clip_t *clip) |
245 | const cairo_clip_t *clip) |
244 | { |
246 | { |
245 | cairo_type3_glyph_surface_t *surface = abstract_surface; |
247 | cairo_type3_glyph_surface_t *surface = abstract_surface; |
Line 246... | Line 248... | ||
246 | cairo_int_status_t status; |
248 | cairo_int_status_t status; |
Line 258... | Line 260... | ||
258 | 260 | ||
259 | static cairo_int_status_t |
261 | static cairo_int_status_t |
260 | _cairo_type3_glyph_surface_fill (void *abstract_surface, |
262 | _cairo_type3_glyph_surface_fill (void *abstract_surface, |
261 | cairo_operator_t op, |
263 | cairo_operator_t op, |
262 | const cairo_pattern_t *source, |
264 | const cairo_pattern_t *source, |
263 | cairo_path_fixed_t *path, |
265 | const cairo_path_fixed_t *path, |
264 | cairo_fill_rule_t fill_rule, |
266 | cairo_fill_rule_t fill_rule, |
265 | double tolerance, |
267 | double tolerance, |
266 | cairo_antialias_t antialias, |
268 | cairo_antialias_t antialias, |
267 | cairo_clip_t *clip) |
269 | const cairo_clip_t *clip) |
268 | { |
270 | { |
269 | cairo_type3_glyph_surface_t *surface = abstract_surface; |
271 | cairo_type3_glyph_surface_t *surface = abstract_surface; |
Line 270... | Line 272... | ||
270 | cairo_int_status_t status; |
272 | cairo_int_status_t status; |
Line 283... | Line 285... | ||
283 | cairo_operator_t op, |
285 | cairo_operator_t op, |
284 | const cairo_pattern_t *source, |
286 | const cairo_pattern_t *source, |
285 | cairo_glyph_t *glyphs, |
287 | cairo_glyph_t *glyphs, |
286 | int num_glyphs, |
288 | int num_glyphs, |
287 | cairo_scaled_font_t *scaled_font, |
289 | cairo_scaled_font_t *scaled_font, |
288 | cairo_clip_t *clip, |
290 | const cairo_clip_t *clip) |
289 | int *remaining_glyphs) |
- | |
290 | { |
291 | { |
291 | cairo_type3_glyph_surface_t *surface = abstract_surface; |
292 | cairo_type3_glyph_surface_t *surface = abstract_surface; |
292 | cairo_int_status_t status; |
293 | cairo_int_status_t status; |
293 | cairo_scaled_font_t *font; |
294 | cairo_scaled_font_t *font; |
294 | cairo_matrix_t new_ctm, invert_y_axis; |
295 | cairo_matrix_t new_ctm, invert_y_axis; |
Line 319... | Line 320... | ||
319 | return status; |
320 | return status; |
320 | } |
321 | } |
Line 321... | Line 322... | ||
321 | 322 | ||
322 | static const cairo_surface_backend_t cairo_type3_glyph_surface_backend = { |
323 | static const cairo_surface_backend_t cairo_type3_glyph_surface_backend = { |
323 | CAIRO_INTERNAL_SURFACE_TYPE_TYPE3_GLYPH, |
- | |
324 | NULL, /* _cairo_type3_glyph_surface_create_similar */ |
324 | CAIRO_INTERNAL_SURFACE_TYPE_TYPE3_GLYPH, |
- | 325 | _cairo_type3_glyph_surface_finish, |
|
- | 326 | ||
- | 327 | _cairo_default_context_create, /* XXX usable through a context? */ |
|
- | 328 | ||
- | 329 | NULL, /* create similar */ |
|
- | 330 | NULL, /* create similar image */ |
|
- | 331 | NULL, /* map to image */ |
|
- | 332 | NULL, /* unmap image */ |
|
- | 333 | ||
325 | _cairo_type3_glyph_surface_finish, |
334 | NULL, /* source */ |
326 | NULL, /* acquire_source_image */ |
335 | NULL, /* acquire_source_image */ |
327 | NULL, /* release_source_image */ |
- | |
328 | NULL, /* acquire_dest_image */ |
- | |
329 | NULL, /* release_dest_image */ |
336 | NULL, /* release_source_image */ |
- | 337 | NULL, /* snapshot */ |
|
330 | NULL, /* clone_similar */ |
338 | |
331 | NULL, /* composite */ |
339 | NULL, /* copy page */ |
332 | NULL, /* fill_rectangles */ |
- | |
333 | NULL, /* composite_trapezoids */ |
- | |
334 | NULL, /* create_span_renderer */ |
- | |
335 | NULL, /* check_span_renderer */ |
- | |
336 | NULL, /* cairo_type3_glyph_surface_copy_page */ |
- | |
- | 340 | NULL, /* show page */ |
|
337 | NULL, /* _cairo_type3_glyph_surface_show_page */ |
341 | |
338 | NULL, /* _cairo_type3_glyph_surface_get_extents */ |
- | |
339 | NULL, /* old_show_glyphs */ |
342 | NULL, /* _cairo_type3_glyph_surface_get_extents */ |
- | 343 | NULL, /* _cairo_type3_glyph_surface_get_font_options */ |
|
340 | NULL, /* _cairo_type3_glyph_surface_get_font_options */ |
344 | |
341 | NULL, /* flush */ |
345 | NULL, /* flush */ |
342 | NULL, /* mark_dirty_rectangle */ |
- | |
343 | NULL, /* scaled_font_fini */ |
- | |
- | 346 | NULL, /* mark_dirty_rectangle */ |
|
344 | NULL, /* scaled_glyph_fini */ |
347 | |
345 | _cairo_type3_glyph_surface_paint, |
348 | _cairo_type3_glyph_surface_paint, |
346 | _cairo_type3_glyph_surface_mask, |
349 | _cairo_type3_glyph_surface_mask, |
347 | _cairo_type3_glyph_surface_stroke, |
350 | _cairo_type3_glyph_surface_stroke, |
- | 351 | _cairo_type3_glyph_surface_fill, |
|
348 | _cairo_type3_glyph_surface_fill, |
352 | NULL, /* fill-stroke */ |
349 | _cairo_type3_glyph_surface_show_glyphs, |
- | |
350 | NULL, /* snapshot */ |
353 | _cairo_type3_glyph_surface_show_glyphs, |
Line 351... | Line 354... | ||
351 | }; |
354 | }; |
352 | 355 | ||
353 | static void |
356 | static void |
Line 413... | Line 416... | ||
413 | _cairo_type3_glyph_surface_analyze_glyph (void *abstract_surface, |
416 | _cairo_type3_glyph_surface_analyze_glyph (void *abstract_surface, |
414 | unsigned long glyph_index) |
417 | unsigned long glyph_index) |
415 | { |
418 | { |
416 | cairo_type3_glyph_surface_t *surface = abstract_surface; |
419 | cairo_type3_glyph_surface_t *surface = abstract_surface; |
417 | cairo_scaled_glyph_t *scaled_glyph; |
420 | cairo_scaled_glyph_t *scaled_glyph; |
418 | cairo_status_t status, status2; |
421 | cairo_int_status_t status, status2; |
419 | cairo_output_stream_t *null_stream; |
422 | cairo_output_stream_t *null_stream; |
Line 420... | Line 423... | ||
420 | 423 | ||
421 | if (unlikely (surface->base.status)) |
424 | if (unlikely (surface->base.status)) |
Line 431... | Line 434... | ||
431 | status = _cairo_scaled_glyph_lookup (surface->scaled_font, |
434 | status = _cairo_scaled_glyph_lookup (surface->scaled_font, |
432 | glyph_index, |
435 | glyph_index, |
433 | CAIRO_SCALED_GLYPH_INFO_RECORDING_SURFACE, |
436 | CAIRO_SCALED_GLYPH_INFO_RECORDING_SURFACE, |
434 | &scaled_glyph); |
437 | &scaled_glyph); |
Line 435... | Line 438... | ||
435 | 438 | ||
436 | if (_cairo_status_is_error (status)) |
439 | if (_cairo_int_status_is_error (status)) |
Line 437... | Line 440... | ||
437 | goto cleanup; |
440 | goto cleanup; |
438 | 441 | ||
439 | if (status == CAIRO_INT_STATUS_UNSUPPORTED) { |
442 | if (status == CAIRO_INT_STATUS_UNSUPPORTED) { |
440 | status = CAIRO_STATUS_SUCCESS; |
443 | status = CAIRO_INT_STATUS_SUCCESS; |
Line 441... | Line 444... | ||
441 | goto cleanup; |
444 | goto cleanup; |
442 | } |
445 | } |
443 | 446 | ||
444 | status = _cairo_recording_surface_replay (scaled_glyph->recording_surface, |
447 | status = _cairo_recording_surface_replay (scaled_glyph->recording_surface, |
Line 445... | Line 448... | ||
445 | &surface->base); |
448 | &surface->base); |
446 | if (unlikely (status)) |
449 | if (unlikely (status)) |
447 | goto cleanup; |
450 | goto cleanup; |
Line 448... | Line 451... | ||
448 | 451 | ||
449 | status = _cairo_pdf_operators_flush (&surface->pdf_operators); |
452 | status = _cairo_pdf_operators_flush (&surface->pdf_operators); |
Line 450... | Line 453... | ||
450 | if (status == CAIRO_INT_STATUS_IMAGE_FALLBACK) |
453 | if (status == CAIRO_INT_STATUS_IMAGE_FALLBACK) |
451 | status = CAIRO_STATUS_SUCCESS; |
454 | status = CAIRO_INT_STATUS_SUCCESS; |
452 | 455 | ||
Line 453... | Line 456... | ||
453 | cleanup: |
456 | cleanup: |
454 | _cairo_scaled_font_thaw_cache (surface->scaled_font); |
457 | _cairo_scaled_font_thaw_cache (surface->scaled_font); |
Line 467... | Line 470... | ||
467 | cairo_box_t *bbox, |
470 | cairo_box_t *bbox, |
468 | double *width) |
471 | double *width) |
469 | { |
472 | { |
470 | cairo_type3_glyph_surface_t *surface = abstract_surface; |
473 | cairo_type3_glyph_surface_t *surface = abstract_surface; |
471 | cairo_scaled_glyph_t *scaled_glyph; |
474 | cairo_scaled_glyph_t *scaled_glyph; |
472 | cairo_status_t status, status2; |
475 | cairo_int_status_t status, status2; |
473 | double x_advance, y_advance; |
476 | double x_advance, y_advance; |
474 | cairo_matrix_t font_matrix_inverse; |
477 | cairo_matrix_t font_matrix_inverse; |
Line 475... | Line 478... | ||
475 | 478 | ||
476 | if (unlikely (surface->base.status)) |
479 | if (unlikely (surface->base.status)) |
Line 487... | Line 490... | ||
487 | if (status == CAIRO_INT_STATUS_UNSUPPORTED) { |
490 | if (status == CAIRO_INT_STATUS_UNSUPPORTED) { |
488 | status = _cairo_scaled_glyph_lookup (surface->scaled_font, |
491 | status = _cairo_scaled_glyph_lookup (surface->scaled_font, |
489 | glyph_index, |
492 | glyph_index, |
490 | CAIRO_SCALED_GLYPH_INFO_METRICS, |
493 | CAIRO_SCALED_GLYPH_INFO_METRICS, |
491 | &scaled_glyph); |
494 | &scaled_glyph); |
492 | if (status == CAIRO_STATUS_SUCCESS) |
495 | if (status == CAIRO_INT_STATUS_SUCCESS) |
493 | status = CAIRO_INT_STATUS_IMAGE_FALLBACK; |
496 | status = CAIRO_INT_STATUS_IMAGE_FALLBACK; |
494 | } |
497 | } |
495 | if (_cairo_status_is_error (status)) { |
498 | if (_cairo_int_status_is_error (status)) { |
496 | _cairo_scaled_font_thaw_cache (surface->scaled_font); |
499 | _cairo_scaled_font_thaw_cache (surface->scaled_font); |
497 | return status; |
500 | return status; |
498 | } |
501 | } |
Line 499... | Line 502... | ||
499 | 502 | ||
Line 503... | Line 506... | ||
503 | status2 = cairo_matrix_invert (&font_matrix_inverse); |
506 | status2 = cairo_matrix_invert (&font_matrix_inverse); |
Line 504... | Line 507... | ||
504 | 507 | ||
505 | /* The invertability of font_matrix is tested in |
508 | /* The invertability of font_matrix is tested in |
506 | * pdf_operators_show_glyphs before any glyphs are mapped to the |
509 | * pdf_operators_show_glyphs before any glyphs are mapped to the |
507 | * subset. */ |
510 | * subset. */ |
Line 508... | Line 511... | ||
508 | assert (status2 == CAIRO_STATUS_SUCCESS); |
511 | assert (status2 == CAIRO_INT_STATUS_SUCCESS); |
509 | 512 | ||
Line 510... | Line 513... | ||
510 | cairo_matrix_transform_distance (&font_matrix_inverse, &x_advance, &y_advance); |
513 | cairo_matrix_transform_distance (&font_matrix_inverse, &x_advance, &y_advance); |
Line 520... | Line 523... | ||
520 | _cairo_fixed_to_double (bbox->p1.x), |
523 | _cairo_fixed_to_double (bbox->p1.x), |
521 | - _cairo_fixed_to_double (bbox->p2.y), |
524 | - _cairo_fixed_to_double (bbox->p2.y), |
522 | _cairo_fixed_to_double (bbox->p2.x), |
525 | _cairo_fixed_to_double (bbox->p2.x), |
523 | - _cairo_fixed_to_double (bbox->p1.y)); |
526 | - _cairo_fixed_to_double (bbox->p1.y)); |
Line 524... | Line 527... | ||
524 | 527 | ||
525 | if (status == CAIRO_STATUS_SUCCESS) { |
528 | if (status == CAIRO_INT_STATUS_SUCCESS) { |
Line 526... | Line 529... | ||
526 | cairo_output_stream_t *mem_stream; |
529 | cairo_output_stream_t *mem_stream; |
527 | 530 | ||
528 | mem_stream = _cairo_memory_stream_create (); |
531 | mem_stream = _cairo_memory_stream_create (); |
Line 535... | Line 538... | ||
535 | _cairo_output_stream_printf (surface->stream, "q\n"); |
538 | _cairo_output_stream_printf (surface->stream, "q\n"); |
536 | status = _cairo_recording_surface_replay (scaled_glyph->recording_surface, |
539 | status = _cairo_recording_surface_replay (scaled_glyph->recording_surface, |
537 | &surface->base); |
540 | &surface->base); |
Line 538... | Line 541... | ||
538 | 541 | ||
539 | status2 = _cairo_pdf_operators_flush (&surface->pdf_operators); |
542 | status2 = _cairo_pdf_operators_flush (&surface->pdf_operators); |
540 | if (status == CAIRO_STATUS_SUCCESS) |
543 | if (status == CAIRO_INT_STATUS_SUCCESS) |
Line 541... | Line 544... | ||
541 | status = status2; |
544 | status = status2; |
Line 542... | Line 545... | ||
542 | 545 | ||
543 | _cairo_output_stream_printf (surface->stream, "Q\n"); |
546 | _cairo_output_stream_printf (surface->stream, "Q\n"); |
544 | 547 | ||
Line 545... | Line 548... | ||
545 | _cairo_type3_glyph_surface_set_stream (surface, stream); |
548 | _cairo_type3_glyph_surface_set_stream (surface, stream); |
546 | if (status == CAIRO_STATUS_SUCCESS) |
549 | if (status == CAIRO_INT_STATUS_SUCCESS) |
547 | _cairo_memory_stream_copy (mem_stream, stream); |
550 | _cairo_memory_stream_copy (mem_stream, stream); |
548 | 551 | ||
Line 549... | Line 552... | ||
549 | status2 = _cairo_output_stream_destroy (mem_stream); |
552 | status2 = _cairo_output_stream_destroy (mem_stream); |
550 | if (status == CAIRO_STATUS_SUCCESS) |
553 | if (status == CAIRO_INT_STATUS_SUCCESS) |