Commit graph

12839 commits

Author SHA1 Message Date
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
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
Emmanuele Bassi
459d19ef15 Merge branch 'remove-malloc-stats' into 'master'
util: remove malloc-stats

Closes #640

See merge request cairo/cairo!519
2023-09-28 10:20:47 +00:00
Tim-Philipp Müller
e0d4c1c9a9 util: remove malloc-stats
Not really cairo-related and has now been moved into a
separate repository at https://github.com/behdad/malloc-stats

Fixes #640
2023-09-28 11:21:53 +02:00
Emmanuele Bassi
b2f3957b73 Merge branch 'master-next' into 'master'
Release Cairo 1.18.0

See merge request cairo/cairo!517
2023-09-23 14:53:53 +00:00
Emmanuele Bassi
05d1a41a1f Post-release version bump to 1.18.1 2023-09-23 15:18:32 +01:00
Emmanuele Bassi
3909090108 Release Cairo 1.18.0 2023-09-23 15:18:32 +01:00
Emmanuele Bassi
2d1034cb7c ci: Remove manual doc checks in the build job
The doc syntax and coverage are part of the test suite.
2023-09-23 15:18:32 +01:00
Emmanuele Bassi
3648bf24f6 build: Fix program listing syntax check
The modern gtk-doc syntax for program listing is `|[ ... ]|`.
2023-09-23 15:18:32 +01:00
Emmanuele Bassi
c74bd39df6 docs: Fix closing docblock 2023-09-23 15:18:32 +01:00
Emmanuele Bassi
aa09e2bedc docs: Use the proper xinclude path
The XML files are moved in the xml directory.
2023-09-23 15:18:32 +01:00
Emmanuele Bassi
555b9ddc57 docs: Remove docblock
The gtk-doc parser will not respect `#if 0 ... #endif` blocks.
2023-09-23 15:18:32 +01:00
Emmanuele Bassi
ca646bc24d docs: Add missing docblocks for surface observer API 2023-09-23 15:18:32 +01:00
Emmanuele Bassi
5de85afb75 docs: Add docblocks for missing feature defines 2023-09-23 15:18:32 +01:00
Emmanuele Bassi
e4aa193008 docs: Add missing docblocks for cairo-tee API
The tee API has been left undocumented all this time.
2023-09-23 15:18:31 +01:00
Emmanuele Bassi
ac9ffd3e8a docs: Add missing docblocks for content tags 2023-09-23 15:18:31 +01:00
Emmanuele Bassi
1678bfb2ec Ensure that argument names in declarations match definitions
The name of an argument in the header must match the name of the
argument in the source, otherwise gtk-doc will raise a warning.
2023-09-23 15:18:31 +01:00
Emmanuele Bassi
1b77892a18 docs: Add missing long description for cairo-quartz-font section 2023-09-23 15:18:31 +01:00
Emmanuele Bassi
cfd8356a75 docs: Do not make private symbols with docblocks
Otherwise gtk-doc will warn about undocumented/unused symbols.
2023-09-23 15:18:31 +01:00
Emmanuele Bassi
6c7fb34627 docs: Add missing docblocks for the device observer API 2023-09-23 13:20:07 +01:00
Emmanuele Bassi
98867c6cf3 docs: Add missing section docblock for cairo-tee 2023-09-23 13:19:43 +01:00
Emmanuele Bassi
b770d57b26 Remove pointless CAIRO_HAS_DITHER
The support for dithering is not conditional, and it can be checked
using the Cairo version.
2023-09-23 13:18:34 +01:00
Emmanuele Bassi
1445068291 docs: Add missing tee surface section 2023-09-23 13:12:23 +01:00
Emmanuele Bassi
7c5d0de2d2 docs: Hide private docs
If a private symbol gets a docblock stanza, gtk-doc becomes *very*
confused.
2023-09-23 13:11:46 +01:00
Emmanuele Bassi
d2790e2b1a docs: Update the symbols list 2023-09-23 12:54:24 +01:00
Emmanuele Bassi
10163e4870 docs: Fix versioned symbol indices
Something changed in the docbook XSL, and we cannot use the `index`
element for the versioned indices any more. Using `chapter` brings the
indices back.
2023-09-23 12:50:45 +01:00
Emmanuele Bassi
900b713af1 Merge branch 'ebassi/dithering' into 'master'
Enable access to the pixman dithering path

See merge request cairo/cairo!511
2023-09-23 11:49:49 +00:00
Uli Schlachter
ac1ac72ff1 tests: Add more dithering tests
Use operator add to add the same source over and over again, to make the
dithering more pronounced.
2023-09-23 12:15:27 +01:00
Emmanuele Bassi
6f9dbdad81 Merge branch 'remove-sphinx' into 'master'
Remove cairo-sphinx

See merge request cairo/cairo!510
2023-09-23 11:11:17 +00:00
Emmanuele Bassi
6d2d6f312b Merge branch 'leak-bug-431' into 'master'
Fix leak in test/bug-431.c

See merge request cairo/cairo!513
2023-09-23 11:10:47 +00:00
Emmanuele Bassi
86d7025af5 Merge branch 'wip-fix-352' into 'master'
Avoid assert when drawing arcs with NaN angles

Closes #352

See merge request cairo/cairo!515
2023-09-23 11:10:16 +00:00
Uli Schlachter
ed86d953a6 Merge branch 'leak' into 'master'
Fix font options leak in _cairo_gstate_ensure_scaled_font()

See merge request cairo/cairo!514
2023-09-20 14:28:47 +00:00
Tim Serong
09643ee1ab Avoid assert when drawing arcs with NaN angles
I hit the problem with _cairo_arc_in_direction() failing the
angle_max >= angle_min assertion earlier this year when using
Thunderbird on openSUSE Tumbleweed.  Thunderbird would crash
when rendering some (but not all) HTML email due to this
assert.  For some reason, one of the angles passed in was
NaN.  Making _cairo_arc_in_direction() return immediately if
either angle is not finite fixed the problem for me, but I
don't know enough about the internals of Cairo to know if
this is, strictly speaking, the "right" fix.  Also, having
tested again today _without_ this change applied, I am now
no longer able to reproduce the problem :-/  I still have the
same version of Cairo installed (1.17.8), but various other
packages on that system have been updated in the meantime,
so maybe that's a factor.  Or maybe I'm just lucky and
haven't hit a "bad" HTML email this time...?

Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/352
Signed-off-by: Tim Serong <tserong@suse.com>
2023-09-19 18:26:39 +10:00
Christian Hesse
e364946957 Fix font options leak in _cairo_gstate_ensure_scaled_font()
Font options are allocated in _cairo_gstate_ensure_scaled_font() for local
processing, but never freed. Run _cairo_font_options_fini() on these and
fix the leak.

Signed-off-by: Christian Hesse <mail@eworm.de>
2023-09-18 23:31:23 +02:00
Emmanuele Bassi
c45e373fb4 Merge branch 'font-option-leaks' into 'master'
Fix font options leak in gstate

Closes #795

See merge request cairo/cairo!512
2023-09-18 17:40:52 +00:00