Commit graph

12574 commits

Author SHA1 Message Date
Ayman El Didi
c932bb7ae7 added missing documentation to cairo_font_options_status
The documentation for cairo_font_options_status says it can return
either CAIRO_STATUS_SUCCESS or CAIRO_STATUS_NO_MEMORY, but the
implementation can also return CAIRO_STATUS_NULL_POINTER, which wasn't
mentioned.
2022-02-18 15:14:57 -07:00
Ayman El Didi
8f7d039801 fixed some comparisons between signed and unsigned integers
In some places, there were int variables being compared to unsigned
ints when they would never take a negative value, exposing some edge
cases that didn't need to be there.
2022-02-18 15:00:53 -07:00
Emmanuele Bassi
4d68059656 Merge branch 'meson-xml-option' into 'master'
meson: Add xml option and disable by default

See merge request cairo/cairo!275
2022-02-16 17:04:37 +00:00
Uli Schlachter
01c93c7f36 Fix bug #535 in cairo-script
cairo-script has a special case for drawing a set of rectangles. The
rectangle detection can trip over a "degenerate rectangle": Just a
horizontal line. It detects the line as the beginning of a rectangle and
then claims CAIRO_STATUS_INVALID_PATH_DATA when the other sides of the
rectangle are missing.

This commit simply changes the return value to
CAIRO_INT_STATUS_UNSUPPORTED to trigger a fallback to the generate case.

Test case is a straight-forward adaption from the original bug report.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/535
2022-02-16 17:53:49 +01:00
David King
627aa65674 meson: Add xml option and disable by default
Just like autotools does.
2022-02-15 13:32:13 +00:00
Uli Schlachter
bdb4d05868 Merge branch 'user-font-subpixel-position' into 'master'
[user-font] Implement subpixel-positioning

See merge request cairo/cairo!274
2022-02-14 17:19:50 +00:00
Behdad Esfahbod
a62eea4aec [user-font] Implement subpixel-positioning
See:

https://github.com/harfbuzz/harfbuzz/pull/3411#issuecomment-1033118545
https://github.com/harfbuzz/harfbuzz/pull/3411#issuecomment-1033125311
https://github.com/harfbuzz/harfbuzz/pull/3411#issuecomment-1037765840

Basically the code in cairo-image-compositor.c:composite_glyphs()
is flooring glyph positions and putting some phase in the glyph-id.
This was being lost in the user-font backend. Fetch that and put it
in the recording-surface's device-transform translation, to be applied.
2022-02-13 14:34:24 -06:00
Behdad Esfahbod
c90faeb749 Merge branch 'mixed-color-clusters' into 'master'
Fix mixed color clusters

See merge request cairo/cairo!273
2022-02-13 05:08:03 +00:00
Matthias Clasen
65d4325e6f Fix mixed color clusters
When rendering clusters that have colored and non-colored
glyphs, we were falling back to using show_text_glyphs,
rendering all glyphs in the cluster without color.
Instead, make composite_one_color_glyph smart enough
to handle non-color glyphs, and only skip clusters
that are entirely non-color.

Testcase: hb-view AmiriQuranColored.otf -u 627,64e
2022-02-12 21:19:39 -06:00
Emmanuele Bassi
cd21fa0814 Merge branch 'fix-user-font-leaks' into 'master'
user-font: Plug some memory leaks

See merge request cairo/cairo!271
2022-02-11 11:59:03 +00:00
Emmanuele Bassi
396d258e41 Merge branch 'fix-rtl-color-glyphs' into 'master'
Fix rtl handling for color glyphs

Closes #533

See merge request cairo/cairo!272
2022-02-11 11:43:02 +00:00
Emmanuele Bassi
1bc922d045 Apply 1 suggestion(s) to 1 file(s) 2022-02-11 10:58:39 +00:00
Matthias Clasen
603cdf939f Fix rtl handling for color glyphs
When the run contains a mix of color and non-color
glyphs, composite_color_glyphs returns the non-color
glyphs unhandled in the same array. In the rtl case,
the glyphs are processed from the end and the unhandled
glyphs are accumulated at the end as well, and we
need to move them to the beginning of the array before
we return. Add the missing memmove call to do that.

Fixes: #533
2022-02-11 05:47:01 -05:00
Matthias Clasen
139f3f25b1 Plug another memory leak 2022-02-10 22:19:10 -05:00
Matthias Clasen
537445c4f0 user-font: Plug some memory leaks
We were leaking a cairo_t and a surface here, in
some code paths.
2022-02-10 21:17:58 -05:00
Emmanuele Bassi
fb3734fac0 Merge branch 'fix-build-when-pdf-is-disabled' into 'master'
meson: Fix build when PDF backend is disabled

See merge request cairo/cairo!269
2022-01-21 14:14:23 +00:00
Nirbheek Chauhan
57498b301c meson: Fix build when PDF backend is disabled
Symbols from cairo-tag-stack.c are used by cairo-tag-attributes.c, so
this should be in the same list of sources as that. Fixes this build
error:

