Commit graph

5312 commits

Author SHA1 Message Date
Chris Wilson
ea79af728c [cairo-xlib] Scan for a glyphset to match a pending free glyph.
In order to avoid re-rasterising a glyph that is pending an
XRenderFreeGlyph, we first scan all glyphsets and their arrays of
pending_free_glyphs for a matching glyph. The additional cost of
scanning the extra arrays should be negligble as most fonts will only
have the single array (which we would scan anyway) but we potentially
save an expensive rasterisation and short-lived image surface.

(As suggested by Behdad Esfahbod.)
2008-06-13 21:37:57 +01:00
Chris Wilson
c2963fa6c1 [cairo-boilerplate] Silence compiler warning.
Mark the optstr argument as const to silence a compiler warning in
cairo-perf.
2008-06-13 21:34:43 +01:00
Chris Wilson
ac44817c4a [cairo-perf] Only allocate arrays once.
Store the array of times on the cairo_perf_t context to avoid
reallocating it for every perf-case.
2008-06-13 21:34:42 +01:00
Chris Wilson
335ed74589 Enlarge the embedded arrays to eliminate frequent allocations.
Enlarge the embedded arrays of edges and points for cairo_polygon_t and
cairo_spline_t respectively, such that the frequent allocations are
eliminated whilst running a firefox3 benchmark.
2008-06-13 21:34:42 +01:00
Chris Wilson
963ff0b948 [cairo-pen] Embed a small array of vertices into cairo_pen_t.
Eliminate allocation of the vertex array for the common cases.
2008-06-13 21:34:42 +01:00
Chris Wilson
d9b2e8f004 [cairo-path-stroke] Avoid allocation for single rectangle.
The most common case for path stroking is a single rectangle, so embed
sufficient segments into the stroker to avoid an extra allocation.
2008-06-13 21:34:41 +01:00
Chris Wilson
ba6b2d092a [cairo-hull] Attempt to allocate vertices on stack.
First try to allocate the vertices using an on-stack array, otherwise, if
we need more vertices than can be accomodated, fallback to using a heap
array.
2008-06-13 21:34:41 +01:00
Chris Wilson
b2eadb94f8 [cairo] Cache freed gstates.
Reduce the malloc pressure from frequent cairo_save()/cairo_restore() by
caching the freed gstates in a list on the context.
2008-06-13 21:34:41 +01:00
Søren Sandmann
c57b1eca18 Merge branch 'region32' 2008-06-13 16:18:13 -04:00
Behdad Esfahbod
b9acf625d6 Make check-*.sh scripts more portable (#16299) 2008-06-12 21:03:19 -04:00
Behdad Esfahbod
d47142907f [xlib-visual] Make the 5x5x5 color cube better approximate the rgb333 space
That is, instead of uniformly spreading the colors at 0/4, 1/4, 2/4, 3/4, 4/4
intensities, we do 0/7, 1.5/7, 3.5/7, 5.5/7, 7/7 now.  Those better
approximate the 0/7..7/7 of the rgb333 space that we first convert to.
2008-06-12 14:18:06 -04:00
Behdad Esfahbod
4fcef1a490 [xlib-visual] Allocate 8-entry gray ramp instead of 16-entry
We convert to rgb333 before doing pseudo-color lookup, so we cannot
get more than 8 gray levels anyway.
2008-06-12 14:16:47 -04:00
Søren Sandmann
cba1543c92 Remove large-clip from xfail list 2008-06-10 18:09:00 -04:00
Søren Sandmann
a95e81261f Require pixman 0.11.2 for 32 bit regions 2008-06-10 18:09:00 -04:00
Søren Sandmann
c3121543f8 Fix xlib incarnation of the large-clip bug.
Intersect the clip region with the bounds of the surface to prevent
overflows when converting from 32 to 16 bits.
2008-06-10 18:09:00 -04:00
Søren Sandmann
75fdccc1db Use 32 bit pixman regions for cairo_region_t 2008-06-10 18:09:00 -04:00
Søren Sandmann
bd0cf05623 Add the correct reference image for the large-clip test 2008-06-10 18:09:00 -04:00
Søren Sandmann
60971fb514 New large-clip test
This tests clipping to a rectangle that doesn't fit in 16 bits.
2008-06-10 18:08:59 -04:00
Behdad Esfahbod
4210bab61a [cairo-ft-font] Make font face caching work again
Recent change to the cache key had broken all caching as we were always
comparing unscaled->face.
2008-06-10 02:19:05 -04:00
Behdad Esfahbod
c5b1674349 [cairo-ft-font] Fix thinko in _cairo_ft_unscaled_font_keys_equal() 2008-06-10 02:19:05 -04:00
Behdad Esfahbod
9e1b4704ce [cairo-xlib-screen] Protect fontconfig call with CAIRO_HAS_FT_FONT 2008-06-10 02:19:05 -04:00
Adrian Johnson
c8fc587ede Update user-font test PS/PDF ref images
The PDF output no longer requires a PDF specific reference image. The
lastest poppler from git is required to get the fix for a bug in Type
3 font rendering.
2008-06-09 23:14:47 +09:30
Adrian Johnson
42c212135d Implement PS Type 3 font image support
There does not appear to be any way of emulating PDF inline images in
PostScript so we call back to the PS or PDF surface to emit the image.
2008-06-08 17:12:02 +09:30
Adrian Johnson
5b05034cc9 Implement PS Type 3 font subsetting of user fonts 2008-06-08 17:11:53 +09:30
Adrian Johnson
100a34bea6 Implement PDF Type 3 font subsetting of user fonts
show_glyphs inside a Type 3 font currently results in a fallback
image. Some refactoring is required before font subsets can be created
while emitting all the font subsets.
2008-06-08 17:11:39 +09:30
Adrian Johnson
1e1c05e58f Change _cairo_font_face_is_user() from static to cairo_private 2008-06-08 16:50:34 +09:30
Adrian Johnson
d157e4861a Fix win32-printing show_glyphs analysis 2008-06-07 08:58:39 +09:30
Behdad Esfahbod
06b15d2f2d [doc] Document user-font callback types 2008-06-05 22:58:57 -04:00
Behdad Esfahbod
4c17a5ee11 [configure.in] Change version to 1.7.1
We branched weeks ago.
2008-06-05 22:58:33 -04:00
Behdad Esfahbod
a87c94d247 [user-font] Add XXX mark for text_to_glyphs memory allocation issue 2008-06-05 19:29:47 -04:00
Behdad Esfahbod
adcfe83356 [user-font] Reorder methods to the order they should appear in docs 2008-06-05 19:19:27 -04:00
Behdad Esfahbod
6702c7edc4 [user-font] Let user decide to fall back to unicode_to_glyph in text_to_glyphs
User does this by not setting *num_glyphs.
2008-06-05 18:42:50 -04:00
Behdad Esfahbod
3b1b074695 [user-font] Add XXX mark about metrics-hinting the font extents 2008-06-05 18:32:54 -04:00
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