Commit graph

12872 commits

Author SHA1 Message Date
Adrian Johnson
b60f47dfd5 Require C11 2024-05-22 08:20:18 +09:30
Emmanuele Bassi
d253188651 Merge branch 'moz-bug-1896173' into 'master'
pdf tags: Fix crash when popping the top most group following by a show_text

See merge request cairo/cairo!549
2024-05-21 11:59:14 +00:00
Emmanuele Bassi
4b775b97bf Merge branch 'moz-bug-1897561' into 'master'
Fix crash if font error in recording surface

See merge request cairo/cairo!551
2024-05-21 11:56:52 +00:00
Emmanuele Bassi
425b4c8347 Merge branch 'fix-pixman-enum' into 'master'
Only use PIXMAN_r8g8b8_sRGB if available

See merge request cairo/cairo!552
2024-05-21 11:53:53 +00:00
Adrian Johnson
3d46485365 Only use PIXMAN_r8g8b8_sRGB if available
Pixman 0.42.3 added PIXMAN_r8g8b8_sRGB to pixman_format_code_t. CI
fails if it is missing from switch statements. Building with pixman <
0.42.3 will fail if the enum is used. So put it in a versioned #if.
2024-05-21 19:47:55 +09:30
Adrian Johnson
54cbe51481 Merge branch 'update-to-fedora-40' into 'master'
Update CI to Fedora 40

See merge request cairo/cairo!546
2024-05-21 09:41:13 +00:00
Adrian Johnson
0cd376ba0b Fix crash if font error in recording surface
https://bugzilla.mozilla.org/show_bug.cgi?id=1897561
2024-05-21 18:47:18 +09:30
Adrian Johnson
1a0933d67d pdf tags: Fix crash when popping the top most group following by a show_text
https://bugzilla.mozilla.org/show_bug.cgi?id=1896173
2024-05-19 10:53:54 +09:30
Adrian Johnson
c75997a4ea Merge branch 'dest-and-uri' into 'master'
Allow links to specify 'dest' and 'uri'

See merge request cairo/cairo!547
2024-05-15 22:12:24 +00:00
Adrian Johnson
cf1b42ca7c Merge branch 'build-svg-fuzzer' into 'master'
Mark _cairo_debug_svg_render() cairo_public

See merge request cairo/cairo!548
2024-05-15 22:11:32 +00:00
Uli Schlachter
877a8a4820 Mark _cairo_debug_svg_render() cairo_public
Without this, building with

  CFLAGS="-DDEBUG_SVG_RENDER" meson setup path/to/source

