Commit graph

162 commits

Author SHA1 Message Date
Carl Worth
179f7defdf Use new return value from _cairo_output_stream_destroy
This is a little simpler than the old idiom of calling
_cairo_output_stream_get_status just before calling
_cairo_output_stream_destroy.

I had hoped this technique would apply in more cases, but
many cases want to separate the two actions anyway to do
conditional assignment of the status value, (in order to
not overwrite an earlier error value).
2006-09-07 16:10:40 -07:00
Adrian Johnson
d716020db2 Generate Type 1 fonts from glyph outlines
This patch generates Type 1 fonts for the PS/PDF backends when TrueType
or Type 1 subsetting fails. This has the advantage over the current
Type 3 fallback of reduced font size and better quality rendering
in some PDF viewers. xpdf shows a large improvement in text display
quality with this patch.
2006-09-05 15:57:47 -04:00
Adrian Johnson
49fa8d353b Correct the value of /LastChar in the PDF Type 1 font dictionary. 2006-09-05 14:19:48 -04:00
Adrian Johnson
d81de15804 Fix Type 1 embedding in PDF
PDF Files with Type 1 fonts fail to open in any version of
ghostscript prior to 8.54. The problem is the hex encoding of the
encrypted portion of the font. The PDF reference says this should
only be in binary.
2006-09-05 14:19:26 -04:00
Carl Worth
b8b507c092 Use &image->base as appropriate to avoid warnings. 2006-08-18 16:12:43 -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
16c18aea52 [PDF] Fix leak: free glyphs 2006-08-08 15:30:56 -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
401f0ce3c4 Merge branch 'surface-font-options' into cairo 2006-08-08 00:19:51 -07: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
43b579d757 Add -Wswitch-enum compiler flag and fix all trivial warnings 2006-08-07 14:30:06 -07:00
Dominic Lachowicz
761b30792d Add binary garbage to PDF header as recommended in section 3.4.1 of PDF Reference v1.6 2006-08-04 16:39:40 -07:00
Adrian Johnson
a0989f427b Remove freetype dependency for truetype subsetting code.
Add a load_truetype_table function to cairo_scaled_font_backend_t and
use it to load the truetype sfnt tables.  Implement this with freetype
for the freetype font backend and use GetFontData for win32.  Atsui
remains unimplemented, and still falls back to type3 fonts.
2006-08-02 19:30:55 -04:00
Behdad Esfahbod
a8a0082c53 Remove dummy create_similar in PS/PDF and let fallback do the same
which is simply creating an image surface.
2006-07-31 14:41:27 -04:00
Carl Worth
eb9caf0833 Add -Wsign-compare compiler flag and fix all warnings 2006-07-28 22:50:06 -07:00
Kent Worsnop
778c4730a8 PDF: Fix for dash-no-dash test case, (so that dashing can be turned off) 2006-07-13 10:22:19 -07:00
Behdad Esfahbod
66436d1327 Update lots of docs. 2006-06-30 02:21:50 +02:00
Behdad Esfahbod
320ce67d63 Add "Since: 1.2" to docs for most new API functions. 2006-06-30 02:21:49 +02:00
Behdad Esfahbod
195b1142e7 Prefix "cairo_*_test_*" symbols with underscore. 2006-06-29 15:22:44 +02:00
Carl Worth
25e0acfee0 PDF: Fix display of bitmapped glyphs (bitmap-font test now passes) 2006-06-21 17:23:35 -07:00
Carl Worth
b4720ca51d PDF: Push glyph stream creation down from emit glyph to outline/bitmap variants 2006-06-21 16:59:29 -07:00
Carl Worth
7026e24548 PS PDF: Drop unused hex_digit functions, (now that output stream supports %02x) 2006-06-19 21:15:26 -07:00
Kristian Høgsberg
cd5e08a9fe Implement 0-padding and field width for _cairo_output_stream_printf().
Use it instead of %c%c in PS and PDF surfaces.
2006-06-19 22:44:39 -04:00
Carl Worth
a3f2d92f11 PDF: Don't fallback due to CAIRO_ANTIALIAS_NONE
This was a gratuitous thing that was causing excessive fallbacks in
mozilla printing to PDF. The only reason it was ever there was to
get some of the tests that rely on CAIRO_ANTIALIAS_NONE to pass.
Instead we now simply don't run those tests against the PDF backend.
2006-06-19 11:03:32 -07:00
Kristian Høgsberg
2cea3a2710 Merge branch 'svg-rewrite' 2006-06-14 15:00:33 -04:00
Carl Worth
1d18af9f5a Merge branch 'type1-subsetting' into cairo
Conflicts:

	src/cairo-ps-surface.c
2006-06-13 15:51:57 -07:00
Carl Worth
c7b194c595 Merge branch 'truetype-subsetting' into cairo
Conflicts:

	src/Makefile.am
	src/cairo-font-subset.c
	src/cairo-pdf-surface.c
	src/cairo-ps-surface.c
2006-06-13 15:46:14 -07:00
Carl Worth
4b063c6072 PS, PDF: Re-organize handling of bitmapped fonts to avoid invalid output.
Previously, using the ps or pdf backend with a bitmapped font would
result in a coorupt output file, filled with uninitialized values and
missing procedures for drawing the glyphs.

Now, the file should actually be valid, but it's simply drawing black
boxes instead of the correct glyphs.
2006-06-13 12:51:16 -07:00
Kristian Høgsberg
3575c942f8 Make cairo_output_stream_t an embeddable type.
Most internal cairo types are transparent within cairo and have init and fini
functions to intialize and finialize them in place.  This way they can be
easily be embedded in other structs or derived from.  Initially, the
cairo_output_stream_t type was proposed as a publically visible type and
thus kept opaque.  However, now it's only used internally and derived from
in a number of places so let's make it an embeddable type for consistency
and ease of use.

