The numbers output in the TJ array for adjusting the horizontal
position of the next glyph are in 1/1000 of the text space
units. Rounding these numbers to an integer should still provide
sufficient precision.
We use the rounded numbers to update the text position in
pdf-operators so subsequent numbers in the TJ array will compensate
for the rounding error.
The %g conversion specifier is for printing numbers that were at some
time stored in a cairo_fixed_t type and as a result have their
precision limited by the size of CAIRO_FIXED_FRAC_BITS.
Using %g will limit the number of digits after the decimal point to
the minimum required to preserve the available precision.
The PS/PDF CTM is transformed to the user space CTM when emitting
paths to be stroked to ensure the correct pen shape used. However this
can result in rounding errors.
For example the device space point (1.234, 3.142) when transformed to
a user space CTM of [100 0 0 100 0 0] will be emitted as
(0.012, 0.031).
Fix this by rescaling the user space CTM so that the path coordinates
emitted to the PDF file stay within the range the maximizes the
precision. The line width and dashing is also rescaled to be the same
size in the rescaled CTM.
We're moving the assertion up from inside _pixman_format_to_mask
to its callers. This will allow us to selectively eliminate the
assertion from the supported xlib backend, while leaving it in
the unsupported glitz and xcb backends for now.
We use the floating-point value later, and we can end up with weirdness
such as negative colors due to the precision mismatch of our fixed
point vs. floating point type. So just do everything in floating
point.
Instead ensure the fill and stroke are each analyzed separately.
This fixes a bug in the PS output where if a fill-stroke with a
translucent fill resulted in a fallback image with the stroke clipped
to the fill path.
The PDF/PS backends change the ctm to user space when emitting and
stroking a path. When the user space ctm does not alter the pen shape
we can avoid changing the ctm.
This patch optimizes the most common case where the user ctm is
[1 0 0 -1 0 y] due to conversion from cairo to PDF coordinates.
Now that the PS backend is using PDF operators, it uses the glyph
metrics in the font to position each glyph in a string. This exposed a
bug in Type 1 fallback where the glyph width and height was used in
the charstrings instead of x_advance/y_advance. This was causing
strings to print diagonally due to the no zero y_advance.
In some cases (in my case, having an external monitor attached to my
MBP), Quartz seems to default to grayscale AA even when it should be
using subpixel AA. CGContextGetAllowsFontSmoothing returns FALSE in
this case (pretty sure this is a Quartz bug). We can force subpixel
AA in this case by setting CGContextSetAllowsFontSmoothing.
strdup() and friends require at least _BSD_SOURCE or
_XOPEN_SOURCE >= 500 to be defined for the prototypes to be included.
For the time being, add the define to each source file that requires one
of the BSD functions.
As _cairo_image_analyze_transparency() is only used on images in the
meta surface, we can store the results of the image analysis and
return the saved value on second and subsequent calls to analyze the
same image.
Previously each image was analyzed twice - once during
CAIRO_PAGINATED_MODE_ANALYZE and once during
CAIRO_PAGINATED_MODE_RENDER.
To help better understand when fallback images are used, a comment
similiar to the following is included with each fallback image in the
PS output.
% Fallback Image: x=101, y=478, w=50, h=10 res=300dpi size=31500
Creating a CGImage with interpolation set to FALSE means that
it will never be interpolated; otherwise the interoplation
is controlled by the destination context's interpolation
quality setting.
Implement REPEAT/REFLECT for gradients in Quartz: for linear gradients,
they're implemented natively (by extending the gradient region); for
radial gradients, we generate a fallback image using pixman and render
that.
A CoreGraphics bug was fixed so strokes are no longer incorrectly
drawn with antialiasing disabled; we no longer have to ignore
antialiasing for stroke(). Also, antialiasing was not being
correctly set for clip(). This fixes both issues.