Commit graph

12230 commits

Author SHA1 Message Date
Bryce Harrington
3e07efd21e makefile: Fix sorting of source files 2017-12-20 17:09:05 -08:00
Behdad Esfahbod
e8ddc505b3 [ft] Fix warnings 2017-12-19 18:04:04 -05:00
Matthias Clasen
c32a5c741f Shortcut FT_Set_Var_Design_Coordinates
We currently (have to) apply font variations for every glyph.
Calling FT_Set_Var_Design_Coordinates has expensive side-effects,
like resetting the autohinter, so we should avoid doing it
fht he coordinates don't actually change.
2017-12-19 17:36:36 -05:00
Behdad Esfahbod
d8ddadc5c3 [ft] When merging font options, order variations correctly
Later wins, and we want "options" to win over "other".
2017-12-19 15:29:13 -05:00
Behdad Esfahbod
82107467f0 [ft] Use variations from ft_options, not scaled-font
Otherwise the variations from FcPattern won't be applied.
2017-12-19 15:18:57 -05:00
Matthias Clasen
976b34c31c fixup
We were passing a face index to cairo_ft_apply_variations,
but that function was expecting an instance id, which is
the face index shifted by 16.
2017-12-19 15:18:57 -05:00
Matthias Clasen
5c7f07d4ea fixup: remove a hack
This bug that this hack is working around has been
fixed in freetype now.
2017-12-19 15:18:57 -05:00
Matthias Clasen
1b5677ad6d Apply font variations when loading glyphs
So far, we only call cairo_ft_apply_variations() in
cairo_ft_scaled_font_lock_face(), but this function is not
used internally. We need to apply it also when loading
glyphs.

This makes pango-view show font variations correctly.
2017-12-19 15:18:57 -05:00
Matthias Clasen
f2b6fac43f Trivial: code movement
Move cairo_ft_apply_font_variations() earlier in the code
since we will be using it in another place soon.
2017-12-19 15:18:57 -05:00
Matthias Clasen
42f07ef903 Always save the origin face index
Save the original face_index also for the from_face case,
so we can always rely on it when applying font variations.
This prevents us from running into the same trap we've seen
before where ft_face->face_index changes underneath us as
font variations are applied.
2017-12-19 15:18:57 -05:00
Matthias Clasen
1735fc41d3 Apply font variation options consistently
We must not look at the instance_id field of the cached ft_face,
since freetype changes it underneath us (if we set the axis values
to match a named instance, the instance_id gets changed to reflect
that). Thankfully, we have the original instance_id stashed away
in the cairo_unscaled_font, so we can just use that to decide if
we are dealing with a named instance or not.

This makes the font variations tests pass.
2017-12-19 15:18:57 -05:00
Matthias Clasen
46034b0547 Make the font-variations test pass
Not sure what I was thinking - the test is checking the width
axis, but the font we're using has only weight and contrast
as axes...
2017-12-19 15:18:57 -05:00
Behdad Esfahbod
db946d1788 [varfonts] Correctly (re)set variations of named instances 2017-12-19 15:18:57 -05:00
Behdad Esfahbod
7125c4bf5e [varfonts] Use blend, not design, coordinates to check for non-base variation
If all blend coordinates are zero, we are at base font.  This is more robust.
2017-12-19 15:18:57 -05:00
Behdad Esfahbod
374ee5a2fd [variations] Merge variations in cairo-ft font option merging
This function should be rewritten to call cairo_font_options_merge(), but
currently it doesn't.

Speculative. Untested.
2017-12-19 15:17:01 -05:00
Behdad Esfahbod
34047d11db [variations] Fix test
This does not exercise merging of variations from font-options and from
pattern.  Before this commit the code was more towards doing that.
2017-12-19 15:17:01 -05:00
Behdad Esfahbod
6accf16093 [variations] Towards fixing test 2017-12-19 15:17:01 -05:00
Matthias Clasen
7cc07f184b Work around a freetype bug
The first call to FT_Get_MM_Var on a newly created FT_Face
fails. So just repeat the call.
2017-12-19 15:17:01 -05:00
Matthias Clasen
38b6e23609 Add a test for font variations
This test checks that passing font variation settings via
font options has the desired effect. It checks this by reading
the effective axis values out of the FT_Face after creating
a font with these options.
2017-12-19 15:17:01 -05:00
Matthias Clasen
721b7ea0a7 Apply font variations when loading fonts
Parse font variation settings and pass them on to
freetype when loading fonts.
2017-12-19 15:17:01 -05:00
Matthias Clasen
a8ae2eafc8 Use strtod_l when available
Using strtod_l and newlocale is a nicer way to have provide
a C-locale-only strtod. Since these APIs are not available
everywhere, keep the old code as a fallback.
2017-12-19 15:17:01 -05:00
Matthias Clasen
ac5acc4538 Load font variations from fontconfig too
When extracting font options from a fontconfig pattern,
also extract font variation information if present.
2017-12-19 15:16:20 -05:00
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