mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-07 19:30:41 +01:00
Change PDF newline characters from \r\n to \n
The PDF backend has always used "\r\n" for the newline character. There was no particular reason for this choice. PDF allows "\n", "\r", or "\r\n" as the end of line marker. Since the PS backend (which uses "\n") has started sharing cairo-pdf-operators.c with the PDF backend, the PS output has been getting mixed "\n" and "\r\n" newlines. Fix this by changing the PDF backend to use "\n".
This commit is contained in:
parent
24c319fbae
commit
eaaa1415a9
2 changed files with 459 additions and 459 deletions
|
|
@ -323,7 +323,7 @@ _cairo_pdf_path_close_path (void *closure)
|
|||
}
|
||||
|
||||
_cairo_output_stream_printf (info->output,
|
||||
"h\r\n");
|
||||
"h\n");
|
||||
|
||||
return _cairo_output_stream_get_status (info->output);
|
||||
}
|
||||
|
|
@ -402,7 +402,7 @@ _cairo_pdf_operators_clip (cairo_pdf_operators_t *pdf_operators,
|
|||
}
|
||||
|
||||
_cairo_output_stream_printf (pdf_operators->stream,
|
||||
"%s n\r\n",
|
||||
"%s n\n",
|
||||
pdf_operator);
|
||||
|
||||
return _cairo_output_stream_get_status (pdf_operators->stream);
|
||||
|
|
@ -512,15 +512,15 @@ _cairo_pdf_operators_emit_stroke_style (cairo_pdf_operators_t *pdf_operators,
|
|||
}
|
||||
|
||||
_cairo_output_stream_printf (pdf_operators->stream,
|
||||
"%f w\r\n",
|
||||
"%f w\n",
|
||||
style->line_width);
|
||||
|
||||
_cairo_output_stream_printf (pdf_operators->stream,
|
||||
"%d J\r\n",
|
||||
"%d J\n",
|
||||
_cairo_pdf_line_cap (style->line_cap));
|
||||
|
||||
_cairo_output_stream_printf (pdf_operators->stream,
|
||||
"%d j\r\n",
|
||||
"%d j\n",
|
||||
_cairo_pdf_line_join (style->line_join));
|
||||
|
||||
if (num_dashes) {
|
||||
|
|
@ -529,10 +529,10 @@ _cairo_pdf_operators_emit_stroke_style (cairo_pdf_operators_t *pdf_operators,
|
|||
_cairo_output_stream_printf (pdf_operators->stream, "[");
|
||||
for (d = 0; d < num_dashes; d++)
|
||||
_cairo_output_stream_printf (pdf_operators->stream, " %f", dash[d]);
|
||||
_cairo_output_stream_printf (pdf_operators->stream, "] %f d\r\n",
|
||||
_cairo_output_stream_printf (pdf_operators->stream, "] %f d\n",
|
||||
dash_offset);
|
||||
} else {
|
||||
_cairo_output_stream_printf (pdf_operators->stream, "[] 0.0 d\r\n");
|
||||
_cairo_output_stream_printf (pdf_operators->stream, "[] 0.0 d\n");
|
||||
}
|
||||
if (dash != style->dash)
|
||||
free (dash);
|
||||
|
|
@ -563,7 +563,7 @@ _cairo_pdf_operators_stroke (cairo_pdf_operators_t *pdf_operators,
|
|||
|
||||
cairo_matrix_multiply (&m, ctm, &pdf_operators->cairo_to_pdf);
|
||||
_cairo_output_stream_printf (pdf_operators->stream,
|
||||
"q %f %f %f %f %f %f cm\r\n",
|
||||
"q %f %f %f %f %f %f cm\n",
|
||||
m.xx, m.yx, m.xy, m.yy,
|
||||
m.x0, m.y0);
|
||||
|
||||
|
|
@ -574,7 +574,7 @@ _cairo_pdf_operators_stroke (cairo_pdf_operators_t *pdf_operators,
|
|||
if (status)
|
||||
return status;
|
||||
|
||||
_cairo_output_stream_printf (pdf_operators->stream, "S Q\r\n");
|
||||
_cairo_output_stream_printf (pdf_operators->stream, "S Q\n");
|
||||
|
||||
return _cairo_output_stream_get_status (pdf_operators->stream);
|
||||
}
|
||||
|
|
@ -606,7 +606,7 @@ _cairo_pdf_operators_fill (cairo_pdf_operators_t *pdf_operators,
|
|||
}
|
||||
|
||||
_cairo_output_stream_printf (pdf_operators->stream,
|
||||
"%s\r\n",
|
||||
"%s\n",
|
||||
pdf_operator);
|
||||
|
||||
return _cairo_output_stream_get_status (pdf_operators->stream);
|
||||
|
|
@ -632,7 +632,7 @@ _cairo_pdf_operators_fill_stroke (cairo_pdf_operators_t *pdf_operators,
|
|||
|
||||
cairo_matrix_multiply (&m, ctm, &pdf_operators->cairo_to_pdf);
|
||||
_cairo_output_stream_printf (pdf_operators->stream,
|
||||
"q %f %f %f %f %f %f cm\r\n",
|
||||
"q %f %f %f %f %f %f cm\n",
|
||||
m.xx, m.yx, m.xy, m.yy,
|
||||
m.x0, m.y0);
|
||||
|
||||
|
|
@ -655,7 +655,7 @@ _cairo_pdf_operators_fill_stroke (cairo_pdf_operators_t *pdf_operators,
|
|||
}
|
||||
|
||||
_cairo_output_stream_printf (pdf_operators->stream,
|
||||
"%s Q\r\n",
|
||||
"%s Q\n",
|
||||
pdf_operator);
|
||||
|
||||
return _cairo_output_stream_get_status (pdf_operators->stream);
|
||||
|
|
@ -687,7 +687,7 @@ _cairo_pdf_operators_show_glyphs (cairo_pdf_operators_t *pdf_operators,
|
|||
return status;
|
||||
|
||||
_cairo_output_stream_printf (word_wrap_stream,
|
||||
"BT\r\n");
|
||||
"BT\n");
|
||||
|
||||
if (scaled_font->scale.xy == 0.0 &&
|
||||
scaled_font->scale.yx == 0.0)
|
||||
|
|
@ -717,11 +717,11 @@ _cairo_pdf_operators_show_glyphs (cairo_pdf_operators_t *pdf_operators,
|
|||
|
||||
if (subset_glyph.subset_id != current_subset_id) {
|
||||
if (in_TJ) {
|
||||
_cairo_output_stream_printf (word_wrap_stream, ">] TJ\r\n");
|
||||
_cairo_output_stream_printf (word_wrap_stream, ">] TJ\n");
|
||||
in_TJ = FALSE;
|
||||
}
|
||||
_cairo_output_stream_printf (word_wrap_stream,
|
||||
"/f-%d-%d 1 Tf\r\n",
|
||||
"/f-%d-%d 1 Tf\n",
|
||||
subset_glyph.font_id,
|
||||
subset_glyph.subset_id);
|
||||
if (pdf_operators->use_font_subset) {
|
||||
|
|
@ -735,7 +735,7 @@ _cairo_pdf_operators_show_glyphs (cairo_pdf_operators_t *pdf_operators,
|
|||
|
||||
if (subset_glyph.subset_id != current_subset_id || !diagonal) {
|
||||
_cairo_output_stream_printf (word_wrap_stream,
|
||||
"%f %f %f %f %f %f Tm\r\n",
|
||||
"%f %f %f %f %f %f Tm\n",
|
||||
scaled_font->scale.xx,
|
||||
-scaled_font->scale.yx,
|
||||
-scaled_font->scale.xy,
|
||||
|
|
@ -756,7 +756,7 @@ _cairo_pdf_operators_show_glyphs (cairo_pdf_operators_t *pdf_operators,
|
|||
if (!in_TJ) {
|
||||
if (i != 0) {
|
||||
_cairo_output_stream_printf (word_wrap_stream,
|
||||
"%f %f Td\r\n",
|
||||
"%f %f Td\n",
|
||||
(glyphs[i].x - Tlm_x)/scaled_font->scale.xx,
|
||||
(glyphs[i].y - Tlm_y)/scaled_font->scale.yy);
|
||||
|
||||
|
|
@ -798,7 +798,7 @@ _cairo_pdf_operators_show_glyphs (cairo_pdf_operators_t *pdf_operators,
|
|||
Tm_x += delta;
|
||||
}
|
||||
_cairo_output_stream_printf (word_wrap_stream,
|
||||
"%0*x>] TJ\r\n",
|
||||
"%0*x>] TJ\n",
|
||||
hex_width,
|
||||
subset_glyph.subset_glyph_index);
|
||||
Tm_x += subset_glyph.x_advance;
|
||||
|
|
@ -822,14 +822,14 @@ _cairo_pdf_operators_show_glyphs (cairo_pdf_operators_t *pdf_operators,
|
|||
}
|
||||
} else {
|
||||
_cairo_output_stream_printf (word_wrap_stream,
|
||||
"<%0*x> Tj\r\n",
|
||||
"<%0*x> Tj\n",
|
||||
hex_width,
|
||||
subset_glyph.subset_glyph_index);
|
||||
}
|
||||
}
|
||||
|
||||
_cairo_output_stream_printf (word_wrap_stream,
|
||||
"ET\r\n");
|
||||
"ET\n");
|
||||
|
||||
status = _cairo_output_stream_destroy (word_wrap_stream);
|
||||
if (status)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue