Commit graph

11508 commits

Author SHA1 Message Date
Matthias Clasen
edf9497c3a Add font variations to font options
Add a font option for OpenType font variations, specified
as a string in a format similar to the proposed css
font-variation-settings property.
2017-12-19 15:16:19 -05:00
Matthias Clasen
4ece386149 Make _intern_string_hash non-static
We will use this function in cairo-font-options.c in the following
commits.
2017-12-19 15:16:19 -05:00
Matthias Clasen
d50dbbaf27 Make _intern_string_hash safe for ""
The loop was unnecessarily written in a way that fails
to terminate if len is 0 (ie for the empty string).
Avoid that by checking for len > 0 explicitly.
2017-12-19 15:16:19 -05:00
Matthias Clasen
903b0de539 Fix a logic error in color glyph compositing
When a color glyph is completely clipped away, we
get the non-zero status 'nothing to do'. In that case,
we must not exit early, since there might still be work
to do for the other color glyphs.

This bug was showing up as color glyphs stopping to render
in GTK+ entries that are scrolled to the right, and also
as color glyphs not rendering inside the selection sometimes.

See https://bugzilla.gnome.org/show_bug.cgi?id=790255 and
https://bugzilla.gnome.org/show_bug.cgi?id=788071.
2017-12-17 21:36:17 -05:00
Bryce Harrington
06964531e0 svg: Label for cairo_svg_unit_t doxygen was incorrect 2017-12-14 09:58:57 -08:00
Bryce Harrington
742199768d Bump version for new development tree, 1.15.9 2017-12-11 14:44:07 -08:00
Bryce Harrington
5e6b9aeb5e 1.15.10 release
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2017-12-11 14:44:07 -08:00
Antonio Ospite
19ee921187 svg: fix compilation with MSVC which doesn't support C99 initializers
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Tested-by: John Emmas <john@creativepost.co.uk>
2017-12-10 20:13:19 -08:00
Adrian Johnson
f9cf6f9200 ps: fix compile warning
https://lists.cairographics.org/archives/cairo/2017-December/028481.html
2017-12-08 18:13:20 +10:30
Bryce Harrington
f723ce3192 pattern: Mark a private routine as cairo_private.
Fixes distcheck PLT error:

  Checking .libs/libcairo.so for local PLT entries
  000000000031f1d0  0000024200000007 R_X86_64_JUMP_SLOT
  0000000000055de0 _cairo_pattern_is_constant_alpha + 0
2017-12-07 15:53:16 -08:00
Bryce Harrington
c9a78ec9c2 Fix distcheck errors on use of #ifdef
Checking that feature conditionals are used with #if only (not #ifdef)
./cairo-ft.h:#ifdef CAIRO_HAS_FC_FONT
./cairo-ft.h:#ifdef CAIRO_HAS_FC_FONT
2017-12-07 14:15:17 -08:00
Bryce Harrington
04b4967586 Fix various doxygen warnings found by check-doc-syntax.sh
./cairo-clip-boxes.c (268): ERROR: copy invalid doc id (should be 'cairo_...:')
./cairo-clip-boxes.c (274): ERROR: copy bad line: ' */'
./cairo-clip-boxes.c (274): ERROR: copy documentation comment not closed with **/
./cairo-boxes.c (106): ERROR: Computes invalid doc id (should be 'cairo_...:')
./cairo-boxes.c (114): ERROR: Computes bad line: ' */'
./cairo-boxes.c (114): ERROR: Computes documentation comment not closed with **/
./cairo-boxes.c (279): ERROR: Computes invalid doc id (should be 'cairo_...:')
./cairo-boxes.c (284): ERROR: Computes bad line: ' */'
./cairo-boxes.c (284): ERROR: Computes documentation comment not closed with **/
./cairo-boxes.c (338): ERROR: Linearize invalid doc id (should be 'cairo_...:')
./cairo-boxes.c (345): ERROR: Linearize documentation comment not closed with **/
./cairo.c (240): ERROR: SECTION:cairo-tag bad line: ''
./cairo.c (892): ERROR: cairo_set_source_rgb: Duplicate 'Since' field
2017-12-07 14:13:32 -08:00
Bryce Harrington
dbc1636a9b win32: Fix since field version number
check-doc-syntax.sh expects since numbers to be MAJOR.MINOR without a
patch level number
2017-12-07 14:13:32 -08:00
Bryce Harrington
bb0d616c4e image: Fix include for use of ptrdiff
Commit 38fbe621 added use of the ptrdiff_t type in a header file,
however `make distcheck` complains:

In file included from headers-standalone-tmp.c:1:0:
../../../src/cairo-image-surface-private.h:74:5: error: unknown type name ‘ptrdiff_t’
     ptrdiff_t stride;
     ^
