summaryrefslogtreecommitdiff
path: root/src/cairo-type1-fallback.c
Commit message (Collapse)AuthorAgeFilesLines
* Support color fonts that use the foreground colorAdrian Johnson2021-08-281-0/+3
| | | | | | | | | | | | | 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-1/+1
| | | | | | | | | | _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>
* replace _BSD_SOURCE with _DEFAULT_SOURCEAdrian Johnson2017-09-161-1/+1
| | | | | | fixes the warning: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
* Introduce a new compositor architectureChris Wilson2011-09-121-0/+2
| | | | | | | | | | | | | | | | | | 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. :)
* clip: Rudimentary support for clip-polygon extractionChris Wilson2011-07-191-1/+1
| | | | | | | Step 1, fix the failings sighted recently by tracking clip-boxes as an explicit property of the clipping and of composition. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* path: Always interpret in forward directionAndrea Canciani2010-12-101-1/+0
| | | | | | Path are always interpreted in forward direction, so the ability of interpreting in the opposite direction (which is very unlikely to be useful at all) can be removed.
* array: Silence warningsAndrea Canciani2010-11-261-2/+2
| | | | | | | | 493aaf0f15bfedc88371ffab07d862a400b0da38 made all cairo_array functions use unsigned int for indexes and sizes. This commit fixes the compiler warnings about those values being compared to signed int's.
* Fix type1-fallback bboxAdrian Johnson2010-11-061-4/+4
|
* Type 1 fallback: add support for latin subsetsAdrian Johnson2010-10-011-6/+21
| | | | | For latin subsets the /Encoding array maps the latin encoding to the font glyphs.
* type1: Use correct glyph advance when subsetting type 1 fontsAdrian Johnson2010-05-161-9/+9
| | | | | | | | Previously the glyph advance in font units was used for the widths in the PDF font dictionary. This only works for Type 1 fonts that use a [0.001 0 0 0.001 0 0] font matrix. https://bugs.freedesktop.org/show_bug.cgi?id=28061
* 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.
* [type1] Fixup error path during write_charstrings()Chris Wilson2009-03-311-3/+3
| | | | | On the common error path we attempted to unlock a mutex that was not always held, so reorder the error paths appropriately.
* [path] Mark points as const during _cairo_path_fixed_interpret()Chris Wilson2008-12-121-8/+8
| | | | | Use const to document the read-only nature of the arguments passed to the callbacks.
* Mark allocation failures as unlikely.Chris Wilson2008-11-291-8/+7
| | | | | Use the gcc likelihood annotation to indicate that allocation failures are extremely unlikely.
* Mark if(status) as being unlikely.Chris Wilson2008-11-291-22/+22
| | | | | The error paths should be hit very rarely during normal operation, so mark them as being unlikely so gcc may emit better code.
* [type1] Bind the RD procedureChris Wilson2008-11-131-1/+1
| | | | | As the RD procedure may be called several hundred times for a full font, it is worth binding.
* Ensure that the scaled font is frozen for the lifetime of the scaled glyph.Chris Wilson2008-10-221-2/+7
| | | | | | | | | | | | | | | | After discussing the scaled font locking with Behdad, it transpired that it is not sufficient for a font to be locked for the lifetime of a scaled glyph, but that the scaled font's glyph cache must be frozen for the glyph' lifetime. If the cache is not frozen, then there is a possibility that the glyph may be evicted before the reference goes out of scope i.e. the glyph becomes invalid whilst we are trying to use it. Since the freezing of the cache is the stronger barrier, we remove the locking/unlocking of the mutex from the backends and instead move the mutex acquisition into the freeze/thaw routines. Then update the rule on acquiring glyphs to enforce that the cache is frozen and review the usage of freeze/thaw by all the backends to ensure that the cache is frozen for the lifetime of the glyph.
* [type1] Acquire scaled_font mutex.Chris Wilson2008-10-191-0/+2
| | | | | In order to perform glyph lookups we need to be holding the mutex for the scaled_font.
* Revamp the build system.Behdad Esfahbod2008-09-021-0/+5
| | | | | | | | | | | | | | | | | Quick summary of changes: - Move list of cairo source files out of src/Makefile.am and into src/Sources.mk, - Generate files src/Config.mk and src/Config.mk.win32 that choose the right set of source files and headers based on configured backends and features. This drastically simplifies building using other build systems. The src/Makefile.win32 file needs to be updated to reflect these changes. - Add README files to various directories, - Add toplevel HACKING file.
* Type1-fallback: Use correct glyph metrics for .notdef glyphAdrian Johnson2008-04-061-63/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug 15348 references the following PDF that was printing incorrectly when running through poppler and cairo to generate PostScript. http://launchpadlibrarian.net/12921700/UbuntuDesktop.pdf The PostScript output had too much space between each word causing strings of glyphs printed with the TJ operator to overlap. The original PDF file contains an CFF font with CID Identity-H encoding. The PDF file is using character code 0 (glyph 0 due to Identity-H encoding) as a space character. The CFF specification defines glyph 0 to be the .notdef glyph. The PS backend subsets CFF fonts as a Type1-fallback font. Type1-fallback creates it's own empty .notdef glyph with an arbitrary glyph advance of 500. The problem here is the TJ operator used to output the glyphs depends on the glyph advance being correct. pdf-operators.c uses the glyph advance returned by _scaled_glyph_init(). However the PostScript interpreter sees the glyph advance of 500 for .notdef. This problem does not occur when generating PDF as the PDF font dictionary contains an list of glyph advances that override the font metrics. Fix this by making Type1-fallback not treat .notdef as special and to create it the path and metrics obtained from _scaled_glyph_init(). As a special case, make it not fail if _scaled_glyph_init() is unable to return a path for .notdef. This was probably the reason Type1-fallback previously created it's own .notdef glyph as calling _scaled_glyph_init(_GLYPH_INFO_PATH) for glyph 0 returns CAIRO_INT_STATUS_UNSUPPORTED for some fonts. This ensures the Type1-fallback font metrics match the metrics used by pdf-operators.c to position the glyphs. This also results in the removal of some duplicated code.
* Type1-fallback: Use correct glyph advance in Type 1 charstringsAdrian Johnson2008-04-061-1/+1
| | | | | | | | | | 5050c55f93af fixed type1-fallback to use the glyph advance instead of glyph width in the stored glyph metrics in the font. However it did not fix the same bug in Type 2 charstrings (used by CFF fallback in PDF). This problem was not noticed since the glyph widths in the PDF font dictionary overrides these values. Fix this in case any software reading cairo PDFs uses these values.
* Use the correct glyph metrics in Type1 fallbackAdrian Johnson2008-03-131-4/+4
| | | | | | | | Now that the PS backend is using PDF operators, it uses the glyph metrics in the font to position each glyph in a string. This exposed a bug in Type 1 fallback where the glyph width and height was used in the charstrings instead of x_advance/y_advance. This was causing strings to print diagonally due to the no zero y_advance.
* 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-type1-fallback] Propagate original error status.Chris Wilson2008-03-041-4/+6
| | | | | _cairo_error() has already been called at the originating error site, so remove the duplicate (hard-coded!) call at the return statement.
* [cairo-output-stream] Introduce _cairo_output_stream_create_in_error()Chris Wilson2008-01-161-4/+4
| | | | | | | Use a utility function to wrap an incoming error status into a new error stream. As a side-effect, all error streams must be destroyed as in the general case the caller can not distinguish between a static error object and one allocated to hold an unusual error status.
* Fix regression in Type1 FallbackAdrian Johnson2007-12-021-2/+4
| | | | | | | | | | | As a result of the changes to improve the status checking, _cairo_type2_charstrings_init() was failing due to the failure status returned when the font->output stream is destroyed. This is because _cairo_type2_charstrings_init() does not create an output stream. Fix this by initializing font->output to NULL and only destroy it if not NULL.
* Make PostScript output text selectableAdrian Johnson2007-10-141-3/+15
| | | | | | | The glyph names used in the Type42 and Type1 fallback fonts are now of the form "/uniXXXX" where XXXX is the unicode character for each glyph. When converted to pdf (eg using ps2pdf), pdf viewers are now able to correctly extract the text.
* Fix some trivial syntax warnings for -ansi.Chris Wilson2007-10-101-1/+1
| | | | | | gcc -ansi -pedantic gives a few syntax warnings, principally for use of '//' comments and a comma at the end of enumerators. Apply these corrections as they are trivial.
* [cairo-type1-fallback] Propagate error from closing the stream.Chris Wilson2007-10-051-2/+1
| | | | Propagate the error from destroying the font and closing the output stream.
* [cairo-error] Clean up all the warnings and missing _cairo_error() calls.Chris Wilson2007-10-041-16/+11
| | | | | | | | | | | 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/+6
| | | | | Blitz all allocations to ensure that they raise a _cairo_error(CAIRO_STATUS_NO_MEMORY) on failure.
* [cairo-scaled-font] Check for allocation failure.Chris Wilson2007-05-101-1/+1
| | | | | | | | | cairo_scaled_font_create() returns a nil object on failure whereas a few callers were checking for NULL. Secondly review the public entry points for cairo_scaled_font_*() to ensure that all check that they will not attempt to overwrite the read-only nil object.
* Add CFF CID FallbackAdrian Johnson2007-04-201-59/+152
| | | | | | | | | | Switching to CID font embedding requires a fallback font for the case where CFF CID or TrueType CID subsetting fails. The new function _cairo_type2_charstrings_init() added to cairo-type1-fallback.c creates Type2 charstrings from glyph paths. _cairo_cff_fallback_init() in cairo-cff-subset.c wraps these charstrings in a CFF CID font.
* Add support for creating CID/composite font subsetsAdrian Johnson2007-04-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | cairo-scaled-font-subsets.c now provides three functions for creating subsets: _cairo_scaled_font_subsets_create_scaled() Create a subset for each scaled font with maximum size INT_MAX. _cairo_scaled_font_subsets_create_simple() Create subsets suitable for embedding as simple fonts in PS/PDF. _cairo_scaled_font_subsets_create_composite() Create subsets suitable for embedding as composite fonts in PS/PDF. The _create_simple() and _create_composite() functions both merge scaled fonts with the same face and an outline path available into the same subset. _create_composite() has a maximum subset size of 65536 for outline fonts. Bitmap fonts have a separate subset for each scale with a maximum subset size of 256. The _create_simple() and _create_composite() functions both reserve the first glyph in the subset for the .notdef glyph. CID fonts require CID 0 to be .notdef. Update Type1, TrueType and CFF subsetting to expect glyph 0 of each subset to be the .notdef.
* Add a couple of missing newline charactersCarl Worth2007-04-101-0/+1
| | | | | A return statement that's not at the end of a function really needs a line of whitespace after it.
* cairo-type1-fallback - propagate error returnsChris Wilson2007-04-091-7/+18
| | | | | Add status returns in order to propagate a matrix inversion failure up through the call stack.
* cairo-type1-fallback - check for an error during cleanupChris Wilson2007-04-091-3/+4
| | | | | The cleanup path is shared between the error path and the true path, and so any error along it can not be ignored.
* [Type1] Add cairo-type1-private.h that Type1 fallback and subset code shareBehdad Esfahbod2007-03-071-9/+5
|
* Fix leak of an output stream in cairo_type1_font_destroyCarl Worth2007-03-021-1/+2
|
* Spell check the docsBehdad Esfahbod2007-01-071-2/+2
|
* type1 fallback: ensure all functions perform correct status checkingAdrian Johnson2006-10-231-20/+38
|
* Don't return an uninitialized value if _cairo_output_stream_create failsChristian Biesinger2006-10-221-1/+3
|
* Actually return a value from _cairo_type1_fallback_init_*Christian Biesinger2006-10-221-6/+6
|
* Type 1 fallback fonts - use binary encoding in PDF filesAdrian Johnson2006-10-151-7/+29
| | | | | PDF files require that embedded Type 1 fonts have the encrypted portion of the font encoded in binary.
* cairo-type1-fallback.c: return correct error statusAdrian Johnson2006-10-151-1/+3
|
* Fix bitmap-font test failure by not generating a type1 font for a bitmap font.Carl Worth2006-09-071-11/+24
| | | | | | This was simply a matter of ensuring that the UNSUPPORTED return value was checked for and propagated all the way out of cairo-type1-fallback.c
* type1: Enforce pre-allocation usage and fail-proof behavior of ↵Carl Worth2006-09-071-7/+42
| | | | | | | | | | | | | charstring_encode functions These functions were previously returning a status value that was almost never being checked. Instead we now make these functions void and enforce a usage pattern that the destination array must be pre-grown to accomodate the results. This is verified with a couple of assert statements. The pre-allocation was already happening with all but one call. That call is now also fixed up.
* cairo-type1-fallback.c: Regularize some whitespace.Carl Worth2006-09-071-3/+5
|
* cairo_type1_font_create: Fix missing NO_MEMORY check and cleanup style.Carl Worth2006-09-071-15/+27
|