Commit graph

3043 commits

Author SHA1 Message Date
Carl Worth
3f5ce00e99 Add missing parens() to function name in gtk-doc comment 2008-04-06 03:09:45 -07:00
Carl Worth
c08e2ba974 Document default opaque black source pattern. 2008-04-06 02:56:19 -07:00
Carl Worth
e07e1b7bbb Document many more defaults
Including: fallback_resolution, fill_rule, line_cap, line_join,
miter_limit, font_face, font_size, and operator.
2008-04-06 02:47:32 -07:00
Carl Worth
a55669c325 Document toy nature of cairo_select_font_face 2008-04-06 02:17:33 -07:00
Carl Worth
d1fe008440 Document default extend modes 2008-04-06 02:17:09 -07:00
Carl Worth
abe6f9541e Document EXTEND_REFLECT and EXTEND_PAD as implemented for surfaces since 1.6 2008-04-06 02:01:04 -07:00
Carl Worth
b61d1b01e9 Change default filter from BEST to GOOD
Right now the two filters are implemented identically, so there's
no real change for now. But in the future, it's conceivable that an
X server could implement some crazy, high-quality filter for BEST
without regard to performance, (since that's what BEST means).

Meanwhile, GOOD actually captures what we want by default which is
a good mix of both quality and performance.
2008-04-06 01:07:32 -07:00
Adrian Johnson
ae6fbe9e6e scaled-font-subsets: Special case .notdef in a new subset
If the .notdef glyph is the first glyph in the subset to be mapped in
scaled font, we do not know if the subset will scaled or unscaled. We
can put it in the unscaled subset as Type1-fallback will embded an
empty glyph if it can not get the path.
2008-04-06 01:08:31 +10:30
Adrian Johnson
0d5902b716 Type1-fallback: Use correct glyph metrics for .notdef glyph
Bug 15348 references the following PDF that was printing incorrectly
when running through poppler and cairo to generate PostScript.

http://launchpadlibrarian.net/12921700/UbuntuDesktop.pdf

The PostScript output had too much space between each word causing
strings of glyphs printed with the TJ operator to overlap.

The original PDF file contains an CFF font with CID Identity-H
encoding. The PDF file is using character code 0 (glyph 0 due to
Identity-H encoding) as a space character. The CFF specification
defines glyph 0 to be the .notdef glyph.

The PS backend subsets CFF fonts as a Type1-fallback
font. Type1-fallback creates it's own empty .notdef glyph with an
arbitrary glyph advance of 500. The problem here is the TJ operator
used to output the glyphs depends on the glyph advance being
correct. pdf-operators.c uses the glyph advance returned by
_scaled_glyph_init(). However the PostScript interpreter sees the
glyph advance of 500 for .notdef. This problem does not occur when
generating PDF as the PDF font dictionary contains an list of glyph
advances that override the font metrics.

Fix this by making Type1-fallback not treat .notdef as special and to
create it the path and metrics obtained from _scaled_glyph_init(). As
a special case, make it not fail if _scaled_glyph_init() is unable to
return a path for .notdef. This was probably the reason Type1-fallback
previously created it's own .notdef glyph as calling
_scaled_glyph_init(_GLYPH_INFO_PATH) for glyph 0 returns
CAIRO_INT_STATUS_UNSUPPORTED for some fonts.

This ensures the Type1-fallback font metrics match the metrics used
by pdf-operators.c to position the glyphs. This also results in the
removal of some duplicated code.
2008-04-06 00:36:02 +10:30
Adrian Johnson
03d2b098ff Type1-fallback: Use correct glyph advance in Type 1 charstrings
5050c55f93 fixed type1-fallback to use the glyph advance instead of
glyph width in the stored glyph metrics in the font. However it did
not fix the same bug in Type 2 charstrings (used by CFF fallback in
PDF). This problem was not noticed since the glyph widths in the PDF
font dictionary overrides these values.

Fix this in case any software reading cairo PDFs uses these values.
2008-04-06 00:36:02 +10:30
Adrian Johnson
40cee8c578 Add assert to scaled_glyph_lookup in scaled-font-subsets
If _cairo_scaled_glyph_lookup() returns CAIRO_INT_STATUS_UNSUPPORTED
it will be caught by the ASSERT_NOT_REACHED in
_emit_unscaled_font_subset in PS/PDF. It is more useful to catch this
closer to the source.
2008-04-06 00:36:02 +10:30
Carl Worth
731e121c80 _cairo_pattern_get_extents: Fix to allow for expansion based on filter
This fixes the filter-bilinear-extents test case and the
related bug entry:

	bad clipping with EXTEND_NONE
	http://bugs.freedesktop.org/show_bug.cgi?id=15349

Though there are still differences in the PDF and PostScript
backends, (primarily because we can't capture cairo's filter
modes in those file formats).
2008-04-04 19:00:28 -07:00
Carl Worth
04608952e2 Replace open-coded transformation with a call to _cairo_matrix_transform_bounding_box
It's a wonderful feeiling to remove duplicate code.
2008-04-04 18:56:38 -07:00
Carl Worth
80f7aa03b3 Enable buggy_repeat workaround for X.Org servers < 1.4
This covers the known-to-broken 1.3 servers such as appeared
in Fedora 8. It also leaves the workaround off, (since it's
a severe slowdown), for the known-to-be-working 1.4.99.901
server as appears in Fedora 9 Betas.
2008-04-04 11:30:16 -07:00
Chris Wilson
2c8ead12a6 [xlib] Avoiding sending glyphs > XMaxRequestSize.
XRenderAddGlyph() does not split its image data across multiple requests
and so the glyph surface must be smaller than XMaxRequestSize or else
the server will disconnect the client, causing "Fatal IO error 104".
As this will require an extension to the XRender spec, we can work
around the issue by using our fallbacks if we detect that the glyph will
be too large for a single request.

See bugs https://bugs.freedesktop.org/show_bug.cgi?id=4339 and
http://bugs.freedesktop.org/show_bug.cgi?id=13266 for examples.
2008-04-04 18:08:25 +01:00
Chris Wilson
c0593d16c7 [pdf] Copy the glyphs for use within an smask group.
When constructing an smask group using PDF_SHOW_GLYPHS, we need a copy
of the glyphs else they'll be freed be we use them (in _show_page()).
2008-04-04 13:40:46 +01:00
Adrian Johnson
2d42f5ac27 TrueType: Fix buffer check
bb76eb50 added some checks to ensure we do not read past the end of
the buffer for the loaded glyph. However the checks assumed
tt_composite_glyph_t has a fixed size. tt_composite_glyph_t has a
variable size that depends on the values with the struct.
2008-04-04 20:29:12 +10:30
Adrian Johnson
7dbb2dec33 TrueType: Remove assert
If the status is UNSUPPORTED we should let type1-fallback subset it.
2008-04-04 19:48:55 +10:30
Adrian Johnson
e50324d3cc PS: Fix emulation of 'Td' pdf operator 2008-04-04 19:26:36 +10:30
Chris Wilson
759793cad1 Add links to the font specifications.
Add links to specifications for the Type1, CFF, and TrueType font file
formats, provided by Adrian Johnson.
2008-04-04 09:49:34 +01:00
Adrian Johnson
f6509933a4 PDF: Fix glyph positioning bug 2008-04-04 08:41:08 +10:30
Chris Wilson
bb76eb508b [cairo-truetype-subset] Check reads are within valid data.
Check cairo_truetype_font_remap_composite_glyph() does not read beyond
the end of the buffer loaded for the glyf.
2008-04-03 18:36:16 +01:00
Chris Wilson
a5e2a2ad2d [cairo-truetype-subset] Prevent accesses beyond the end of the glyph array.
Reject the font if we try to remap a composite glyph that exists outside
the known set of glyphs.
2008-04-03 18:35:57 +01:00
Chris Wilson
13cdfed894 [cairo-truetype-subset] Perform a quick sanity check that glyf end >= begin.
Check for a bogus glyf position and prevent an integer overflow.
2008-04-03 17:43:37 +01:00
Chris Wilson
cfff3c3bd0 [cairo-array] Guard against integer overflow whilst growing the array.
Sanity check the arguments to _cairo_array_grow_by() such that the
array size does not overflow, similar to the defensive checking of
parameters to malloc.
2008-04-03 17:36:50 +01:00
Chris Wilson
6101dc3e93 [cairo-pdf-surface] Do not bitswap big-endian A1 masks.
Pixman stores the bits A1 surfaces in native byte order, PDF stores
A1 masks in MSb - so only perform swapping for little-endian machines.

Note this also removes the extraneous packing as per the PDF spec 4.8.2:
"Byte boundaries are ignored, except that each row of sample data must
begin on a byte boundary. If the number of data bits per row is not a
multiple of 8, the end of the row is padded with extra bits to fill out
the last byte."
2008-04-03 15:41:31 +01:00
Chris Wilson
5aa5aeb1f5 [cairo-font-face] Cleanup up the font_face on the error path.
A missing _cairo_toy_font_face_fini() was leaking the strdup(family).
2008-04-03 15:41:31 +01:00
Vladimir Vukicevic
9e749d0a28 [cgfont] typo fix 2008-04-02 23:37:24 -07:00
Vladimir Vukicevic
3f9b1ceac7 [cgfont] Implement missing scaled font metrics 2008-04-02 16:14:09 -07:00
Chris Wilson
eb3eb0252b [cairo-xlib-surface] Avoid writing to the error surface.
Insert status checks during construction of temporary glyph surfaces
to avoid potentially writing to the inert error object.
2008-04-02 17:33:30 +01:00
Chris Wilson
c1062bf20a [cairo-xlib-surface] Preserve Visuals for non-TrueColor similar surfaces.
Previously, given a valid XRenderFormat the Visual was discarded
when creating similar surfaces. However the original Visual is
required to support reading back from non-TrueColor surfaces.
2008-04-02 10:50:48 +01:00
Chris Wilson
37c69c0d54 [cairo-xlib] Handle malloc failures for cairo_xlib_visual_info_t.
Tidy the error paths whilst handling visuals, in particular avoiding a
couple of potential NULL deferences, missed status checks and fresh
leaks.
2008-04-02 10:50:48 +01:00
Chris Wilson
0cd42c25a6 [cairo-svg-surface] Check surface status before extracting the svg target.
We need to check and report the existent status, else we may try to
modify the inert error object.
2008-04-02 10:50:47 +01:00
Chris Wilson
013bbda637 [cairo-ps-surface] Check surface status before extracting the ps target.
We need to check and report the existent status, else we may try to
modify the inert error object.
2008-04-02 10:50:47 +01:00
Chris Wilson
cebb1eef43 [cairo-svg-surface] Missing status check.
Check and, if necessary, propagate the error status - do not allow the
status to be overwritten, potentially masking the original error.
2008-04-02 10:50:47 +01:00
Chris Wilson
94db91b65e [cairo-pdf-surface] Do not mask error during cleanup.
Be careful to preserve the original error status whilst on the common
cleanup path for _cairo_pdf_surface_emit_meta_surface().
2008-04-02 10:50:47 +01:00
Chris Wilson
3580b99a8f [cairo-pdf-surface] Check surface status before extracting the pdf target.
We need to check and report the existent status, else we may try to
modify the inert error object.
2008-04-02 10:50:47 +01:00
Chris Wilson
34d734365b [cairo-svg-surface] Release acquired surface on error path.
Ensure the surface returned from _cairo_pattern_acquire_surface() is
released on the error path.
2008-04-02 10:50:47 +01:00
Chris Wilson
ba2e82d138 [cairo-ps-surface] Check error status before potential illegal dereference.
After acquiring the source image, check for the error status to ensure
that we do not attempt to deference an invalid surface.
2008-04-02 10:50:47 +01:00
Chris Wilson
767add1ee3 [cairo-pdf-operators] Destroy stream on error.
We cannot guarantee that a newly created error stream is a static error
object, so we need to always destroy the stream on the error path. (One
day this may change with the global pool of error objects...)
2008-04-02 10:50:47 +01:00
Carl Worth
07130a9061 Include cairoint.h first to satisfy the test suite
Forgetting to include cairoint.h (or not including it first) can
cause some subtle bugs due to specific feature flags not being
set, etc.
2008-04-01 15:20:42 -07:00
Carl Worth
46ea00d829 More quieting of subtle potentially-uninitialized warnings
The compiler isn't clever enough to notice that these
variables are always initialized (in either the TrueColor
or ! TrueColor conditions corresponding to the later
identical conditions in which the variables are used).
2008-04-01 14:53:55 -07:00
Carl Worth
1489e66d25 Quiet a more subtle potentially-uninitialized warning
The compiler isn't clever enough to notice that these
variables are always initialized.
2008-04-01 14:49:03 -07:00
Carl Worth
afc6e3b69d Quiet some trivial unused and potentially-uninitialized compiler warnings 2008-04-01 14:40:18 -07:00
Vladimir Vukicevic
56800e6ea0 [quartz] Remove cairo-atsui-font.c 2008-04-01 13:28:03 -07:00
Vladimir Vukicevic
8ddae11b54 [quartz] Update documentation 2008-04-01 13:26:00 -07:00
Vladimir Vukicevic
94b67d13f3 [quartz] Handle further 10.4 vs. 10.5 differences; fix text AA handling 2008-04-01 13:04:08 -07:00
Vladimir Vukicevic
a1d1be4234 [cgfont] Round surface rectangle outwards to ensure whole-pixel dimensions 2008-04-01 13:04:08 -07:00
Vladimir Vukicevic
c064ad1b56 [cgfont] Fix whitespace errors 2008-04-01 13:04:08 -07:00
Vladimir Vukicevic
2be3e67db2 [cgfont] Add CGFont backend to replace deprecated ATSUI backend
Create a new font backend that uses the CGFont API on MacOS X
10.4 and beyond.
2008-04-01 13:04:08 -07:00