Commit graph

5279 commits

Author SHA1 Message Date
Behdad Esfahbod
60cf2ef844 [cairo-ft] Respect FC_FT_FACE element of pattern
Based on patch from Stuart Parmenter.  Now one can use
cairo_ft_font_face_create_for_pattern() to create cairo-ft font
faces using provided FT_Face but also requesting advanced
options like emboldening and hinting.
2008-06-05 15:44:37 -04:00
Adrian Johnson
4c5370dad8 Update PDF/PS ref images of text-rotate and ft-show-glyphs-positioning 2008-06-04 23:27:05 +09:30
Adrian Johnson
a922a0c5cf Bit swap when writing FORMAT_A1 to PNG on little endian 2008-06-04 22:59:53 +09:30
Adrian Johnson
1d8596d5b0 Optimize PDF operators show_glyphs() to use Tj operator
The Tj operator displays a string of glyphs positioned at their glyph
advances.
2008-06-04 22:59:33 +09:30
Adrian Johnson
71fe8c8881 PS: Make PDF emulation work with the new show_glyphs optimizations
The implementation of the Tf, Td, and Tm operators has been extended
to allow calling these operators in any order.
2008-06-04 22:57:43 +09:30
Adrian Johnson
83e4825fae Rewrite _cairo_pdf_operators_show_glyphs()
Rewrite the PDF operators show_glyphs() function to make it more
maintainable and better optimized.

The changes include:

- Use a separate function to output each text operator and update the
internal state.

- Store glyphs in a buffer until they can be written out as one
string. This reduces the complexity of the code for emitting glyph
strings and significantly optimizes the output size as glyphs from
multiple calls to show_glyphs() can be accumulated and written in one
string.

- The code now better handles rotated text. Previously, using rotated
text resulted in the text matrix emitted for every glyph. Now rotated
text can be emitted as strings in the some way as non rotated
text. This is particulary useful for printing in landscape mode where
all text on the page is rotated.
2008-06-04 22:47:50 +09:30
Adrian Johnson
f3d457db0c Store y_advance in cairo_scaled_font_subsets_glyph_t 2008-06-04 22:36:10 +09:30
Adrian Johnson
6139fdc107 PDF: Don't emit a new text object for every call to show_glyphs
A text object is a series of text operations enclosed in a 'BT'/'ET'
pair.

After a call to _cairo_pdf_operators_show_glyphs() the closing 'ET'
will not be emitted. This allows subsequent calls to show_glyphs() to
emit text into the same text object. A call to any other operator or
_cairo_pdf_operators_flush() will close the text object.
2008-06-03 23:24:09 +09:30
Adrian Johnson
6258f1a4e2 PDF: Remember the current color
Don't emit the set fill or stroke color operator if the required fill
or stroke color is already selected.
2008-06-03 23:16:22 +09:30
Adrian Johnson
fd42b74a4f Add _cairo_pdf_operators_flush()
The optimizations planned for pdf-operators will mean that it will no
longer emit complete operations on each call to
fill/stroke/show_glyphs. For example a call to _show_glyphs() may not
finish the text operation to allow a subsequent call to _show_glyphs()
to be merged into the same text object.

A flush function is required to force pdf_operators to complete the
current operation before the pdf surface can emit any pdf operators.
2008-06-03 22:40:51 +09:30
Adrian Johnson
e1bc97a7e5 Disable UniqueID font check in Type 1 subset font
Some Type 1 fonts have some PostScript code at the start of the font
that checks if the font is already cached in the printer (based on the
font UniqueID key). This breaks our subsetted font as it is not the
same as the original font.

Checking for and removing a random blob of PostScript is difficult so
this patch takes the simpler approach of searching for the PS code
that checks if the UniqueID dictionary entry exists

ie

  /UniqueID known

this code leaves the value "true" or "false" on the PS interpreter
stack depending on whether the "UniqueID" key exists.

Then the patch inserts the PS code " pop false " after the above code
to remove the old result and place "false" on the stack to make it
appear that UniqueID does not exist.

