summaryrefslogtreecommitdiff
path: root/src/cairo-type1-fallback.c
AgeCommit message (Collapse)AuthorFilesLines
2010-12-10path: Always interpret in forward directionAndrea Canciani1-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.
2010-11-26array: Silence warningsAndrea Canciani1-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.
2010-11-06Fix type1-fallback bboxAdrian Johnson1-4/+4
2010-10-01Type 1 fallback: add support for latin subsetsAdrian Johnson1-6/+21
For latin subsets the /Encoding array maps the latin encoding to the font glyphs.
2010-05-16type1: Use correct glyph advance when subsetting type 1 fontsAdrian Johnson1-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
2010-04-27Update FSF addressAndrea Canciani1-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
2010-01-22Move _cairo_error() to a standalone headerChris Wilson1-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.
2009-03-31[type1] Fixup error path during write_charstrings()Chris Wilson1-3/+3
On the common error path we attempted to unlock a mutex that was not always held, so reorder the error paths appropriately.
2008-12-12[path] Mark points as const during _cairo_path_fixed_interpret()Chris Wilson1-8/+8
Use const to document the read-only nature of the arguments passed to the callbacks.
2008-11-29Mark allocation failures as unlikely.Chris Wilson1-8/+7
Use the gcc likelihood annotation to indicate that allocation failures are extremely unlikely.
2008-11-29Mark if(status) as being unlikely.Chris Wilson1-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.
2008-11-13[type1] Bind the RD procedureChris Wilson1-1/+1
As the RD procedure may be called several hundred times for a full font, it is worth binding.
2008-10-22Ensure that the scaled font is frozen for the lifetime of the scaled glyph.Chris Wilson1-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.
2008-10-19[type1] Acquire scaled_font mutex.Chris Wilson1-0/+2
In order to perform glyph lookups we need to be holding the mutex for the scaled_font.
2008-09-02Revamp the build system.Behdad Esfahbod1-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.
2008-04-06Type1-fallback: Use correct glyph metrics for .notdef glyphAdrian Johnson1-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.
2008-04-06Type1-fallback: Use correct glyph advance in Type 1 charstringsAdrian Johnson1-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.
2008-03-13Use the correct glyph metrics in Type1 fallbackAdrian Johnson1-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.
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-03-04[cairo-type1-fallback] Propagate original error status.Chris Wilson1-4/+6
_cairo_error() has already been called at the originating error site, so remove the duplicate (hard-coded!) call at the return statement.
2008-01-16[cairo-output-stream] Introduce _cairo_output_stream_create_in_error()Chris Wilson1-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.
2007-12-02Fix regression in Type1 FallbackAdrian Johnson1-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.
2007-10-14Make PostScript output text selectableAdrian Johnson1-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.
2007-10-10Fix some trivial syntax warnings for -ansi.Chris Wilson1-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.
2007-10-05[cairo-type1-fallback] Propagate error from closing the stream.Chris Wilson1-2/+1
Propagate the error from destroying the font and closing the output stream.
2007-10-04[cairo-error] Clean up all the warnings and missing _cairo_error() calls.Chris Wilson1-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.
2007-10-04[malloc/error] Add call to _cairo_error() after a failed malloc.Chris Wilson1-1/+6
Blitz all allocations to ensure that they raise a _cairo_error(CAIRO_STATUS_NO_MEMORY) on failure.
2007-05-10[cairo-scaled-font] Check for allocation failure.Chris Wilson1-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.
2007-04-20Add CFF CID FallbackAdrian Johnson1-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.
2007-04-20Add support for creating CID/composite font subsetsAdrian Johnson1-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.
2007-04-10Add a couple of missing newline charactersCarl Worth1-0/+1
A return statement that's not at the end of a function really needs a line of whitespace after it.
2007-04-09cairo-type1-fallback - propagate error returnsChris Wilson1-7/+18
Add status returns in order to propagate a matrix inversion failure up through the call stack.
2007-04-09cairo-type1-fallback - check for an error during cleanupChris Wilson1-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.
2007-03-07[Type1] Add cairo-type1-private.h that Type1 fallback and subset code shareBehdad Esfahbod1-9/+5
2007-03-02Fix leak of an output stream in cairo_type1_font_destroyCarl Worth1-1/+2
2007-01-07Spell check the docsBehdad Esfahbod1-2/+2
2006-10-23type1 fallback: ensure all functions perform correct status checkingAdrian Johnson1-20/+38
2006-10-22Don't return an uninitialized value if _cairo_output_stream_create failsChristian Biesinger1-1/+3
2006-10-22Actually return a value from _cairo_type1_fallback_init_*Christian Biesinger1-6/+6
2006-10-15Type 1 fallback fonts - use binary encoding in PDF filesAdrian Johnson1-7/+29
PDF files require that embedded Type 1 fonts have the encrypted portion of the font encoded in binary.
2006-10-15cairo-type1-fallback.c: return correct error statusAdrian Johnson1-1/+3
2006-09-07Fix bitmap-font test failure by not generating a type1 font for a bitmap font.Carl Worth1-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
2006-09-07type1: Enforce pre-allocation usage and fail-proof behavior of ↵Carl Worth1-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.
2006-09-07cairo-type1-fallback.c: Regularize some whitespace.Carl Worth1-3/+5
2006-09-07cairo_type1_font_create: Fix missing NO_MEMORY check and cleanup style.Carl Worth1-15/+27
2006-09-07Remove font->status from cairo_type1_font_tCarl Worth1-38/+38
This object doesn't act like a status-holding object, (there are no "if (status) return;" inertness-enforcing statements for example), so it shouldn't pretend like it is.
2006-09-07Check status value of output_stream object at time of destroyCarl Worth1-1/+3
2006-09-05Generate Type 1 fonts from glyph outlinesAdrian Johnson1-0/+682
This patch generates Type 1 fonts for the PS/PDF backends when TrueType or Type 1 subsetting fails. This has the advantage over the current Type 3 fallback of reduced font size and better quality rendering in some PDF viewers. xpdf shows a large improvement in text display quality with this patch.