summaryrefslogtreecommitdiff
path: root/src/cairo-quartz-font.c
Commit message (Collapse)AuthorAgeFilesLines
* Add new cairo_user_scaled_font_get_foreground_source() functionAdrian Johnson2023-01-261-1/+1
| | | | | | | | | | | | 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.
* [quartz] Adjust x_extents metric.John Ralls2022-04-251-1/+6
| | | | | | | | | | | | | CoreText uses different advances depending on the font size, with very small point sizes sometimes getting advances that are smaller than the glyph's width. This is manifested in the Apple Color Emoji font with the Emoji glyphs having a width of 1.25 and an advance width of 1.0. That results in overlapping emoji when they're in a string. The small spacing difference also affects 3 tests so updated reference images are included in this commit. # Please enter the commit message for your changes. Lines starting
* [quartz] Implement color font support.John Ralls2022-04-251-10/+51
|
* [quartz] Convert font handling from CGFont to CTFont.John Ralls2022-04-241-142/+159
|
* Reimplement cairo-quartz-font with Core Text.John Ralls2022-04-241-38/+58
|
* [quartz] Require at least Mac OS X 10.7 LionJohn Ralls2022-04-241-156/+33
| | | | Allows removal of most conditional compilation and dlsym lookups.
* Support color fonts that use the foreground colorAdrian Johnson2021-08-281-1/+2
| | | | | | | | | | | | | 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.
* Use _cairo_malloc instead of mallocAdrian Johnson2018-05-071-3/+3
| | | | | | | | | | _cairo_malloc(0) always returns NULL, but has not been used consistently. This patch replaces many calls to malloc() with _cairo_malloc(). Fixes: fdo# 101547 CVE: CVE-2017-9814 Heap buffer overflow at cairo-truetype-subset.c:1299 Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* quartz-font: Fix text-glyph-rangeAndrea Canciani2017-04-251-8/+8
| | | | | | | | | The index 0 is a legitimate index used for character codes that do not correspond to any glyph in the font. Instead, the API reserves 0xFFFF (kCGFontIndexInvalid) as the invalid index and defines 0xFFFE (kCGFontIndexMax = kCGGlyphMax) as the maximum legal index. Fixes text-glyph-range.
* quartz-font: Correct handling of SMP Unicode charactersAndrea Canciani2017-04-251-4/+5
| | | | | | | | | | Truncating the UCS4 representation to 16 bits only works for the Basic Multilingual Plane, the other characters must be translated to a surrogate pair. Fixes smp-glyph. Reported-by: Clerk Ma <clerkma@gmail.com>
* quartz: Restore 10.4-specific font codeAndrea Canciani2017-01-181-4/+22
| | | | | | | | The code for extracting font glyphs was replaced in 70cc8f250b5669e757b4f044571ba0f71e3dea9e with an implementation based on CoreText, which is not available on MacOSX 10.4. This commit restores automatic detection of which API should be used by means of dynamic linking.
* Fix broken canvas text font size in InkscapeBryce Harrington2015-04-241-1/+1
| | | | | | | | | | An earlier fix to bug 84324 added a regression in the font size of canvas text in Inkscape when compiled with the Quartz backend. Patch from Andrea Canciani Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=84324 Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* quartz: Remove call to obsolete CGFontGetGlyphPathAndrea Canciani2015-02-051-6/+4
| | | | | | | | | | CGFontGetGlyphPath was not public and is not available anymore on modern OSX/iOS systems. The same functionality is available through the CoreText API since OSX 10.5. Based on a patch by Simon Cozens. Fixes https://bugs.freedesktop.org/show_bug.cgi?id=84324
* font: Push the last reference dec into the backend->destroy() callbackChris Wilson2013-09-171-1/+2
| | | | | | | | | | | | | | 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/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 doc ids more consistent my always putting ':' after themAndrea Canciani2012-03-291-2/+2
| | | | | This makes the documentations comments more consistent and fixes many reports of 'invalid doc id'.
* doc: Make documentation comments symmetricAndrea Canciani2012-03-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* quartz: Fix the 32-bits build on MacOSX 10.7Andrea Canciani2011-10-011-8/+18
| | | | | | | | | | | | FMGetATSFontRefFromFont() is not public on Lion nor on 64-bits Frameworks, but it seems to be available in the dynamic libs, hence we can dlsym() it just like other private functions. Works around the error: cairo-quartz-font.c: In function 'cairo_quartz_font_face_create_for_atsu_font_id': cairo-quartz-font.c:830: error: implicit declaration of function 'FMGetATSFontRefFromFont' Fixes https://bugs.freedesktop.org/show_bug.cgi?id=39493
* quartz-font: Fix scaled font backend hooksAndrea Canciani2011-09-181-1/+0
| | | | | | | | | | In af9fbd176b145f042408ef5391eef2a51d7531f8 the show_glyphs hook has been removed from cairo_scaled_backend_t, but quartz-font was not updated. Fixes: cairo-quartz-font.c:798: warning: initialization from incompatible pointer type
* quartz: Fix compilationAndrea Canciani2011-09-021-0/+1
| | | | | | | cairo-image-surface-private.h is needed in order to access cairo_image_surface_t fields. Fixes multiple build errors: dereferencing pointer to incomplete type
* api: Extend cairo_antialias_t to include performace/quality hintsChris Wilson2011-08-301-0/+3
| | | | | | | | | | | The existing API only described the method to be used for performing rasterisation and unlike other API provided no opportunity for the user to give a hint as to how to trade off performance against speed. So in order to no be overly prescriptive, we extend the NONE/GRAY/SUBPIXEL methods with FAST/GOOD/BEST hints and leave the backend to decide how best to achieve those goals. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* quartz-font: Remove unused variablesAndrea Canciani2011-03-181-12/+0
| | | | x_scale and y_scale are computed but never used.
* quartz-font: Implement new load_truetype_table semanticsAndrea Canciani2010-11-231-13/+10
| | | | | | fb0304e2a9c99fa00e68bf4b37074a6885f19cff changed and specified the behavior of load_truetype_table. This commit makes quartz-font implement the new behavior.
* quartz-font: Do not leak CFDataRef'sAndrea Canciani2010-11-011-0/+3
| | | | CFData is allocated and thus needs to be freed.
* quartz-font: Add truetype font table tags accessorAndrea Canciani2010-11-011-1/+38
| | | | Improves the quality of embedded fonts.
* doc: Fix a syntax issue in quartz-font gtkdocBenjamin Otte2010-07-091-0/+1
| | | | | A missing empty line caused the long description to be part of @See_Also. Ooops.
* 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).
* quartz-font: correct and explain matrix computationsAndrea Canciani2010-06-281-7/+6
| | | | | | glyph_path was taking into account the translation (which currently is already applied in gstate) and the sign of the elements of the matrices was not explained.
* quartz-font: silence compiler warningsAndrea Canciani2010-06-281-54/+30
| | | | | Remove an unused function, explicitly ignore or check return values, don't define unused variables.
* quartz-font: Silence 0x0 CGContext warningAndrea Canciani2010-05-171-35/+42
| | | | | | | | | Silence Quartz complaints about operations on empty contexts: <Error>: CGContextSetFont: invalid context 0x0 <Error>: CGContextSetFontSize: invalid context 0x0 <Error>: CGContextSetTextMatrix: invalid context 0x0 <Error>: CGContextSetAlpha: invalid context 0x0 <Error>: CGContextShowGlyphsAtPoint: invalid context 0x0
* quartz-font: Conform context and antialias handling to quartz-surfaceAndrea Canciani2010-05-171-10/+28
| | | | | A8 surfaces are now kAlphaOnly surfaces in quartz-font too. Subpixel font smoothing can be enabled.
* quartz: Work around bad glyph extents returned by CoreGraphics for empty ↵Jonathan Kew2010-05-071-0/+10
| | | | | | | | | glyphs in Al Bayan font This resolves the problem by checking for the crazy glyph bbox result from CoreGraphics, and replacing it with an empty rect. From https://bugzilla.mozilla.org/show_bug.cgi?id=534260
* Update license blocks to use "Mozilla Foundation" instead of "Mozilla ↵Metal Sonic2010-05-061-1/+1
| | | | | | Corporation" From https://bugzilla.mozilla.org/show_bug.cgi?id=507387
* 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/+2
| | | | | 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.
* [quartz] Use the implementation font-face not the associatedChris Wilson2009-08-101-4/+2
| | | | | | As the associated is now explicitly the font-face used to create the font by the user, whereas what we require is the current implementation (quartz) font.
* Fix compilation on OS X when compiling for 64 bitJeff Muizelaar2009-06-111-1/+2
| | | | | OS X doesn't support ATSUI in 64 bit so don't include the cairo ATSUI API in that case.
* [quartz] Delay allocation of string until after guard.Chris Wilson2009-01-021-2/+4
| | | | | | | Fixes a memory leak should we bail due to the version of Quartz being insufficient. Reported: http://bugs.freedesktop.org/show_bug.cgi?id=19209.
* Fix definition of _cairo_quartz_font_face_backendJeff Muizelaar2008-12-191-1/+0
| | | | | Removes the NULL so that _cairo_quartz_font_face_scaled_font_create is in the correct location.
* Fix compilation of quartz surface.Jeff Muizelaar2008-12-191-2/+4
| | | | | Declares _cairo_quartz_scaled_font_backend ahead of time and makes it static. Also, removes the 'static' from the _cairo_quartz_font_backend definition.
* Clean up toy font face handlingBehdad Esfahbod2008-12-171-130/+78
| | | | | | | | | | | | | | | | | 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.
* Map toy font face to implementation.Chris Wilson2008-10-221-11/+44
| | | | | | | | | | | | | | | | 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.
* Rename _cairo_matrix_compute_scale_factors to ↵Behdad Esfahbod2008-08-271-3/+3
| | | | _cairo_matrix_compute_basis_scale_factors
* [quartz] Protect against NULL from CGFontGetHMetricsPtrVladimir Vukicevic2008-07-091-0/+6
| | | | Seems to happen on 10.4 only for unknown reasons. Protect against a crash at least.
* Rename cairo_quartz_scaled_font_backend to _cairo_quartz_scaled_font_backendBehdad Esfahbod2008-06-221-2/+2
|
* Fix gtk-doc warningsBehdad Esfahbod2008-05-101-6/+6
|
* [quartz] Fix CGFont leaks when creating quartz fontsVladimir Vukicevic2008-04-271-1/+8
| | | | | The toy font constructor and the _with_atsu_font_id constructor were not properly managing the refcount of the CGFontRef.
* [cgfont] typo fixVladimir Vukicevic2008-04-021-1/+1
|
* [cgfont] Implement missing scaled font metricsVladimir Vukicevic2008-04-021-3/+71
|
* Include cairoint.h first to satisfy the test suiteCarl Worth2008-04-011-2/+2
| | | | | | Forgetting to include cairoint.h (or not including it first) can cause some subtle bugs due to specific feature flags not being set, etc.