This approach should be able to handle any type of PostScript code
that attempts to do something with the UniqueID value in the font
dictionary.
2008-06-03 20:51:39 +09:30
Adrian Johnson
34c42202f0 Remove XUID key from subsetted Type 1 fonts
Subsetted fonts must not share the same XUID as the original font.
2008-06-03 20:51:39 +09:30
Adrian Johnson
6ae1061508 Remove UniqueID key from subsetted Type 1 fonts
Subsetted fonts must not share the same UniqueID as the original
font.
2008-06-03 20:51:39 +09:30
Adrian Johnson
e30cd617c8 Make font subsetting output fonts in order of the font subset id
This ensures that PS/PDF output is always the same for the same cairo
input. Previously the order of the embedded fonts depended on the hash
key of the fonts which depended on the memory location of fonts.
2008-06-03 20:51:39 +09:30
Adrian Johnson
0dbb5c9f62 Ensure eexec encryption in subsetted Type 1 font is compliant (#13679)
In the eexec encryption used in Type 1 fonts, the first four bytes of
ciphertext must not start with a white space character or contain an
ASCII Hex character. Some fonts do not comply with this
restriction. This may cause problems for some PDF consumers.

Fix this by overwriting the four random bytes at the start of the
decrypted cleartext with spaces. When re-encrypted the first four
bytes of ciphertext will always be 0xf0, 0x83, 0xef, 0x00 which
complies with the restrictions.
2008-06-03 20:51:39 +09:30
Behdad Esfahbod
2f4d8fd071 [cairo-gstate] Return immediately if clip bounds is empty 2008-06-02 22:46:21 -04:00
Behdad Esfahbod
3f5051fab1 Fix now-detected doc formatting issues 2008-06-01 19:14:13 -04:00
Behdad Esfahbod
0c208f2826 [src/check-doc-syntax.sh] Detect malformatted functions at line start 2008-06-01 19:13:49 -04:00
Behdad Esfahbod
3f02e0d74b Fix newly detected doc syntax issues 2008-06-01 18:46:45 -04:00
Behdad Esfahbod
b37c755730 [src/check-doc-syntax.sh] Detect malformatted enums starting the line 2008-06-01 18:46:23 -04:00
Behdad Esfahbod
0ea7d5d6db [cairo-mutex] Remove debugging stuff that I accidentally committed
We should add read mutex debugging facilities when the debugging
infrastructure is in place.
2008-06-01 15:32:42 -04:00
Behdad Esfahbod
54f1a426f7 [cairo-xcb] Oops. Fix build. 2008-05-30 15:23:32 -04:00
Behdad Esfahbod
fbe7044f10 [user-font] Improve docs. 2008-05-30 15:18:22 -04:00
Behdad Esfahbod
45be1459b2 [user-font] Document all public functions
Remains to do: callback types.
2008-05-29 02:35:09 -04:00
Behdad Esfahbod
9a05c0e7f4 Fix doc syntax. 2008-05-29 02:34:07 -04:00
Behdad Esfahbod
d0bc3ca1a2 [doc] Add Index of 1.8 symbols 2008-05-28 20:58:35 -04:00
Behdad Esfahbod
4e68140aca [doc] Document remaining CAIRO_HAS_* macros
I'm sure I had done them all before.  No idea what happened.
Perhaps gtk-doc was not seeing them as missing.
2008-05-28 20:57:36 -04:00
Behdad Esfahbod
65cc905c2f [doc] Add stub for user-fonts 2008-05-28 20:54:38 -04:00
Behdad Esfahbod
a9b2461c41 [user-font] Handle metrics-hinting font option 2008-05-28 20:29:11 -04:00
Behdad Esfahbod
b0796bf200 [user-font] Cache extent-space scale in the scaled font 2008-05-28 20:20:46 -04:00
Behdad Esfahbod
abdf04c671 [user-font] Handle the case of a null render_glyph callback 2008-05-28 19:52:56 -04:00
Behdad Esfahbod
50e6957e80 [user-font] Remove completed TODO item
The user-font-proxy test case already does this.
2008-05-28 19:31:51 -04:00
Behdad Esfahbod
f2b385558b [cairo-user-font] Add comment about possibly doing metrics-hinting 2008-05-28 19:30:39 -04:00
Behdad Esfahbod
9b1cbcde32 [user-font] Handle antialiasing font option 2008-05-28 19:27:58 -04:00
Behdad Esfahbod
e8e2386233 Remove some bogus XXX marks
These are all perfectly correct code.  Most are simply there because when
we support vertical text writing mode we need to update there, but that's
pretty trivial.  No special markers needed.

/me is trying to make user-font clean of XXX and TODO marks
2008-05-28 19:10:09 -04:00
Behdad Esfahbod
4e10241148 Fix whitespace 2008-05-28 17:12:51 -04:00
Behdad Esfahbod
78b9e29178 [cairo-xlib] Rewrite cairo_xlib_glyph_t as a union of cairo_glyph_t
Someone reported on cairo list that on some system with gcc, he had the
compile-time assertion failing, meaning that the following struct:

typedef struct {
  unsigned long index;
  union {
    struct {
      double x;
      double y;
    } d;
    struct {
      int x;
      int y;
    } i;
  } p;
} cairo_xlib_glyph_t;

had a different size from:

typedef struct {
  unsigned long        index;
  double               x;
  double               y;
} cairo_glyph_t;

That looks quite a weird thing for a compiler to do.  Anyway, rewriting
our struct like this may help in those weird situations:

typedef union {
  cairo_glyph_t d;
  unsigned long index;
  struct {
    unsigned long index;
    int x;
    int y;
  } i;
} cairo_xlib_glyph_t;

That's what we do now.
2008-05-28 17:04:09 -04:00
Behdad Esfahbod
51885e9a1e [test/user-font.c] Fix compiler warnings 2008-05-28 16:52:19 -04:00
Behdad Esfahbod
9b16b528dc [cairo-unicode] Make unicode conversion funcs take const char *utf8
Instead of the previous const unsigned char *utf8.  This is in line
with our public API now.
2008-05-28 16:48:13 -04:00
Behdad Esfahbod
df5ad168aa [cairo-path-fixed] Fixe compiler warning 2008-05-28 16:47:55 -04:00
Behdad Esfahbod
6938f15898 [cairo-win32-surface] Remove unused variable 2008-05-28 16:47:37 -04:00
Behdad Esfahbod
12646f81ca [cairo-compiler-private] Make it build with wine
One can build cairo with wine easily now:

./configure CC=winegcc LD=winegcc
2008-05-28 16:46:55 -04:00
Behdad Esfahbod
b70e6e1d98 One more remaining_glyphs compile fix 2008-05-28 16:09:56 -04:00
Behdad Esfahbod
9076206080 Fix two more compile errors
When adding remaining_glyphs argument to show_glyphs(), I missed
a few places.
2008-05-28 16:08:37 -04:00
Behdad Esfahbod
295dee36e3 [cairo-xlib] Use newly-added COMPILE_TIME_ASSERT 2008-05-28 13:10:07 -04:00
Behdad Esfahbod
2e4d6acd09 [cairoint.h] Add COMPILE_TIME_ASSERT() 2008-05-28 13:09:52 -04:00
Behdad Esfahbod
043ed895ad [cairo-xlib] Fix compiler warning 2008-05-28 13:09:43 -04:00
Behdad Esfahbod
26aec31f24 [src/check-def.sh] Don't report anything if skipping test 2008-05-28 12:07:13 -04:00
Behdad Esfahbod
f074073355 [configure.in] Dont let a missing FcFini disable the freetype font backend! 2008-05-28 12:02:16 -04:00
Behdad Esfahbod
d7ddde8a32 [cairo-user-font] Make backend struct static 2008-05-28 12:02:16 -04:00