Commit graph

198 commits

Author SHA1 Message Date
Chris Wilson
2a74fd5c7f Propagate one error return through pdf. 2007-04-06 11:50:00 -07:00
Adrian Johnson
e9a2696648 PDF: Use the TJ operator to show glyphs 2007-03-23 23:08:46 +10:30
Behdad Esfahbod
88632575bf [PS/PDF/SVG] Rename internal symbols to have _cairo_*_surface prefix 2007-03-07 16:02:09 -05:00
Adrian Johnson
81b98c93b6 PDF: Set page group color space to DeviceRGB
See http://lists.freedesktop.org/archives/cairo/2006-November/008551.html
2007-03-06 23:11:38 +10:30
Carl Worth
df2d42ac7f Merge branch 'radial-gradient-fixes' into cairo 2007-03-01 17:08:03 -08:00
Behdad Esfahbod
ec11ca33a7 [PS/PDF] Mark CAIRO_EXTEND_PAD for surface patterns as natively supported
since the image surface does not implement that case either, so image
fallbacks have no benefit.
2007-03-01 19:14:40 -05:00
Carl Worth
0439f4c4f7 Rename radial gradient inner/outer to c1/c2
The inner/outer names were totally bogus. It is quite
legitimate to have the first circle's radius be larger than
that of the second.
2007-03-01 13:21:54 -08:00
Adrian Johnson
dc0043383b PDF: Ensure ToUnicode CMap name is unique
and remove an unused printf argument.
2007-03-01 23:39:10 +10:30
Behdad Esfahbod
e2ce27db30 [PS/PDF] Fix xstep/ystep values for CAIRO_EXTEND_NONE
This fixes the fallback-resolution test, as well as the two of
surface-pattern-scale-up and surface-pattern-scale-down.
2007-02-27 18:47:47 -05:00
Behdad Esfahbod
7c39276366 [PS/PDF] Accept CAIRO_EXTEND_REFLECT surface patterns natively
With the hack in _cairo_pattern_acquire_surface to return a 2x2
surface for reflected patterns, we can now accept REFLECT surface
patterns natively in all backends.  SVG was already doing that.
The PDF case needed some changes to go through
_cairo_pattern_acquire_surface.  A similar change to the recent
change in SVG.
2007-02-23 17:26:42 -05:00
Adrian Johnson
641f0919d5 PDF/PS: Don't embed multiple copies of the same font
cairo-scaled-font-subsets stores two sets of subsets -
scaled and unscaled. The first time each glyph is mapped,
_cairo_scaled_glyph_lookup() is called to determine if
the glyph is bitmap or outline. Outline glyphs are put
in the unscaled subsets. Bitmap glyphs are put in the
scaled subsets. The unscaled subsets hash table keyed is
the scaled_font->font_face to ensure only one font for
each font face is created. The scaled subsets hash
table is keyed by scaled_font.

_cairo_scaled_font_subsets_create() now takes two arguments
to specify the maximum size of the scaled and unscaled subsets.
If the unscaled max size is set to 0 all glyphs are mapped
to scaled subsets.

A separate foreach function is provided for scaled and unscaled
subsets. The PDF and PS backends iterate over the unscaled
subsets to emit CFF, TrueType, and Type1 fonts. The scaled
subsets are iterated to emit Type3 bitmap fonts.
2007-02-21 00:32:07 +10:30
Adrian Johnson
6f7cfdf5c7 PDF: Add missing character code to Differences array 2007-02-13 23:53:38 +10:30
Adrian Johnson
ac01dcb5ad PDF: Remove dead code
The function _cairo_pdf_surface_write_fonts is the
original PDF TrueType font embedding function that was
disabled in commit f500cef19f
shortly before Type3 font support was added.

TrueType font embedding was later reintroduced as new code
making this function obsolete.
2007-02-11 23:14:40 +10:30
Adrian Johnson
a2fefcc9e9 PDF: Compress Type3 fonts 2007-02-11 21:57:43 +10:30
Adrian Johnson
9f47879ae3 PDF: Fix Type3 font metrics to make text selection work 2007-02-11 21:50:46 +10:30
Eugeniy Meshcheryakov
a37f21cb17 [PS/PDF/SVG] Return a write_error nil surface on write errors 2007-02-08 15:29:58 -08:00
Adrian Johnson
2d1db24d1e PDF: Another fix for TrueType metrics
Not all TrueType fonts have an em size of 2048.
2007-02-07 23:10:47 +10:30
Adrian Johnson
274dfa4598 PDF: Make text selection and extraction work
- Add a to_unicode array to the scaled_font_subsets
  for mapping glyphs to unicode characters

- Add a function to the TrueType subsetting for
  performing a reverse cmap for mapping glyph indices
  to unicode characters.

- Add a new scaled font backend function for mapping
  glyph indices to unicode characters. Provide FreeType
  and Win32 implementations of the font backend mapping
  function.

