summaryrefslogtreecommitdiff
path: root/src/cairo-font-face.c
AgeCommit message (Collapse)AuthorFilesLines
2008-12-20[toy-font-face] Move toy font face code in a file of its ownBehdad Esfahbod1-449/+0
2008-12-20[font-face] Use cairo_font_face_t instead of toy, for nil objectsBehdad Esfahbod1-45/+10
And with a NULL backend. We are not supposed to read the nil objects afterall. If this causes crashes, the crash site should be fixed.
2008-12-17[toy] Use twin font if font backend returns UNSUPPORTEDBehdad Esfahbod1-11/+8
2008-12-17Treat any toy family starting with "@cairo:" as request for twinBehdad Esfahbod1-1/+2
2008-12-17Clean up toy font face handlingBehdad Esfahbod1-73/+70
This commit moves the toy-to-real mapping from the scaled font creation time to font face creation. A toy font face will keep an internal ref to an implementation face. Then cairo_scaled_font_create() will simply substitute the implementation face before creating anything. This also modifies the cairo-ft toy creation in that we now create a non-resolved pattern and store it in a cairo-ft font-face. We then do the resolving and unscaled font creation at scaled-font creation time. This also means that cairo_ft_font_face_create_for_pattern() now accepts non-resolved patterns too, and does the right thing about them. As much as that can be called right. Some testing of toy font creation performance is in order, as is testing win32 and quartz font backends.
2008-11-29Mark allocation failures as unlikely.Chris Wilson1-3/+3
Use the gcc likelihood annotation to indicate that allocation failures are extremely unlikely.
2008-11-29Mark if(status) as being unlikely.Chris Wilson1-6/+8
The error paths should be hit very rarely during normal operation, so mark them as being unlikely so gcc may emit better code.
2008-11-13[hash] Separate out unique patterns of iterating over the table.Chris Wilson1-1/+1
Avoid unnecessary conditionals for the hotpaths by separating out the iteration over the elements into their distinct modes.
2008-11-07[hash] Return lookup entry.Chris Wilson1-5/+4
Use the return value to return the result from _cairo_hash_table_lookup() (as opposed to filling an output parameter on the stack) as this (a) results in cleaner code (no strict-alias breaking pointer casts), (b) produces a smaller binary and (c) is measurably faster.
2008-10-30Restore the ability to choose the internal font.Chris Wilson1-2/+4
Behdad wants to include the feature with 1.10, so we enable it as early as possible in 1.9 dev cycle to generate as much feedback as possible. The first change is to use "<cairo>" as being a name unlikely to clash with any real font names. This reverts commits: a824d284be23793a5c48b9ae833dcb7b2d5fff80, 292233685534aed712dfd45e8ccf498b792ce496, e0046aaf417a61da008dc6374871fa3687ba94ab, f534bd549e1e2283735d1eabb60c015a5949a735.
2008-10-29Remove the ability to select the internal font face with a name of "cairo".Carl Worth1-4/+2
It's not fair to steal this name from the namespace of family names. There are definitely cairo.ttf files that exist out there, and people may already be using these, (or may use them in the future), with cairo_select_font_face and a family name of "cairo". In place of this, we'll want to come up with some other new, and documented API for selecting the internal font face.
2008-10-22Map toy font face to implementation.Chris Wilson1-0/+34
Quartz fonts and user fonts use an indirect font face when creating a scaled font for the toy font face. This means that they insert a scaled font into the font map that has a different font face to the one that is initially searched upon. The result is that when we try to create an identical scaled font, we fail to find the existing scaled font and attempt to insert a duplicate into the hash table - which triggers an assert. In order to avoid creating duplicate fonts, we add a new method to the font backends that allows cairo_scaled_font_create() to peek at the font_face that will be used to actually implement the scaled font constructor - thus we are able to use the correct font_face as part of the hash key.
2008-09-26Add slim markers to make check-plt.sh happyBehdad Esfahbod1-0/+4
2008-09-25Add an internal font faceBehdad Esfahbod1-7/+26
The font data and rendering is adapted from Keith Packard's Twin window system. The hinting stuff is not ported yet, but hey, it renders! The implementation uses user fonts, and the user font backend is modified to use this font face (which we call "twin" font face internally) when a toy font is needed. The font face layer is then modified to use this font if: - The toy font face "cairo" is asked for, or - No native font backend is available, or - The preferred native font backend fails to return a font with STATUS_UNSUPPORTED. No font backend does this right now but the idea is to change FreeType to return it if no fonts found on the system. We also allow building with no font backends now! The new doc/tutorial/src/twin.c file tests the twin face at various sizes.
2008-09-23Return the real error status for set_user_data()Chris Wilson1-1/+1
Instead of returning a new NO_MEMORY error, return the status from the error object.
2008-08-08Add toy font constructor and gettersBehdad Esfahbod1-13/+183
New public API: cairo_toy_font_face_create() cairo_toy_font_face_get_family() cairo_toy_font_face_get_slant() cairo_toy_font_face_get_weight()
2008-06-24Cleanup _set_error functions a bitBehdad Esfahbod1-0/+2
2008-06-22Rename _cairo_font_reset_static_data to _cairo_font_face_reset_static_dataBehdad Esfahbod1-1/+1
2008-05-09[cairo-font-face] Tolerate null font_face->backend->destroy()Behdad Esfahbod1-1/+2
2008-04-03[cairo-font-face] Cleanup up the font_face on the error path.Chris Wilson1-0/+1
A missing _cairo_toy_font_face_fini() was leaking the strdup(family).
2008-03-12Define _BSD_SOURCE to enable prototypes for strdup, snprintf.Chris Wilson1-0/+1
strdup() and friends require at least _BSD_SOURCE or _XOPEN_SOURCE >= 500 to be defined for the prototypes to be included. For the time being, add the define to each source file that requires one of the BSD functions.
2008-02-15[cairo-font-options] Disallow use of NULL font-options.Chris Wilson1-5/+3
Partial revert of commit 0086db893cba90dc73824d77c661d2965ad48112. This is a follow to the earlier commit that allowed creation of scaled fonts using a NULL font options (by interpreting the NULL as meaning use the default options) to reflect the comments made by Behdad (http://lists.cairographics.org/archives/cairo/2008-January/012714.html). The intent is that the public font options getter/setter API has similar defensive behaviour to that of the core objects - i.e. do not overwrite the nil object and if the object is in error then return the default value. For the indirect use of a NULL/nil font options (e.g. creation of scaled fonts), then an error should be returned rather than crashing.
2008-01-28[doc] Stricter syntax check for type names, update testBehdad Esfahbod1-2/+2
2008-01-28[doc] Make sure all type names in docs are prefixed by #Behdad Esfahbod1-6/+6
2008-01-17[cairo-font-options] Treat NULL as a default cairo_font_options_tChris Wilson1-3/+5
Interpret a NULL cairo_font_options_t as the default values - i.e as if it were a fresh pointer returned by cairo_font_options_create().
2007-10-04[cairo-font-face] Set the error on the font.Chris Wilson1-9/+37
Similar to the other shared objects, store fatal errors on the shared font_face. And do not return a cached reference to an object in an error state.
2007-10-04[cairo-error] Clean up all the warnings and missing _cairo_error() calls.Chris Wilson1-3/+3
Every time we assign or return a hard-coded error status wrap that value with a call to _cairo_error(). So the idiom becomes: status = _cairo_error (CAIRO_STATUS_NO_MEMORY); or return _cairo_error (CAIRO_STATUS_INVALID_DASH); This ensures that a breakpoint placed on _cairo_error() will trigger immediately cairo detects the error.
2007-10-04[malloc/error] Add call to _cairo_error() after a failed malloc.Chris Wilson1-1/+3
Blitz all allocations to ensure that they raise a _cairo_error(CAIRO_STATUS_NO_MEMORY) on failure.
2007-09-25[cairo-atomic] Rewrite reference counting using atomic ops.Chris Wilson1-26/+23
Introduce an opaque cairo_reference_count_t and define operations on it in terms of atomic ops. Update all users of reference counters to use the new opaque type.
2007-05-08[cairo-font-options] Check for the nil-object.Chris Wilson1-0/+5
The design is for the user to create a cairo_font_options_t object with cairo_font_options_create() and then is free to use it with any Cairo operation. This requires us to check when we may be about to overwrite the read-only nil object.
2007-04-18Rename cairo-font.c to cairo-font-face.cBehdad Esfahbod1-0/+514