Commit graph

1439 commits

Author SHA1 Message Date
Behdad Esfahbod
3252ad5ca6 [PNG] Mark status volatile to fix gcc warning 2006-08-28 22:44:15 -04:00
Behdad Esfahbod
b6e5f2b0fe [xlib] Bug 7593: rewrite loop to be more readable, and fix warnings
Basically, it's evil to write a loop like:

    while ((c -= 4) > 0) {
        ...
    }

for one reason that doesn't work if c is unsigned.  And when c is signed, if
for some reason c is about -MAXINT, then it will overflow and not work as
expected.

It's much safer (and more gcc warning friendly) to rewrite it as:

    unsigned int c;

    while (c >= 4) {
        ...
        c -= 4;
    }
2006-08-28 22:30:38 -04:00
Carl Worth
06a9628868 Eliminate conditions checking for unsigned or enum values less than 0. 2006-08-28 19:00:48 -07:00
Carl Worth
7d1399a4bb Put static first to avoid compiler warning. 2006-08-28 18:58:27 -07:00
Behdad Esfahbod
1b7ced6614 Bug #7593: Avoid unsigned loop control variable to eliminate infinite, memory-scribbling loop.
Behdad chased this bug down when looking into bug #7593. This
bug is what finally motivated us to figure out how to get -Wextra
(for the "always true" comparisons of unsigned variables against
negative values).
2006-08-28 18:57:14 -07:00
Behdad Esfahbod
5492946b0c [image] Print out cairo version in the unsupported-format message 2006-08-23 12:29:49 -04:00
Adrian Johnson
782e3eb65b Get correct unhinted outlines on win32.
The documentation for GetGlyphOutline() states that outline returned is grid
fitted and if an application requires an unmodified outline it can request an
outline for a font whose size is equal to the font's em unit.

This seems to suggest that the solution to this bug would be to obtain the
unmodified outline data and scale it to the required size.

https://bugs.freedesktop.org/show_bug.cgi?id=7603
2006-08-21 12:52:56 -04:00
Yevgen Muntyan
6de226be0e Define WINVER if it's not defined. (bug 6456) 2006-08-21 03:52:40 -04:00
Behdad Esfahbod
6ed1613b51 [Makefile.am] Remove unnecessary parantheses that were causing trouble with old bash
Reported by Tor Lillqvist
2006-08-20 13:44:56 -04:00
Carl Worth
b8b507c092 Use &image->base as appropriate to avoid warnings. 2006-08-18 16:12:43 -07:00
Carl Worth
861f1cb4f7 Merge branch 'jrmuizel-stroking-fixes' into cairo
Conflicts:

	test/dash-caps-joins-ps-argb32-ref.png
	test/degenerate-path-ps-argb32-ref.png
	test/degenerate-path.c
2006-08-18 07:59:20 -07:00
Carl Worth
c78c011017 Don't set current point to (0,0) in close_path.
The setting of current point to (0,0) is actually harmless, but it
definitely looks like a bug, (since after close_path the current point
is really the last move point).

We don't keep track of last move point here, nor do we even need to.
So we can be consistent with _cairo_path_fixed_close_path by not
adjusting current point at all, (the subsequent move_to coming right
behind the close_path will fix up the current point).
2006-08-18 06:32:12 -07:00
Carl Worth
53f74e59fa Fix close-path failure by adding explicit move_to after close_path.
Besides the bug fix, this is a user-visible change since the new
move_to element after the close_path element can be seen in the
results of cairo_copy_path, so we document that here.

We are also careful to fix up _cairo_path_fixed_line_to to defer to
_cairo_path_fixed_move_to to avoid letting the last_move_point state
get stale. This avoids introducing the second bug that is also tested
by the close-path test case.
2006-08-18 06:32:12 -07:00
Behdad Esfahbod
474daa4493 [PNG] Include png.h after cairoint.h to avoid macro problems (bug 7744) 2006-08-17 22:03:36 -04:00
Adrian Johnson
da1019c913 Only use GGO_GLYPH_INDEX for truetype and opentype fonts on win32. 2006-08-17 21:46:38 -04:00
Carl Worth
9878a03353 Add (primitive) bitmap glyph tracing to fix bug #7889 2006-08-17 17:50:41 -07:00
Carl Worth
0bfa6d4f33 Fix assertion failures in bitmap-font test by coercing A8 images to A1
There are still some problems in the resulting output:

