summaryrefslogtreecommitdiff
path: root/src/cairo-scaled-font-private.h
Commit message (Collapse)AuthorAgeFilesLines
* Foreground color fixes for ft, svg, colrv1Adrian Johnson2023-01-271-3/+3
|
* Add new cairo_user_scaled_font_get_foreground_source() functionAdrian Johnson2023-01-261-1/+5
| | | | | | | | | | | | The previous approach using foreground colors in user fonts does not work for gradients since the foreground color is not available at the time of recording. Add a new function cairo_user_scaled_font_get_foreground_source() that can be called by the color render function to retrieve the foreground pattern. Calling this function signals to cairo that the foreground color is used. In this case cairo will call the render function whenever the foreground color has changed.
* Make cairo_scaled_font_t mutex recursiveLuca Bacci2022-09-051-1/+1
| | | | | Since it can now happen to acquire it recursively, see https://gitlab.freedesktop.org/cairo/cairo/-/issues/587
* Fix deadlock in cairo-scaled-font.cAdrian Johnson2022-05-281-0/+1
| | | | | | | | | | | | | | | | A user font glyph containing a font can cause deadlock in _cairo_scaled_glyph_fini due to the destroy recording surface while holding _cairo_scaled_glyph_page_cache_mutex. When the font in the recording surface is removed from the page cache it will attempt to also acquire the _cairo_scaled_glyph_page_cache_mutex resulting in deadlock. Instead of destroying the recording surface in _cairo_scaled_glyph_page_cache_mutex, move it to an array in the scaled font and destroy it after the _cairo_scaled_glyph_page_cache_mutex is released. Fixes the font in user font case in #440
* Fix the scaled_glyph_init color glyph logicAdrian Johnson2022-04-251-4/+3
| | | | | | and split _cairo_user_scaled_glyph_init() into multiple functions. Update user-font test to test changing foreground text color.
* Allow user fonts to use the foreground colorAdrian Johnson2021-09-181-2/+3
|
* Support color fonts that use the foreground colorAdrian Johnson2021-08-281-1/+8
| | | | | | | | | | | | | COLR fonts can have a layer with the same color as the current text color. This change passes the current color (if solid) through to the font backend where it can be used to render color fonts. scaled_glyph_lookup checks if the foreground color has changed (for glyph that require it) and requests a new color surface if required. This also fixes a bug where scaled_glyph_lookup would always request a color surface for glyphs for glyphs in color fonts that do not have color.
* Add color user-font supportAdrian Johnson2021-08-141-0/+2
| | | | | Adds new API cairo_user_font_face_set_render_color_glyph_func() to set a color glyph renderer.
* Expose 'has color glyphs' as a scaled font propertyMatthias Clasen2017-07-291-0/+2
| | | | | | | This information will be used in subsequent commits to quickly decide that we won't try to handle glpyhs as masks. Implementing the new has_color_glyphs vfunc is optional - only backends that support color glyphs need to implement it.
* Add support for color glyphs to cairo_scaled_glyph_tMatthias Clasen2017-07-291-0/+1
| | | | | | | | | With this, glyphs can have either a surface that is expected to be used as mask, or a color_surface that should be used as source, or both. This will be used to support colored emoji glyphs that are stored as PNG images in OpenType fonts.
* Introduce a new compositor architectureChris Wilson2011-09-121-8/+60
| | | | | | | | | | | | | | | | | | Having spent the last dev cycle looking at how we could specialize the compositors for various backends, we once again look for the commonalities in order to reduce the duplication. In part this is motivated by the idea that spans is a good interface for both the existent GL backend and pixman, and so they deserve a dedicated compositor. xcb/xlib target an identical rendering system and so they should be using the same compositor, and it should be possible to run that same compositor locally against pixman to generate reference tests. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> P.S. This brings massive upheaval (read breakage) I've tried delaying in order to fix as many things as possible but now this one patch does far, far, far too much. Apologies in advance for breaking your favourite backend, but trust me in that the end result will be much better. :)
* scaled-font: Convert to cairo_list_tChris Wilson2010-05-041-1/+1
| | | | | Convert the open-coded doubly-linked list of glyph pages for a font into the common cairo_list_t.
* 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
* gl: Decouple cache from scaled-font on context destructionChris Wilson2010-03-221-0/+2
|
* Add 'flight-data-recorder' utility.Chris Wilson2009-08-291-0/+3
| | | | | | | | | | This is a simple variation on cairo-trace that wraps records the last 16 contexts by wrapping the target surface inside a tee surface, along with a meta/recording surface. Then on receipt of a SIGUSR1, those last 16 contexts are played via a script-surface into /tmp/fdr.trace. Mostly proof-of-concept, it seems to be causing a number of rendering glitches whilst testing with firefox -- otherwise, it seems to works.
* [scaled-font] Close race from 16d128Chris Wilson2009-06-051-3/+3
| | | | | | | | Whilst waiting for the fontmap lock on destruction another thread may not only have resurrected the font but also destroyed it acquired the lock first and inserted into the holdovers before the first thread resumes. So check that the font is not already in the holdovers array before inserting.
* [scaled-font] Lean and mean global glyph cache.Chris Wilson2009-03-161-2/+4
| | | | | | | | | | | | | | | | | | | | | | | Jeff Muizelaar pointed out that the severe overallocation implicit in the current version of the glyph cache is obnoxious and prevents him from accepting the trunk into Mozilla. Jeff captured a trace of scaled font and glyph usage during a tp run and presented his analysis in http://lists.cairographics.org/archives/cairo/2009-March/016706.html Using that data, the design was changed to allocate pages of glyphs from a capped global pool but with per-font hash tables. This should allow the glyph cache to have tight memory bounds with fair allocation according to usage. Note that both the old design and the 1.8 glyph cache had essentially unbounded memory constraints, since each scaled font could cache up to 256 glyphs (1.8) or had a reserved page (old), with no limit on the number of active fonts. Currently the eviction policy is a simple random strategy, this gives a 'fair' allotment of the cache, but a LRU variant might perform better. On a sample run of firefox-3.0.7 perusing BBC news in 32 languages: 1.8: cache allocation 8190x, ~1.2 MiB; elapsed 88.2s old: cache allocation 771x, ~13.8 MiB; elapsed 81.7s lean: cache allocation 433x, ~1.8 MiB; elapsed 82.4s
* [scaled-font] Hold reference to original font faceChris Wilson2009-02-241-0/+2
| | | | | | | | | As noted by Carl during his LCA talk, caching of toy fonts was broken because we create the scaled font using the implementation font face and lose the reference to the containing font face that is cached by the toy font face create routines. So the toy fonts were not being preserved for the duration of the holdover scaled fonts and we recreated a new font face, new scaled font and new glyph caches every time we needed a font.
* [scaled-font] Global glyph cacheChris Wilson2009-01-291-2/+4
| | | | | | | | | | | | | | | | | | | | | | Currently glyphs are cached independently in each font i.e. each font maintains a cache of up to 256 glyphs, and there can be as many scaled fonts in use as the application needs and references (we maintain a holdover cache of 512 scaled fonts as well). Alternatively, as in this patch, we can maintain a global pool of glyphs split between all open fonts. This allows a heavily used individual font to cache more glyphs than we could allow if we used per-font glyph caches, but at the same time maintains fairness across all fonts (by using random replacement) and provides a cap on the maximum number of global glyphs. The glyphs are allocated in pages, which are cached in the global pool. Using pages means we can exploit spatial locality within the font (nearby indices are typically used in clusters) to reduce frequency of small allocations and allow the scaled font to reserve a single MRU page of glyphs. This caching dramatically reduces the cairo overhead during the cairo-perf benchmarks, and drastically reduces the number of allocations made by the application (for example browsing multi-lingual site with firefox).
* Add CairoScript backend.Chris Wilson2008-11-131-4/+5
| | | | | | | | | | A new meta-surface backend for serialising drawing operations to a CairoScript file. The principal use (as currently envisaged) is to provide a round-trip testing mechanism for CairoScript - i.e. we can generate script files for every test in the suite and check that we can replay them with perfect fidelity. (Obviously this does not provide complete coverage of CairoScript's syntax, but should give reasonable coverage over the operators.)
* [cairo-scaled-font] Clean up recent locking changesBehdad Esfahbod2008-05-251-1/+1
| | | | Based on feedback from Keith.
* [user-font] Fix fontmap lockingBehdad Esfahbod2008-05-251-0/+2
| | | | | After consulting with Keith Packard we came up with a farily simple solution. Documented in the code.
* [cairo-scaled-font] Implement _cairo_scaled_font_get_max_scale()Behdad Esfahbod2008-05-241-0/+1
|
* [cairo-scaled-font] Mark the scaled font as finished during destruction.Chris Wilson2008-05-061-0/+2
| | | | | | | | During the destruction of every font used with an xlib surface, we send an XRenderFreeGlyphs() for every single glyph in the cache. These requests are redundant as the server-side glyphs will be released along with the XRenderFreeGlyphSet(), so we skip the individual glyph destruction if the font is marked as finished.
* [cairo-scaled-font] Don't err on font size 0, reallyBehdad Esfahbod2008-01-241-0/+1
| | | | | | | | | | First, seems like we were rejecting degenerate font matrix right away at the constructor. Don't do that. Next, PS/PDF were inverting the font scale matrix, assuming that it's invertible. We now keep the inverse too, so they can use it. For the case of a size 0 font, both the scale matrix and its invert are set to 0,0,0,0. That's safe, even if slightly inconsistent.
* [cairo-atomic] Rewrite reference counting using atomic ops.Chris Wilson2007-09-251-1/+2
| | | | | | 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.
* Remove include of cairoint.h from *-private.h header files.Carl Worth2007-08-231-1/+1
| | | | | | | | | | | | These were recently added, (as part of sparse integration?), but they break boilerplate which reaches into at least cairo-types-private.h and cairo-scaled-font-private.h. But boilerplate cannot see cairoint.h or else it gets the internal sybol renaming, (with the INT_ prefix), and then all the test suite tests refuse to link. If this change reverts some recently-added functionality, (or cleanliness), then we'll just need to find some other way to add that back again without the breakage.
* [Makefile.am] Add target sparse to run sparse static source code analyzerBehdad Esfahbod2007-08-221-1/+1
| | | | There are still some bits not quite working.
* [cairo-mutex-private.h] Move implementation-specific parts to ↵Behdad Esfahbod2007-05-011-1/+1
| | | | | | | | | | | | | cairo-mutex-type-private.h This fixes the problem reported by Dave Yeo that boilerplate wasn't building: In file included from ../src/cairo-scaled-font-private.h:44, from cairo-boilerplate.c:65: ../src/cairo-mutex-private.h:183: error: syntax error before "extern" ../src/cairo-mutex-private.h:184: error: syntax error before "void" ../src/cairo-mutex-private.h:185: error: syntax error before "void" make[3]: *** [cairo-boilerplate.lo] Error 1
* [scaled-font] Get rid of _cairo_scaled_font_test_set_max_glyphs_cached_per_fontBehdad Esfahbod2007-04-211-0/+1
| | | | in favor of cairo_boilerplate_scaled_font_set_max_glyphs_cached.
* Move cairo_hash_entry_t to cairo-types-private.hBehdad Esfahbod2007-04-211-0/+2
|
* [scaled-font] Move cairo_scaled_font_t to cairo-scaled-font-private.hBehdad Esfahbod2007-04-211-0/+109