Age | Commit message (Collapse) | Author | Files | Lines |
|
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.
|
|
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.
|
|
|
|
For latin subsets the /Encoding array maps the latin encoding to the
font glyphs.
|
|
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
|
|
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
|
|
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.
|
|
On the common error path we attempted to unlock a mutex that was not
always held, so reorder the error paths appropriately.
|
|
Use const to document the read-only nature of the arguments passed to the
callbacks.
|
|
Use the gcc likelihood annotation to indicate that allocation failures are
extremely unlikely.
|
|
The error paths should be hit very rarely during normal operation, so mark
them as being unlikely so gcc may emit better code.
|
|
As the RD procedure may be called several hundred times for a full font,
it is worth binding.
|
|
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.
|
|
In order to perform glyph lookups we need to be holding the mutex for the
scaled_font.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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_error() has already been called at the originating error site, so
remove the duplicate (hard-coded!) call at the return statement.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
Propagate the error from destroying the font and closing the output stream.
|
|
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.
|
|
Blitz all allocations to ensure that they raise a
_cairo_error(CAIRO_STATUS_NO_MEMORY) on failure.
|
|
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.
|
|
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.
|
|
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.
|
|
A return statement that's not at the end of a function really needs
a line of whitespace after it.
|
|
Add status returns in order to propagate a matrix inversion failure
up through the call stack.
|
|
The cleanup path is shared between the error path and the true path, and
so any error along it can not be ignored.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PDF files require that embedded Type 1 fonts have the encrypted
portion of the font encoded in binary.
|
|
|
|
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
|
|
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.
|
|
|
|
|
|
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.
|
|
|
|
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.
|