PDF: Rotated font ends up being blurry in final PNG (not too important)
PS and SVG: There's an incorrect offset being applied somewhere.
2006-08-17 17:50:40 -07:00
Behdad Esfahbod
89008ad1c7 [FreeType] Use _cairo_ft_scaled_font_is_vertical where appropriate
instead of poking at the loadflags.
2006-08-15 13:53:51 -04:00
Behdad Esfahbod
b7bc263842 [FreeType] Fix vertical metrics adjustment to work with non-identity shapes 2006-08-15 08:33:20 -04:00
Behdad Esfahbod
d47388ad75 [PS] Set correct ImageMatrix in _cairo_ps_surface_emit_bitmap_glyph_data
which should be set to device_transform_inverse, not device_transform.
Moreover, no negation is needed anymore, as that has been working around
the inverse matrix :-).
2006-08-15 07:29:18 -04:00
Behdad Esfahbod
4b3fadefc8 [FreeType] Fix comment about font coordinate 2006-08-15 05:48:12 -04:00
Behdad Esfahbod
f183b835b1 Respect font_matrix translation in _cairo_gstate_glyph_path 2006-08-15 04:59:48 -04:00
Behdad Esfahbod
c802cd2d62 [Type1] Synch comments in the encoding table 2006-08-13 20:16:22 -04:00
Pavel Roskin
e5f36a54da [Type1] Use NULL instead of 0
Using NULL is encouraged for pointers.  While fixing that, it turned out
that the comments indicating the current index were wrong, so I'm fixing
them too.
2006-08-13 05:09:28 -04:00
Pavel Roskin
fdd7518b8b Update nil surface structs to the surface struct
Quite a few fields were missing, but all zero, so didn't matter
practically, but comments were out of synch.
2006-08-13 05:02:46 -04:00
Behdad Esfahbod
d1520a99d4 Remove the ft_load_sfnt_table check from PS/PDF/SVG backends
and make sure that _cairo_ft_load_truetype_table returns UNSUPPORTED
if the version of FreeType used doesn't support FT_Load_Sfnt_Table.
2006-08-10 13:05:26 -04:00
Behdad Esfahbod
16c18aea52 [PDF] Fix leak: free glyphs 2006-08-08 15:30:56 -04:00
Behdad Esfahbod
ac4922bd07 [TrueType] Zero out padding memory in generated TrueType subset
to make the output deterministic and fix valgrind errors.
2006-08-08 15:27:21 -04:00
Behdad Esfahbod
356e646dc6 [FreeType] Unset and set to FC_RGBA_NONE the FC_RGBA attribute on pattern
if we don't want it.  This stuff is tricky, but I hope to explain:  In your
fontconfig configuration, you may match on "font", or on "pattern".  Turning
subpixel on typically looks like:

        <match target="font">
		<test qual="all" name="rgba">
			<const>unknown</const>
		</test>
		<edit name="rgba" mode="assign"><const>rgb</const></edit>
	</match>

This works good enough, and if you set to ANTIALIAS_GRAY, this will not
override that.  Now one may forget to match on "font" target, or intentionally
match on the pattern.  That happens before cairo font options are substituted
in the pattern.  So, to give a hint of subpixel in your config file, you can
write:

        <match target="pattern">
		<edit name="rgba" mode="assign"><const>rgb</const></edit>
	</match>