```
/usr/bin/ld: src/libcairo.so.2.11705.0.p/cairo-tag-attributes.c.o: in function `parse_array':
/path/to/cairo/_build/../src/cairo-tag-attributes.c:347: undefined reference to `_cairo_tag_error'
/usr/bin/ld: src/libcairo.so.2.11705.0.p/cairo-tag-attributes.c.o: in function `parse_name':
/path/to/cairo/cairo/_build/../src/cairo-tag-attributes.c:359: undefined reference to `_cairo_tag_error'
/usr/bin/ld: src/libcairo.so.2.11705.0.p/cairo-tag-attributes.c.o: in function `parse_attributes':
/path/to/cairo/cairo/_build/../src/cairo-tag-attributes.c:410: undefined reference to `_cairo_tag_error'
/usr/bin/ld: /path/to/cairo/cairo/_build/../src/cairo-tag-attributes.c:431: undefined reference to `_cairo_tag_error'
/usr/bin/ld: /path/to/cairo/cairo/_build/../src/cairo-tag-attributes.c:441: undefined reference to `_cairo_tag_error'
/usr/bin/ld: src/libcairo.so.2.11705.0.p/cairo-tag-attributes.c.o:/path/to/cairo/cairo/_build/../src/cairo-tag-attributes.c:455: more undefined references to `_cairo_tag_error' follow
/usr/bin/ld: src/libcairo.so.2.11705.0: hidden symbol `_cairo_tag_error' isn't defined
```
2022-01-21 11:59:36 +05:30
Adrian Johnson
895b249b0a pdf: ensure filenames are correctly encoded 2022-01-16 13:49:53 +10:30
Uli Schlachter
a6b2a39f36 Merge branch 'fix-doc-warning' into 'master'
Fix a doc comment

See merge request cairo/cairo!263
2022-01-12 16:52:45 +00:00
Uli Schlachter
5c9112b25e Merge branch 'meson-redundant-version_compare' into 'master'
meson: Remove useless version_compare()

See merge request cairo/cairo!267
2022-01-09 19:02:22 +00:00
Nirbheek Chauhan
e3b4db1645 meson: Remove useless version_compare()
We require meson 0.56 in project() now, all these are redundant.
2022-01-09 17:17:28 +05:30
Adrian Johnson
a4d8eb98ba pdf: ensure url strings are correctly encoded
Fixes #526
2022-01-09 17:49:25 +10:30
Uli Schlachter
46c0b8bb4f Merge branch 'amos/win32-static-build' into 'master'
Set CAIRO_WIN32_STATIC_BUILD when doing a static build on windows

See merge request cairo/cairo!265
2022-01-01 19:37:24 +00:00
Amos Wenger
ca25e9860d Upgrade to expat-2.2.9-4 wrap
This provides the XML_STATIC definition when cairo is built as a static
library on Windows, see https://github.com/mesonbuild/wrapdb/pull/237
2021-12-08 13:36:07 +01:00
Amos Wenger
4d9657ad0d Set CAIRO_WIN32_STATIC_BUILD when doing a static build on windows 2021-12-07 12:13:02 +01:00
Uli Schlachter
ef149976e2 Fix a doc comment
This commit fixes the following warning from our check-def.sh:

PASS: check-def.sh
Checking documentation for incorrect syntax
./cairoint.h (523): ERROR: Get invalid doc id (should be 'cairo_...:')
./cairoint.h (534): ERROR: Get bad line: ' */'
./cairoint.h (534): ERROR: Get documentation comment not closed with **/

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-11-02 20:10:10 +01:00
Uli Schlachter
d6180c2457 Add missing ref image for clip-unbounded
This commit copies clip-unbounded.base.rgb24.ref.png to
clip-unbounded.rgb24.ref.png. This makes the test pass for rgb24
targets.

This failure goes back to commits 6647511 / 049060 which changed the
image comparison in the test suite. Previously, transparent "nothing"
and black compared equal, but said commits fixed that. Thus, having a
special reference image with black instead of transparency is the right
fix.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-10-19 18:41:47 +02:00
Tim-Philipp Müller
a04786b933 Merge branch 'ci-update-windows-image-2' into 'master'
ci: bump windows image to latest

See merge request cairo/cairo!258
2021-10-07 14:29:57 +00:00
Tim-Philipp Müller
d3e0d27234 ci: update links in ci template from gst-ci to gstreamer monorep 2021-10-07 14:37:49 +01:00
Tim-Philipp Müller
e1646a7403 ci: bump windows image to latest
Which should include the subprojects cache again.
2021-10-07 14:32:55 +01:00
Adrian Johnson
e37afffd50 Merge branch 'master' into issue-514 2021-10-04 14:47:15 +10:30
Adrian Johnson
059f044e62 pdf: reset gstate in groups 2021-10-04 14:30:33 +10:30
Adrian Johnson
b63dc83c8b Merge branch 'ci-update-windows-image' into 'master'
ci: update windows image and fix pixman build on android

Closes #515

See merge request cairo/cairo!257
2021-10-04 02:35:50 +00:00
Tim-Philipp Müller
ccb57d21ce ci: disable aarch64 neon asm in pixman to fix android build
To work around build failures, see #515
2021-10-03 13:17:49 +01:00
Tim-Philipp Müller
e3ba30bf7e ci: update windows image
Some root certs expired, which causes problems with letsencrypt
certificates, so update to latest image with updated certificates.

