summaryrefslogtreecommitdiff
path: root/src/cairo-font-face.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix grammar in cairo_*_reference() function documentation.Bryce Harrington2016-10-101-2/+2
| | | | | | | "can be get" is incorrect grammar; "can be gotten" would be better, but active voice is best. Signed-off-by: Bryce Harrington <bryce@bryceharrington.org>
* Oops, fixup previous commitBehdad Esfahbod2015-04-211-0/+7
|
* font: Actually perform destruction of fontsAndrea Canciani2015-01-031-2/+3
| | | | | | | | | | | | Commit 337ab1f8d9e29086bfb4001508b28835b41c6390 introduced delayed font destruction to overcome a race, but prevented the correct cleanup of the font cache. This caused fonts to stay in the cache and caused a crash in the api-special-cases (when running the test suite with -f). Fixes api-special-cases, https://bugs.freedesktop.org/show_bug.cgi?id=87567
* font: Push the last reference dec into the backend->destroy() callbackChris Wilson2013-09-171-12/+31
| | | | | | | | | | | | | | In order to close a race between locking the backend and resurrecting a font via the cache, we need to keep the font face alive until after we take the backend lock. Once we have that lock, we can drop our reference and test if that was the last. Otherwise we must abort the destroy(). This fixes the double-free exposed by multithreaded applications trying to create and destroy the same font concurrently. Reported-by: Weeble <clockworksaint@gmail.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=69470 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* doc: Add "since" tag to documentationAndrea Canciani2012-03-291-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following Python script was used to compute "Since: 1.X" tags, based on the first version where a symbol became officially supported. This script requires a concatenation of the the cairo public headers for the officially supported beckends to be available as "../../includes/1.X.0.h". from sys import argv import re syms = {} def stripcomments(text): def replacer(match): s = match.group(0) if s.startswith('/'): return "" else: return s pattern = re.compile( r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"', re.DOTALL | re.MULTILINE ) return re.sub(pattern, replacer, text) for minor in range(12,-2,-2): version = "1.%d" % minor names = re.split('([A-Za-z0-9_]+)', stripcomments(open("../../includes/%s.0.h" % version).read())) for s in names: syms[s] = version for filename in argv[1:]: is_public = False lines = open(filename, "r").read().split("\n") newlines = [] for i in range(len(lines)): if lines[i] == "/**": last_sym = lines[i+1][2:].strip().replace(":", "") is_public = last_sym.lower().startswith("cairo") elif is_public and lines[i] == " **/": if last_sym in syms: v = syms[last_sym] if re.search("Since", newlines[-1]): newlines = newlines[:-1] if newlines[-1].strip() != "*": newlines.append(" *") newlines.append(" * Since: %s" % v) else: print "%s (%d): Cannot determine the version in which '%s' was introduced" % (filename, i, last_sym) newlines.append(lines[i]) out = open(filename, "w") out.write("\n".join(newlines)) out.close()
* doc: Make documentation comments symmetricAndrea Canciani2012-03-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Documentation comments should always start with "/**" and end with "**/". This is not required by gtk-doc, but it makes the documentations formatting more consistent and simplifies the checking of documentation comments. The following Python script tries to enforce this. from sys import argv from sre import search for filename in argv[1:]: in_doc = False lines = open(filename, "r").read().split("\n") for i in range(len(lines)): ls = lines[i].strip() if ls == "/**": in_doc = True elif in_doc and ls == "*/": lines[i] = " **/" if ls.endswith("*/"): in_doc = False out = open(filename, "w") out.write("\n".join(lines)) out.close() This fixes most 'documentation comment not closed with **/' warnings by check-doc-syntax.awk.
* doc: Fix some broken references and gtk-doc warningsMaarten Bosmans2011-01-161-3/+3
| | | | The gtk-doc comments contain some typos and are missing some escaping.
* doc: Move tmpl/ docs to inline docsBenjamin Otte2010-07-081-0/+17
| | | | | | I did this manually so I could review the docs at the same time. If anyone finds typos or other mistakes I did, please complain to me (or better: fix them).
* Update FSF addressAndrea Canciani2010-04-271-1/+1
| | | | | | | | | | | I updated the Free Software Foundation address using the following script. for i in $(git grep Temple | cut -d: -f1 ) do sed -e 's/59 Temple Place[, -]* Suite 330, Boston, MA *02111-1307[, ]* USA/51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA/' -i "$i" done Fixes http://bugs.freedesktop.org/show_bug.cgi?id=21356
* Move _cairo_error() to a standalone headerChris Wilson2010-01-221-0/+1
| | | | | A pending commit will want to include some utility code from cairo and so we need to extricate the error handling from the PLT symbol hiding.
* [toy-font-face] Move toy font face code in a file of its ownBehdad Esfahbod2008-12-201-449/+0
|
* [font-face] Use cairo_font_face_t instead of toy, for nil objectsBehdad Esfahbod2008-12-201-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.
* [toy] Use twin font if font backend returns UNSUPPORTEDBehdad Esfahbod2008-12-171-11/+8
|
* Treat any toy family starting with "@cairo:" as request for twinBehdad Esfahbod2008-12-171-1/+2
|
* Clean up toy font face handlingBehdad Esfahbod2008-12-171-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.
* Mark allocation failures as unlikely.Chris Wilson2008-11-291-3/+3
| | | | | Use the gcc likelihood annotation to indicate that allocation failures are extremely unlikely.
* Mark if(status) as being unlikely.Chris Wilson2008-11-291-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.
* [hash] Separate out unique patterns of iterating over the table.Chris Wilson2008-11-131-1/+1
| | | | | Avoid unnecessary conditionals for the hotpaths by separating out the iteration over the elements into their distinct modes.
* [hash] Return lookup entry.Chris Wilson2008-11-071-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.
* Restore the ability to choose the internal font.Chris Wilson2008-10-301-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.
* Remove the ability to select the internal font face with a name of "cairo".Carl Worth2008-10-291-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.
* Map toy font face to implementation.Chris Wilson2008-10-221-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.
* Add slim markers to make check-plt.sh happyBehdad Esfahbod2008-09-261-0/+4
|
* Add an internal font faceBehdad Esfahbod2008-09-251-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.
* Return the real error status for set_user_data()Chris Wilson2008-09-231-1/+1
| | | | | Instead of returning a new NO_MEMORY error, return the status from the error object.
* Add toy font constructor and gettersBehdad Esfahbod2008-08-081-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()
* Cleanup _set_error functions a bitBehdad Esfahbod2008-06-241-0/+2
|
* Rename _cairo_font_reset_static_data to _cairo_font_face_reset_static_dataBehdad Esfahbod2008-06-221-1/+1
|
* [cairo-font-face] Tolerate null font_face->backend->destroy()Behdad Esfahbod2008-05-091-1/+2
|
* [cairo-font-face] Cleanup up the font_face on the error path.Chris Wilson2008-04-031-0/+1
| | | | A missing _cairo_toy_font_face_fini() was leaking the strdup(family).
* Define _BSD_SOURCE to enable prototypes for strdup, snprintf.Chris Wilson2008-03-121-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.
* [cairo-font-options] Disallow use of NULL font-options.Chris Wilson2008-02-151-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.
* [doc] Stricter syntax check for type names, update testBehdad Esfahbod2008-01-281-2/+2
|
* [doc] Make sure all type names in docs are prefixed by #Behdad Esfahbod2008-01-281-6/+6
|
* [cairo-font-options] Treat NULL as a default cairo_font_options_tChris Wilson2008-01-171-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().
* [cairo-font-face] Set the error on the font.Chris Wilson2007-10-041-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.
* [cairo-error] Clean up all the warnings and missing _cairo_error() calls.Chris Wilson2007-10-041-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.
* [malloc/error] Add call to _cairo_error() after a failed malloc.Chris Wilson2007-10-041-1/+3
| | | | | Blitz all allocations to ensure that they raise a _cairo_error(CAIRO_STATUS_NO_MEMORY) on failure.
* [cairo-atomic] Rewrite reference counting using atomic ops.Chris Wilson2007-09-251-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.
* [cairo-font-options] Check for the nil-object.Chris Wilson2007-05-081-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.
* Rename cairo-font.c to cairo-font-face.cBehdad Esfahbod2007-04-181-0/+514