2017-12-07 14:13:28 -08:00
Antonio Ospite
15559b54af svg: add a new function to specify the SVG document unit
Add a cairo_svg_surface_set_document_unit() function to allow users to
set a unit for the width and height values of the root <svg> element.

In particular this allows to draw in pixels and still have the expected
result when generating SVG output.

Add also the correspondent getter function.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=90166
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2017-12-04 13:58:34 -08:00
Tom Schoonjans
84fc0ce91d Use UTF-8 filenames on Windows
Until now fopen was used on Windows to open files for reading and
writing. This assumed however that the filename would be encoded in the
current codepage, which is a major inconvenience and makes it even
impossible to use filenames that use characters from more than one
codepage. This patch enforces the use of UTF-8 filenames on all
platforms.

Based on the work of Owen Taylor (https://lists.cairographics.org/archives/cairo/2007-February/009591.html)
2017-11-26 20:16:43 +10:30
Mikhail Fludkov
e5532f5ad7 Fix code generation when using GCC legacy atomic operations
https://bugs.freedesktop.org/show_bug.cgi?id=103559
2017-11-26 13:09:51 +10:30
Adrian Johnson
f614f588e6 Prevent -Wundef warnings in when cairo-ft.h is used without fontconfig 2017-11-26 13:03:44 +10:30
Adrian Johnson
a709197121 pdf: fix some annotation bugs
- each annotation was emitted on every page instead of just the page
  that contains the annotation

- the document structure did not correctly link to annotation objects

- fix some annotation related memory leaks
2017-11-26 13:03:18 +10:30
Adrian Johnson
17e2abc992 ps: fix compile with old versions of MSVC
https://lists.cairographics.org/archives/cairo/2017-November/028452.html
2017-11-20 05:37:34 +10:30
Adrian Johnson
0c8070f5bc pdf: fix document structure for non tagged structures 2017-11-16 20:16:14 +10:30
Adrian Johnson
164be89660 test: update some stale ref images 2017-11-10 20:10:01 +10:30
Adrian Johnson
5c7a6ca141 ps: fix extend-*-similar failures 2017-11-10 20:10:01 +10:30
Adrian Johnson
9bfa9df2bb ps: fix padded image crash 2017-11-09 22:02:05 +10:30
Adrian Johnson
f7d6d78f94 ps: prevent self-copy infinite loop 2017-11-09 22:02:05 +10:30
Adrian Johnson
71746c37d4 test: use CAIRO_MIME_TYPE_UNIQUE_ID with record-text-transform
The PS output from this test is > 100MB due to the duplicated images.
Using CAIRO_MIME_TYPE_UNIQUE_ID reduces the PS output to 650k, runs
considerably faster, and now produces correct output.
2017-11-09 22:02:05 +10:30
Adrian Johnson
5ffbaf9e2f ps: add CAIRO_MIME_TYPE_EPS mime type for embedding EPS files 2017-11-09 22:02:05 +10:30
Adrian Johnson
7d3ba77b6c ps: use Reusable streams for forms in Level 3
to avoid emitting image data as strings
2017-11-09 22:01:40 +10:30
Adrian Johnson
b1c7a087b5 ps: use forms for surfaces with UNIQUE_ID mime type
to ensure the surfaces are emitted only once.

fixes mime-unique-id PS output
2017-11-09 22:01:40 +10:30
Adrian Johnson
638d64a702 ps: don't acquire image or snapshot in acquire_source_image_from_pattern
otherwise emit_surface may not see the mime data
2017-11-09 22:01:40 +10:30
Adrian Johnson
fcc037a76e ps: use << >> for dictionaries instead of dict begin end 2017-11-09 22:01:40 +10:30
Adrian Johnson
632232c3ce ps: remove unused prolog 2017-11-09 22:01:40 +10:30
Adrian Johnson
9d372ca91a ps: emit base85 strings instead of strings of base85
When image data is emitted as strings (required when an image is used
in a PaintProc), the base85 encoded data was emitted inside PS strings
(...) and the image filters included an ASCI85Decode filter.

This has been changed to emit the strings as ASCII85 strings <~...~>
and remove the ASCII85Decode filter since the base85 is decoded when
the string is parsed.

Also factor out the string data source procedure into the prolog.
2017-11-09 22:01:40 +10:30
Adrian Johnson
d5cb45013b pdf: fix mime-unique-id jpeg attached to recording test
- Restructure the emit_surface code so that mime types are checked first.

- Add a test parameter to emit_surface to test if the surface will be emitted
  as an image or recording instead checking the surface type as the attached
  mime may override this.

- Mark surface as not clear when mime is attached to avoid optimizing away
  "clear" surfaces that have mime attached.

- Include entire surface in analysis if mime attached (also fixes bug with
  calculating the extents CONTENT_COLOR surfaces)
2017-11-09 22:01:40 +10:30
Adrian Johnson
bff47b43c4 pdf: fix mime-unique-id unbounded recording test
PDF XObjects need to specify the bounding box. Emit unbounded surfaces
when finishing as at this point the extents of all uses of the
unbounded surface are known.
2017-11-09 20:52:36 +10:30
Adrian Johnson
cf9a070352 pdf: fix mime-unique-id bounded recording test
The embedded bounded recording surface was being clipped to the
extents of its first use.
2017-11-09 20:52:36 +10:30
Adrian Johnson
5e4707a10d Add mime-unique-id test
to check that PS/PDF embeds images with CAIRO_MIME_TYPE_UNIQUE_ID only
once.
2017-11-09 20:52:36 +10:30
Adrian Johnson
38fbe621cf image: prevent invalid ptr access for > 4GB images
Image data is often accessed using:

  image->data + y * image->stride

On 64-bit achitectures if the image data is > 4GB, this computation
will overflow since both y and stride are 32-bit types.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=98165
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2017-11-07 17:01:49 -08:00
Bryce Harrington
35fccff6ec Un-doxygen disabled cairo_set_opacity
The cairo_set_opacity() routine has been disabled since 2010.  There
appears to be support for it internally in the backend, so it is unclear
why it is not enabled or what might break if it were re-enabled.  Given
the lack of bug reports about its omission, it may be vestigal.  For
now, just hide the doxygen for it to suppress warnings.  It may be worth
deeper review to either re-enable it or remove it entirely.

Reported-by: Rafał Mużyło (See fdo bugzilla #82741)
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2017-11-06 12:18:37 -08:00
Bryce Harrington
8d89fc573e configure: Check for typeof
Check via the AC_C_TYPEOF macro if GCC's typeof is available.  If it is
available via a different spelling, define typeof to that spelling.

Patch from and issue reported by Richard Palo.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=93027
2017-11-06 11:35:24 -08:00
Adrian Johnson
3322580f04 pdf: remove old comment
These issues have been fixed.
2017-10-24 21:44:08 +10:30
Adrian Johnson
1674d2b885 pdf: set default create date 2017-10-24 21:44:08 +10:30
Adrian Johnson
378e8e2f59 pdf: set ca/CA instead of using an smask when the mask has constant alpha 2017-10-24 07:01:14 +10:30
Carlos Garcia Campos
5fd0b8710f scaled-font: Fix assert when destroying glyph page
This happens when _cairo_ft_scaled_glyph_init() returns
CAIRO_INT_STATUS_UNSUPPORTED when called from
_cairo_scaled_glyph_lookup(). In those cases
_cairo_scaled_font_free_last_glyph() is called to release the glyph that
has just been allocated. If there aren't more glyphs,
_cairo_scaled_glyph_page_destroy() is called. The problem is that
_cairo_scaled_glyph_lookup() should always be called with the cache
frozen, and _cairo_scaled_glyph_page_destroy() without the cache
frozen. We can simply thaw/freeze the font before calling
_cairo_scaled_glyph_page_destroy().

https://bugs.freedesktop.org/show_bug.cgi?id=103335
2017-10-22 11:09:02 +10:30
Adrian Johnson
87dfd0c16f Allow mime image to be different size to cairo image
Previously it was assumed the mime image size is the same as the cairo
image surface size. When using the 1 bpp formats (CCITT, JBIG2),
creating a cairo image of the same size will have very large memory
requirements and in some case may exceed the pixman image size
limits. In these cases it is useful to allow the mime image to have a
different resolution to the cairo image and in the PDF/PS output scale
the mime image to be the same physical size as the cairo image.

In PDF, this is easy as all PDF images are scaled to 1x1 unit and the
CTM is used to scale the image to the required size. The PS surface
has been changed to also scale images to 1x1 and use the CTM to get
the required size.
2017-10-22 08:59:58 +10:30
Adrian Johnson
e1a02b180d Add CCITT_FAX mime type for PDF and PS surfaces
This completes the full set of PDF/PS image filters allowing image
data to be passed though without decompressing then recompresssing in
a less efficient format.

The difficulty with CCITT_FAX is it needs some decoding parameters
that are not stored inside the image data. This is achieved by using
an additional mime type CCITT_FAX_PARAMS that contains the params in
key=value format.
2017-10-22 08:42:36 +10:30
Adrian Johnson
4ae7f411c8 util/font-view: fix build error 2017-10-21 20:05:56 +10:30
Adrian Johnson
9ffbf63d37 fix warning: inlining failed in call to '_csi_stack_push' 2017-10-21 13:08:39 +10:30
Adrian Johnson
b092b63119 fix warning: variable X might be clobbered by 'longjmp'
Move calls to setjmp into separate function to avoid clobbering
local variables.
2017-10-21 13:08:30 +10:30
Adrian Johnson
132794f683 svg: recording_surface is needed even if not emitted 2017-10-16 20:18:49 +10:30