- Modify the PDF backend to embed ToUnicode streams
  into each font. The unicode mapping is obtained by
  first trying the reverse cmap. If this fails the font
  backend mapping function is called.
2007-02-07 22:35:59 +10:30
Adrian Johnson
fc660511ec PDF: Correct the y value of Td in show_glyphs
This bug would occur if the y coordinate of all the glyphs
in a single cairo_show_glyphs() call was not the same.
2007-02-07 11:05:33 +10:30
Adrian Johnson
28e3a20d79 PDF: Fix TrueType font metrics 2007-02-04 23:47:28 +10:30
Adrian Johnson
05ff2c77da PDF: Add Encoding dictionary to TrueType fonts
This is a fix for the bugs reported here

  http://lists.freedesktop.org/archives/cairo/2006-December/008984.html

  http://lists.freedesktop.org/archives/cairo/2007-January/009387.html

Cairo PDFs will not print correctly from Adobe Reader. The symptoms are
that all the glyphs on the page are replaced with the same glyph.

According to the PDF Reference an Encoding dictionary is not required
for the symbolic fonts used by cairo. However including the Encoding
dictionary fixes the printing problem.
2007-02-04 19:00:16 +10:30
Eugeniy Meshcheryakov
50136a7806 [PDF-CFF] Fix bad /LastChar value for CFF fonts in PDF backend
PDF backend sets /LastChar value in Type1C font dictionary incorrectly.
acroread then complains about incorrect /Widths in font.
The last char is numchars - 1, since it's zero-based.
2007-01-24 15:51:00 -05:00
Behdad Esfahbod
1a8d0a33ce PDF: Fix approximate diagonal in recent commit
Use x+y as an upper bound for sqrt(x*x+y*y), not x*y.
2007-01-20 13:01:35 -05:00
Carl Worth
6c40575a22 Fix two misspellings in a recent comment. 2007-01-19 23:23:32 -08:00
Carl Worth
5f9d70a561 PDF: Fix CAIRO_EXTEND_NONE for source surface patterns
The former workaround for the lack of non-repeating patterns in PDF
(as far as we can tell) was broken for a source pattern matrix that
resulted in scaling the source surface pattern down. This was
demonstrated by the failure of the scale-down-source-surface-paint
test which now passes.

The old code would have also allowed for bogus repeated pattern
instances to appear if the source surface pattern was translated
sufficiently far off the destination surface in just the right
direction. This bug is also fixed.
2007-01-19 23:11:09 -08:00
Adrian Johnson
b02b86da5c PDF: Compress the content stream
Use cairo-deflate-stream to compress all content streams emitted by the
PDF surface.
2007-01-17 13:21:26 -08:00
Adrian Johnson
b3440e8530 PDF: Use Td where possible instead of Tm for positioning glyphs
This avoids emitting the font matrix for every single glyph.
2007-01-17 13:20:43 -08:00
Kjartan Maraas
1002d01683 Remove unused variables (#7963) 2007-01-11 17:59:16 -05:00
Behdad Esfahbod
ded08256ef Spell check the docs 2007-01-07 02:08:15 -05:00
Alp Toker
caa3c2e1e7 Fix various code/comment typos 2007-01-07 01:35:15 -05:00
Behdad Esfahbod
5a9642c574 Add/remove const to cairo_glyph_t* arguments consistently
The rule is: cairo_glyph_t* is always passed as const for measurement
purposes.  This was not reflected in our public api previously.  Fixed

Showing glyphs used to have cairo_glyph_t* always as const.  With this
changed, it is only const on cairo_t and cairo_gstate_t operations.
cairo_surface_t, cairo_scaled_font_t, and individual backends receive
cairo_glyph_t* as non-const.  The desired semantics is that they may modify
the contents of the array as long as they do not return
CAIRO_STATUS_UNSUPPORTED.  This makes it possible to avoid copying the glyph
array again and again, and edit it in-place.  Backends are in fact free to use
the array as a generic buffer as they see fit.
2006-12-11 01:39:51 -05:00
Adrian Johnson
bd0f991908 Add OpenType/CFF Subsetting 2006-10-27 00:00:24 +09:30
Behdad Esfahbod
e1ded5b1e0 [PDF] Set CTM before path construction
The previous order is undefined according to the PDF spec.  The resulting PDF
was being misrendered using OS X Preview viewer.  This was reported in this
thread:

  http://lists.freedesktop.org/archives/cairo/2006-October/008271.html
2006-10-25 21:40:08 -04:00
Carl Worth
02096f66f3 Fix typo 2006-10-25 12:52:02 -07:00
Adrian Johnson
830804c7ae PDF: Add cairo version to document info dictionary 2006-10-15 23:11:30 +09:30
Adrian Johnson
216c759d46 Type 1 fallback fonts - use binary encoding in PDF files
PDF files require that embedded Type 1 fonts have the encrypted
portion of the font encoded in binary.
2006-10-15 23:07:38 +09:30
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