The patch keeps _cairo_output_stream_create() and _cairo_output_stream_close()
around for (internal) backwards compatibility by deriving a
cairo_output_stream_with_closure_t stream type.

The patch also moves all cairo_output_stream_t functions out of cairoint.h
and into new file cairo-output-stream-private.h, thus chipping away at the
monolithic cairoint.h.
2006-06-12 03:07:19 -04:00
Carl Worth
b2f274b3e8 New API: Replace cairo_{ps,pdf,svg}_set_dpi with new cairo_surface_set_fallback_resolution.
This just provides the mechanics for storing the value and removing the old
function calls. The new value is still not used anywhere (though nor where
the old values), so there should be no functional change (other than forcing
any programs calling the old API to be updated).
2006-06-09 16:52:17 -07:00
Carl Worth
746f66c3fc Fix bogus cairo_rectangle_fixed_t to be cairo_rectangle_int16_t.
This rectangle has regular integer values, not fixed-point values.
So the old name was horribly wrong and misleading, (and yes I think
it was even I that had suggested it).
2006-06-06 16:54:03 -07:00
Carl Worth
ef10a0403a Remove initial, final, and duplicate blank lines.
This patch was produced by running git-stripspace on all *.[ch] files
within cairo. Note that this script would have also created all the changes
from the previous commits to remove trailing whitespace.
2006-06-06 15:50:33 -07:00
Carl Worth
4670366ede Remove trailing whitespace from lines that look like comments.
This patch was produced with the following (GNU) sed script:

	sed -i -r -e '/^[ \t]*\/?\*/ s/[ \t]+$//'

run on all *.[ch] files within cairo, (though I manually excluded
src/cairo-atsui-font.c which has a code line that appears as a comment
to this script).
2006-06-06 15:35:48 -07:00
Carl Worth
d0dd3b822e New API: Add new function cairo_surface_get_content
This assumes that the directfb, glitz, and quartz backends
always create surfaces with content of COLOR_ALPHA which might
be totally wrong.
2006-05-24 17:19:00 -07:00
Carl Worth
11b2481862 PDF: Add new, private test function: cairo_pdf_test_force_fallbacks 2006-05-24 14:02:30 -07:00
Carl Worth
e4476dda49 PDF: Move dash operator before path construction operators.
I don't recall anything about this in the PDF reference, (though I
also didn't look specifically for it), but without this acroread
is quite unhappy with cairo's PDF output when it includes dashing.
2006-05-23 13:41:00 -07:00
Carl Worth
68b41cfd06 PDF: Share path callbacks for fill and stroke. 2006-05-23 12:13:20 -07:00
Carl Worth
7e5bef2439 PDF: Rename pdf_stroke_t to pdf_path_into_t for future sharing with fill 2006-05-23 12:13:20 -07:00
Carl Worth
89384ae124 PDF: Squelch a couple of bogus "may be used uninitialized" warnings. 2006-05-18 21:48:38 -07:00
Kristian Høgsberg
5f55ae7d91 Make ps surface use type1 subset code.
- Add _cairo_ps_surface_emit_type1_font_subset() which just dumps the
  type1 subset into the ps document.
- Add a 'name' parameter to _cairo_type1_subset_init() so it will be
  defined under the right name in the ps document.
- Quiet down debug output from type1 subset code.
- Reenable code to output custom /Encoding table.
2006-05-18 13:57:03 -04:00
Kristian Høgsberg
466d3da4ef Add code to emit type1 dicts to the pdf backend. 2006-05-18 02:16:45 -04:00
Kristian Høgsberg
2c6e799ee6 Switch to using Tm for text positioning and scale type3 fonts to unit size.
This change changes the text output code to use the Tm operator for
positioning the glyphs.  This allows us to set the scale matrix from
the cairo_scaled_font_t so truetype glyphs get transformed correctly.
However, we now need to scale type3 glyph to unity to compensate.
Longer term we should just only output one unit sized type3 subset for
a cairo_font_face_t and use that for all cairo_scaled_font_t's coming from
that font face.

Also, this fixes a num_glyphs initialization bug.
2006-05-16 22:53:05 -04:00
Kristian Høgsberg
f4f11eba5b Output pdf dicts for truetype subset fonts. 2006-05-16 19:01:15 -04:00
Kristian Høgsberg
13a05830f5 Update pdf font emit code to try to emit a truetype subset before type3. 2006-05-16 16:42:44 -04:00
Carl Worth
05b1d2f9c5 PDF: Fix broken per-page sizes in PDF output.
This was first broken in:

	PDF: Fold (unused) cairo_pdf_document_t into cairo_pdf_surface_t
	f500cef19f

Thanks, git bisect!
2006-05-16 01:04:59 -07:00
Carl Worth
bf2ab0de92 PDF: Add Type3 font support to PDF output.
This uses the recently added cairo-scaled-font-subsets interface in a
style very similar to what the PS surface does.
2006-05-15 10:04:53 -07:00
Carl Worth
6f417fed51 PDF: Move Resources dictionary up from Page objects to Pages object.
This allows for more sharing of resource objects. It also avoids some
confusion in trying to set independent resources at a global and a
per-page level, (which doesn't work since the inheritance only works
for an entire resources object---it can only be overriden in its
entirety, not for subsets of the resources).
2006-05-15 10:00:18 -07:00
Carl Worth
049100fb87 PDF: Use consistent style for typedef struct and macro naming. 2006-05-15 09:52:57 -07:00
Carl Worth
f500cef19f PDF: Fold (unused) cairo_pdf_document_t into cairo_pdf_surface_t 2006-05-12 14:56:11 -07:00