https://letsencrypt.org/docs/dst-root-ca-x3-expiration-september-2021/

Fixes #515
2021-10-03 12:47:31 +01:00
Adrian Johnson
58aadd1481 pdf: reset current operator when resetting clip
PDF output uses q/Q operators to reset the clip path. This also resets
the PDF graphics state including the current blend mode.

When resetting the clip path, reset the current blend mode tracked by
the PDF surface so that if a non-default blend mode is required, the
surface will emit the correct blend mode.

Fixes #514
2021-10-03 14:48:06 +10:30
Adrian Johnson
d87fe096b9 Merge branch 'user-font-foreground-color' into 'master'
Support user fonts that use the foreground color

See merge request cairo/cairo!249
2021-09-20 09:01:58 +00:00
Adrian Johnson
8ea4ae5413 Allow user fonts to use the foreground color 2021-09-18 07:05:35 +09:30
Uli Schlachter
4f761bd5aa Merge branch 'fix-core-diff' into 'master'
Explicitly handle image formats in buffer_diff_core and pdiff_compare

Closes #25

See merge request cairo/cairo!243
2021-09-17 13:48:46 +00:00
Adrian Johnson
994e33215e Merge branch 'color-font-foreground-color' into 'master'
Support color fonts that use the foreground color

See merge request cairo/cairo!246
2021-09-16 21:47:25 +00:00
Adrian Johnson
23815978cc Merge branch 'master' into color-font-foreground-color 2021-09-17 06:25:07 +09:30
Adrian Johnson
4c520fea21 Merge branch 'custom-metadata' into 'master'
Add cairo_pdf_surface_set_custom_metadata()

See merge request cairo/cairo!240
2021-09-16 20:47:50 +00:00
Adrian Johnson
ffa2374b05 Merge branch 'large-pdf-file' into 'master'
Allow > 2GB PDF files on platforms with 32-bit long

See merge request cairo/cairo!251
2021-09-16 20:47:08 +00:00
Uli Schlachter
c0d2527ad0 Fix integer overflows in cairo-mempool
The expression "1 << whatever" has type int, no matter what the type of
"whatever" is. Thus, "1 << 31" ends up overflowing an "int" and
undefined behaviour occurs.

The above happened in cairo-mempool.c. I saw the following line:

  pool->free_bytes += 1 << (bits + pool->min_bits);

being executed with bits=15 and pool->min_bits=16, i.e. we had 1 << 31.
This ended up being INT_MIN due to the overflow. This was then promoted
to size_t and we ended up with a *huge* value being added to free_bytes.

This is obviously not the intended behaviour. Thus, this commit replaces
the "1" in all left shifts in cairo-mempool.c with "((size_t) 1)".

This fix avoids the integer overflow, but it does not fix issue #510,
because some allocation keeps the memory pool alive.

Related-to: https://gitlab.freedesktop.org/cairo/cairo/-/issues/510
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-09-15 18:02:05 +02:00
Tim-Philipp Müller
224b44e9d4 Merge branch 'fix-no-png-dep' into 'master'
meson: fix build without libpng

See merge request cairo/cairo!252
2021-09-12 15:49:13 +00:00
Tim-Philipp Müller
08cd1fdebe meson: fix build without libpng
meson.build:966:2: ERROR: Expected 1 arguments, got 0.
2021-09-12 15:55:31 +01:00
Adrian Johnson
918fe02666 Merge branch 'ming-warnings' into 'master'
Fix some MinGW warnings

See merge request cairo/cairo!247
2021-09-02 20:36:19 +00:00
Adrian Johnson
2822728f2a Fix some MinGW warnings
The FT change is because my MinGW build is using a more recent version
of FT.

Remove the disabled _cairo_win32_scaled_font_text_to_glyphs() code to
fix the defined but not used warning.

_cairo_win32_scaled_font_text_to_glyphs() was diabled in d9408041aa with
the comment:

  "Currently disable the win32-font text_to_glyphs(), until that one
   is updated.  Or better yet, remove it and implement
   ucs4_to_index().  It's the toy font API afterall."

_cairo_win32_scaled_font_ucs4_to_index() was added in d1c619bc7d.
2021-09-02 21:14:51 +09:30
Adrian Johnson
6e3c7431ff Allow > 2GB PDF files on platforms with 32-bit long 2021-09-02 18:39:53 +09:30
Manuel Stoeckl
6647511593 test: explicitly handle image formats in buffer_diff_core
In practice, the A and B images may be any mixture of RGB24 and
ARGB32 formats, so this change accepts all combinations of these
types, and converts the pixel values to a common (ARGB32) format
as needed.

Some of the newly added test failures are cases where the image
output is RGB24, but the matching reference image is ARGB32 with
noticeable transparency. Some of the newly passing tests are cases
where the unused 'alpha' channel of an RGB24 image was not equal
to 0xff, and the previous code had incorrectly used this channel
in max_diff calculations.
2021-08-29 11:57:30 -04:00