simply does not work for me:

    test/svg/svg-render.c:74:(.text+0x40): undefined reference to `_cairo_debug_svg_render'
    collect2: error: ld returned 1 exit status

After marking this symbol as exported, this just works.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2024-05-15 17:20:45 +02:00
Adrian Johnson
754f431642 Allow links to specify 'dest' and 'uri'
- If a link has both 'dest' and 'uri', the 'dest' will be used if it
  exists, otherwise it will fallback to using the 'uri'.

- Ensure that a missing 'dest' does not result in an error. Instead a
  warning is printed if CAIRO_DEBUG_TAG is set, and a link to the
  current location is embedded in the PDF. ie the link does
  nothing. Cairo needs to embed a link even if no destination is
  available because when links are embedded at the end of the
  document, the content stream already contains link tags.

- Remove cairo_pdf_interchange_write_forward_links. This code was
  originally used prior to !463 when cairo wrote the links at the end
  of each page. Now the links are written at the end of the document
  so there are no longer any forward links with an unknown
  destination, unless the destination does not exist.

- When 'internal' is not used, use the 'dest' name to reference the
  link. Ensure non ASCII names are correctly encoded.
2024-05-11 19:52:02 +09:30
Adrian Johnson
293b75a1c4 Update CI to Fedora 40 2024-04-28 21:28:41 +09:30
Adrian Johnson
27c8ad5cd8 Merge branch '838-confidential-issue' into 'master'
Switch to calloc in _cairo_cff_font_fallback_create

Closes #838

See merge request cairo/cairo!545
2024-04-27 21:39:13 +00:00
Daniel Holbert
5223f0c932 Switch to calloc in _cairo_cff_font_fallback_create
This makes this function more consistent with _cairo_cff_font_create, the other
function in this file that allocates fonts.
2024-04-25 16:44:00 -07:00
Uli Schlachter
b3d578ec2f Merge branch 'fix-warning' into 'master'
Fix implicit conversion warning

See merge request cairo/cairo!542
2024-04-17 15:57:04 +00:00
Adrian Johnson
1528c96da6 Fix implicit conversion warning
GCC 12.2 reports the following warning:

[3/16] Compiling C object util/cairo-script/libcairo-script-interpreter.so.2.11801.1.p/cairo-script-scanner.c.o
../util/cairo-script/cairo-script-scanner.c:1562:38: warning: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Wimplicit-const-int-float-conversion]
    if (real >= INT32_MIN && real <= INT32_MAX && (int) real == real)
                                  ~~ ^~~~~~~~~
/usr/include/stdint.h:123:22: note: expanded from macro 'INT32_MAX'
                                 ^~~~~~~~~~
2024-04-17 08:00:23 +09:30
Tim-Philipp Müller
3e12dfda3c Merge branch 'alloca' into 'master'
Fix alloca undefined on Solaris

See merge request cairo/cairo!540
2024-04-16 00:36:42 +00:00
Alan Coopersmith
44e4e11236 Fix alloca undefined on Solaris
Solaris defines alloca in the <alloca.h> header

../src/cairo-colr-glyph-render.c: In function ‘add_sweep_gradient_patches’:
../src/cairo-colr-glyph-render.c:661:14: error: implicit declaration of
 function ‘alloca’ [-Werror=implicit-function-declaration]
  661 |     angles = alloca (sizeof (double) * cl->n_stops);
      |              ^~~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2024-04-15 10:40:08 -07:00
Tim-Philipp Müller
9a05c9c368 Merge branch 'ci-meson-windows' into 'master'
ci: install latest Meson on windows jobs

See merge request cairo/cairo!541
2024-04-14 18:28:14 +00:00
Tim-Philipp Müller
724ea54638 ci: install latest Meson on windows jobs
Looks like fontconfig requires a newer Meson than
what's installed in the image.
2024-04-14 18:52:46 +01:00
Uli Schlachter
95ee2708b8 Merge branch 'bugfix/cross-compile' into 'master'
meson: always skip IPC_RMID_DEFERRED_RELEASE check when cross compiling

See merge request cairo/cairo!534
2024-04-05 14:05:14 +00:00
Emmanuele Bassi
e190f9e0b6 Merge branch 'master' into 'master'
tests: remove gl reference images

See merge request cairo/cairo!539
2024-04-01 17:27:33 +00:00
Félix Poisot
bf471919a9 tests: remove gl reference images
Leftover from b5793081
2024-04-01 16:44:21 +00:00
Adrian Johnson
057a949bb7 Merge branch 'ft-font-accuracy-new' into 'master'
Improve accuracy of computed metrics for FT fonts

See merge request cairo/cairo!533
2024-03-21 20:58:48 +00:00
Adrian Johnson
c604890473 Merge branch 'prefer-colrv1-table' into 'master'
Prefer COLRv1 table

See merge request cairo/cairo!537
2024-03-21 20:55:15 +00:00
Marek Kasik
1bd4d59705 Prefer COLRv1 table 2024-03-21 20:55:15 +00:00
Tim-Philipp Müller
a269e60858 Merge branch 'ci-artefacts' into 'master'
ci: bump windows image and keep meson logs around for msvc builds

See merge request cairo/cairo!538
2024-03-20 22:40:28 +00:00
Tim-Philipp Müller
4421a209e9 ci: keep meson logs in windows builds as artefacts 2024-03-20 23:03:24 +01:00
Tim-Philipp Müller
205817dcbb ci: update windows image 2024-03-20 23:00:51 +01:00
Adrian Johnson
bbbc68e619 Merge branch 'surface-error-png' into 'master'
_cairo_surface_create_in_error(): Add PNG_ERROR support

See merge request cairo/cairo!524
2024-02-17 10:01:14 +00:00
Thomas Devoogdt
8d5037ed64
meson: always skip IPC_RMID_DEFERRED_RELEASE check when cross-compiling
../../br-test-pkg/bootlin-armv5-uclibc/build/cairo-1.17.4/meson.build:279:13:
ERROR: Can not run test applications in this cross environment.

Commit 1bec56ea8a added support to define
ipc_rmid_deferred_release in a cross-compile config, but still kept
the default to auto, which anyhow results in an error when cross-compiling.

There is only one usage of the ipc_rmid_deferred_release compile declarative
which was originally added in this commit: 5041b462d0.

If ipc_rmid_deferred_release is set to FALSE, an additional XSync is performed.
This doesn't sound very harmful, so that is why this commit defaults to FALSE
and thus avoids any cross-compile errors.

Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
2024-02-06 14:56:45 +01:00
Vincent Lefevre
6e5e4bd978 Improve accuracy of computed metrics for FT fonts
In particular, with bitmap fonts, a floating-point error was affecting
y_bearing, yielding a value close to an integer instead of the integer
exactly. The change consists in replacing some operations of the form
A * (1/B) by A/B. Details of the issue in #503.

This new code will not always avoid rounding errors in final values
when these values could be exact, but it makes some of these errors
disappear.

The changes in the src/cairo-ft-font.c code consists of:
* Define the SCALE() macro (with some explanations in a comment).
* Remove the declarations and definitions of x_factor and y_factor.
* Update the code to use SCALE() instead of x_factor and y_factor.
  perl -pi -e 's{(DOUBLE_\w+) ?(\(.*\)) \* ([xy])_factor}
                {SCALE (\1 \2, unscaled->\3_scale)}' \
    src/cairo-ft-font.c
* Replace the remaining 0 * x_factor and 0 * y_factor by 0.
2024-01-22 02:57:20 +01:00
Emmanuele Bassi
586c8acacd Merge branch 'fix-issue-811' into 'master'
Cairo 1.18.0 doesn't draw italic or bold text on Mac

See merge request cairo/cairo!531
2024-01-18 09:32:20 +00:00
Diego Pino Garcia
bd6aa966df [quartz] Fix: Cairo 1.18.0 doesn't draw italic or bold text on Mac
Commit cf351a8a attempted to convert the font generation in
'_cairo_quartz_font_create_for_toy' to use CTFontCreateWithName and that uses
only Postscript Names, meaning with the hyphens.

Commit c6dc5df6 converted back to CGFont. CGFontCreateWithFontName is supposed
to work with Postscript Names, but it seems sometimes it does not.

In case a CGFont cannot be created using Postscript Names, attempt unhyphenated
version of font family name.
2024-01-17 09:07:12 +01:00
Adrian Johnson
61da2c2058 Merge branch 'font-options' into 'master'
Copy font-options during creation of a fallback font

Closes #819

See merge request cairo/cairo!530
2024-01-17 02:23:27 +00:00
Behdad Esfahbod
3bcad03f6b Copy font-options during creation of a fallback font
Specially important for font variations, which before did not
work in PDF, etc, output.

Script surface is not updated. It seems out of date with all
recent additions to cairo_font_options_t, so it loses the
variations :(.

Fixes https://gitlab.freedesktop.org/cairo/cairo/-/issues/819
2024-01-16 18:13:59 -07:00
Adrian Johnson
ee07a81185 Merge branch 'pdf-userfont-stroke' into 'master'
[pdf] Set both fill and stroke colors in show_text_glyphs

Closes #813

See merge request cairo/cairo!527
2023-12-01 09:01:24 +00:00
Behdad Esfahbod
10fffac83c [pdf] Set both fill and stroke colors in show_text_glyphs
Since a user-font might be calling stroke, and PDF has separate
stroke and fill colors.

Note that this bug was not exposed in Poppler. It's probably a
bug there. But multiple other viewers expoed this bug.

Fixes https://gitlab.freedesktop.org/cairo/cairo/-/issues/813
2023-11-30 21:54:07 -05:00
Emmanuele Bassi
f9358f26b8 Merge branch 'alloc-size' into 'master'
cairo-ps-surface: fix -Walloc-size

See merge request cairo/cairo!525
2023-11-06 17:10:07 +00:00
Sam James
c84a13c576
cairo-ps-surface: fix -Walloc-size
GCC 14 introduces a new -Walloc-size included in -Wextra which gives:
```
src/cairo-ps-surface.c:3524:18: warning: allocation of insufficient size ‘1’ for type ‘cairo_ps_form_t’ {aka ‘struct _cairo_ps_form’} with size ‘88’ [-Walloc-size]
```

The calloc prototype is:
```
void *calloc(size_t nmemb, size_t size);
```

So, just swap the number of members and size arguments to match the prototype, as
we're initialising 1 struct of size `sizeof(cairo_ps_form_t)`. GCC then sees we're not
doing anything wrong.

Signed-off-by: Sam James <sam@gentoo.org>
2023-11-05 22:09:21 +00:00
Uli Schlachter
23a643c80d _cairo_surface_create_in_error(): Add PNG_ERROR support
Traditionally, loading a malformed PNG file with
cairo_image_surface_create_from_png() resulted in
CAIRO_STATUS_NO_MEMORY. This was apparently changed in commit
c5ee3f11b5 by adding CAIRO_STATUS_PNG_ERROR and using it for errors
returned from libpng. However, I don't see how this was supposed to
actually work.

There are a couple of error codes supported by
_cairo_surface_create_in_error(). Anything else is turned into
CAIRO_STATUS_NO_MEMORY, which is not a helpful status. For this reason,
CAIRO_STATUS_PNG_ERROR would be turned into CAIRO_STATUS_NO_MEMORY.

This commit adds support for CAIRO_STATUS_PNG_ERROR to
_cairo_surface_create_in_error() so that this error can actually be
returned to the caller.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2023-10-31 14:54:06 +01:00
Uli Schlachter
36193ec952 Merge branch 'kCTFontTraitColorGlyphs' into 'master'
quartz-font: Fix transposed constants

Closes #810

See merge request cairo/cairo!523
2023-10-26 16:34:41 +00:00
Ryan Schmidt
85f021b1f1 quartz-font: Fix transposed constants
kCTFontColorGlyphsTrait is available in Mac OS X 10.7 and later.
kCTFontTraitColorGlyphs is available in OS X 10.8 and later.

Fixes build failure on Mac OS X 10.7.

Closes #810
2023-10-24 01:42:38 -05:00
Emmanuele Bassi
f9de19ad74 Merge branch 'require-pixman-0.40' into 'master'
Require pixman >= 0.40

See merge request cairo/cairo!522
2023-10-02 08:28:43 +00:00
Adrian Johnson
95c8d5b1e0 Merge branch 'fix-tags-incorrect-surface' into 'master'
Fix surface type mismatch error in pdf-interchange

See merge request cairo/cairo!521
2023-10-02 05:49:53 +00:00
Adrian Johnson
b23f4b3fc2 Require pixman >= 0.40 2023-10-02 15:56:04 +10:30
Adrian Johnson
0fce59ff8d Fix surface type mismatch error in pdf-interchange 2023-10-02 15:46:09 +10:30
Adrian Johnson
29592a331c Merge branch 'msvc-alloca-fix' into 'master'
Fix alloca undefined with MSVC

Closes #808

See merge request cairo/cairo!520
2023-10-02 05:14:44 +00:00
Dan Yeaw
27cdee5e4c Fix alloca undefined with MSVC
Conditionally includes malloc.h when compiling with
MSVC so that alloca is defined.
2023-09-30 13:30:51 -04:00