You don't really need to check for current values, as FcConfigSubstitute is
run before merging cairo_font_options_t in.  What this patch does, is to reset
pattern's rgba property if the font options explicitly ask for ANTIALIAS_GRAY.
This is the only place in cairo-ft-font.c that we use FcPatternDel, so I
thought some explanation is needed.
2006-08-08 14:04:51 -04:00
Behdad Esfahbod
6ff531c182 [TrueType] Add comment block describing why we only use int16_t 2006-08-08 13:13:18 -04:00
Behdad Esfahbod
23f3888618 [TrueType] More leak fixes 2006-08-08 07:39:31 -04:00
Behdad Esfahbod
519bd3d3e9 [TrueType] Fix leaks. 2006-08-08 07:30:46 -04:00
Behdad Esfahbod
501e5cc883 Restructure subpixel_order handling such that the code doesn't look suspicious!
Shouldn't make /any/ difference at all in any case.
2006-08-08 06:12:13 -04:00
Behdad Esfahbod
89fc22de87 [fontconfig] Set FC_RGBA_NONE on the pattern if we don't want subpixel.
otherwise, it looks like "I don't care" and fontconfig configuration is
allowed to decide to turn subpixel on.  This fixes the bug that subpixel
colors where showing up in fallback images in PS/PDF/SVG backends, observed
in the test fallback-resolution.
2006-08-08 06:09:23 -04:00
Behdad Esfahbod
1f854fcf32 Set antialiasing to gray in default font options for PS/PDF/SVG
This only affects the image fallback in those backends, and avoids getting
colored pixels there if user's fontconfig configuration turns subpixel on.
This doesn't quite fix that problem though, more changes are needed/coming.
2006-08-08 06:09:23 -04:00
Carl Worth
2d483e0785 test-paginated: Fix memory leak within _test_paginated_surface_create_for_data 2006-08-08 02:24:48 -07:00
Carl Worth
c3b912d7db Eliminate most compiler warnings from the test suite 2006-08-08 01:16:49 -07:00
Carl Worth
401f0ce3c4 Merge branch 'surface-font-options' into cairo 2006-08-08 00:19:51 -07:00
Behdad Esfahbod
77fd0efa9a Fix few remaining compiler warnings, revealed by -O3 2006-08-08 02:58:50 -04:00
Carl Worth
02b54ca620 Improve docs for cairo_surface_create_similar() 2006-08-07 23:47:46 -07:00
Behdad Esfahbod
caba7f6bda Document a few more functions
cairo_show_page
	cairo_copy_page
	cairo_in_stroke
	cairo_in_fill
2006-08-08 02:24:16 -04:00
Carl Worth
789785cd35 Document CAIRO_FORMAT_RGB16_565 as deprecated. 2006-08-07 23:13:09 -07:00
Behdad Esfahbod
fdc805a529 More doc syntax update 2006-08-07 22:28:59 -04:00
Behdad Esfahbod
bbc9a1290a Update doc syntax
Annoying, but a function doc should have a body, not only "Returns", or
gtk-doc will not pick it up.
2006-08-07 22:27:15 -04:00
Behdad Esfahbod
50be7951c9 Split the TrueType table definitions into a private header file
such that we can test the struct sizes in a test.
2006-08-07 21:23:08 -04:00
Behdad Esfahbod
ec895202e0 Remove the __attribute__ ((packed)) and the need for it
as it's not portable and lack of it could seriously break the truetype
subsetting code.  Now, instead of using int32_t and int64_t, we use
multiple int16_t items, to avoid any alignments.  Fortunately, we are
not using any of the fields involved, so no code changes necessary.
2006-08-07 21:13:48 -04:00
Carl Worth
20c3ff96de Fix some signed/unsigned comparison warnings that cropped up during the warnings-cleanup branch 2006-08-07 15:22:49 -07:00
Carl Worth
959b85e98c Merge branch 'warnings-cleanup' into cairo
Conflicts:

	src/cairo-font-subset.c
2006-08-07 15:06:47 -07:00
Carl Worth
7ee94c0285 Squelch an annoying -Wswitch-enum warning by not using switch 2006-08-07 14:30:06 -07:00
Carl Worth
43b579d757 Add -Wswitch-enum compiler flag and fix all trivial warnings 2006-08-07 14:30:06 -07:00