Age | Commit message (Collapse) | Author | Files | Lines |
|
scaling transform." (#13479)
The reasoning for that commit was that fonts with bitmap strikes should be
rendered with antialiasing off for those (hopefully) few glyphs that don't
have a bitmap.
However, it turns out, there are fonts that have some, but very few, bitmaps,
and this changed forces non-AA rendering on them. We now support multiple
glyph formats per font in the Xlib backend, so backing this out to let every
glyph render as is. Fontconfig rules can be used to force AA off on a per-font
basis.
This reverts commit 06af5c2891b89da28581c30afcde06c5442884db.
(cherry picked from commit 83963d2a9ec445e23cfbe692b877177a9d9d135e)
|
|
When the current font size matches one of the available fixed sizes, and
the overall transform has only scaling components, FreeType will use the
fixed size bitmaps by default. For glyphs which do not have bitmaps,
force them to be rendered in monochrome instead of anti-aliased so
that they all match nicely.
(cherry picked from commit 06af5c2891b89da28581c30afcde06c5442884db)
|
|
calloc() will check its arguments for integer overflows so it is safer
not to pre-multiply them.
(cherry picked from commit 66664596559c55913fb0b9c8784fe8ab862c217b)
|
|
Same for FT_Render_Glyph.
When the user asks us to render a glyph that is not available in the font,
it's mostly an unavoidable kind of error for them, as in, they can't
avoid such a call. So it's not nice to put cairo_t in an error state and
refuse any further drawying.
Many PDF files are created using buggy software and cause such glpyh-not-found
errors for CID 0 for example.
Eventually we should propagate these kind of errors up and return it from
the function call causing it, but that needs API change to add return value
to all text functions, so for now we just ignore these errors.
(cherry picked from commit 79d975f84bcc32e91db517d71a7312e2e1d653d4)
|
|
Under rare circumstances we may need to extract a surface that
represents a bitmap with width==0 and rows==0. Detect this case at the
start and simply return a zero-sized surface.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=12284.
(cherry picked from commit d62f8861689d8b9a9a837043fb78813f0407abd4)
|
|
As noted in http://bugs.freedesktop.org/show_bug.cgi?id=12026 the error
path of _cairo_ft_unscaled_font_lock_face() failed to reset the
unscaled->lock_count before releasing the mutex and returning NULL.
(cherry picked from commit bc635da45a32eb9b7aff6fa5f7f560ebf99092a8)
|
|
This patch introduces three macros: _cairo_malloc_ab,
_cairo_malloc_abc, _cairo_malloc_ab_plus_c and replaces various calls
to malloc(a*b), malloc(a*b*c), and malloc(a*b+c) with them. The macros
return NULL if int overflow would occur during the allocation. See
CODING_STYLE for more information.
(cherry picked from commit 5c7d2d14d78e4dfb1ef6d2c40f0910f177e07360)
|
|
Behdad Esfahbod noted that in ff5af0f540ec4 I had introduce new error
paths without the appropriate _cairo_error(). So review cairo-ft-font
to ensure that _cairo_error() is called at the start of every error path,
as close to the originating error as possible.
|
|
FT_Set_Char_Size can fail due to an out-of-memory condition, so
propagate the error status instead of asserting that it never fails.
|
|
Only return a font face from the cache if it is not in an error condition.
Otherwise unlink the bad font face from the cache and construct a new one.
|
|
During _decompose_glyph_outline() destroy the fixed path if we
encounter an error.
|
|
Release the reference to the unscaled font if we encounter an error
whilst initialising the cairo_ft_scaled_font_t.
|
|
Small window of opportunity for the unscaled font to be destroyed and
removed from the hash table before
_cairo_ft_unscaled_font_create_for_pattern() takes a reference on behalf
of its cairo. Close the window by taking the reference with the font
map lock held.
|
|
As we allocated the surface we need to destroy it if we encounter an
error.
|
|
This is more consistent with CAIRO_MUTEX_LOCK/UNLOCK.
|
|
|
|
Currently if the ownership of the bitmap->buffer is passed to
_get_bitmap_surface() then the status of the buffer is inconsistent
should the function detect an error (i.e. CAIRO_STATUS_NO_MEMORY).
Fix it up that should we encounter an error and we own the buffer then
we always free it on behalf of the caller.
|
|
Catch the status return, cleanup and propagate the error.
|
|
|
|
This is necessary to avoid many portability problems as cairoint.h includes
config.h. Without a test, we will regress again, hence add it.
The inclusion idiom for cairo now is:
#include "cairoint.h"
#include "cairo-something.h"
#include "cairo-anotherthing-private.h"
#include <some-library.h>
#include <other-library/other-file.h>
Moreover, some standard headers files are included from cairoint.h and need
not be included again.
|
|
|
|
All mutex declarations have been moved to cairo-mutex-list.h.
This should avoid breaking of less frequently tested backends,
when mutexes are introduced or when existing mutexes are renamed.
Instead of initializing mutexes on library startup, mutexes are
lazily initialized within the few entry points of now by calling
CAIRO_MUTEX_INITIALIZE(). Currently only the OS/2 backend takes
care about releasing global mutexes. Therefore there is no counter
part of that macro for finalizing all global mutexes yet - but
as cairo-backend-os2.c shows such a function would be quite
easy to implement.
|
|
Thanks to M.Drochner@fz-juelich.de for noticing the bug.
This fixes bug #10235:
locking bug in cairo_ft_scaled_font_unlock_face()
http://bugs.freedesktop.org/show_bug.cgi?id=10235
|
|
since they are not static in some of the implementations (win32, ...)
|
|
David Turner said:
The returned 26.6 advance is always rounded, even with FT_LOAD_NO_HINTING.
You can however retrieve the linearly scaled value as a 16.16 fixed float
number through face->glyph->linearHoriAdvance. This works even with hinted
glyphs.
|
|
This was inadvertently changed as part of fdffde8b9e7a2308b822ddef7b02a8e85cc8ba1e
With the Boolean, pango-using programs that locked the same
unscaled_font multiple times would crash with a message such as:
cairo-ft-font.c:569: _cairo_ft_unscaled_font_unlock_face: Assertion `unscaled->is_locked' failed.
|
|
This fixes a regression introduced with commit:
25a370d7992d7f70d8cf79f1b328e40437b40ac4
This was showing up as a failure of the bitmap-font test case
with the ps, pdf, and svg backends.
|
|
_cairo_ft_unscaled_font_unlock_face
Previously we just had an integer counter here, but that is not
sufficient as multiple cairo_scaled_font_t objects, (which are
implicitly shared through the font caches), can reference the
same cairo_ft_unscaled_font_t so real locking is needed here.
This commit eliminates an assertion failure exposed by the
pthread-show-text test case:
lt-pthread-show-text: cairo-ft-font.c:562: _cairo_ft_unscaled_font_unlock_face: Assertion `unscaled->lock > 0' failed.
|
|
We're planning to change the implementation of the public function,
(which will remove some locking safety), so use the safe, locked
_cairo_ft_unscaled_font_lock_face for internal use instead.
|
|
|
|
- Add a to_unicode array to the scaled_font_subsets
for mapping glyphs to unicode characters
- Add a function to the TrueType subsetting for
performing a reverse cmap for mapping glyph indices
to unicode characters.
- Add a new scaled font backend function for mapping
glyph indices to unicode characters. Provide FreeType
and Win32 implementations of the font backend mapping
function.
- Modify the PDF backend to embed ToUnicode streams
into each font. The unicode mapping is obtained by
first trying the reverse cmap. If this fails the font
backend mapping function is called.
|
|
|
|
The fallback paths always assume UNSUPPORTED if a method is NULL, so, no need
for a method to just return UNSUPPORTED.
|
|
Pass cairo_ft_options_t around by pointer, not by value. That's what we do
with cairo_font_options_t anyway, and there is no reason to not do the same
here. (makes -Waggregate-return warnings go away btw).
|
|
|
|
public functions
|
|
branch of interest.
|
|
instead of poking at the loadflags.
|
|
|
|
|
|
and make sure that _cairo_ft_load_truetype_table returns UNSUPPORTED
if the version of FreeType used doesn't support FT_Load_Sfnt_Table.
|
|
if we don't want it. This stuff is tricky, but I hope to explain: In your
fontconfig configuration, you may match on "font", or on "pattern". Turning
subpixel on typically looks like:
<match target="font">
<test qual="all" name="rgba">
<const>unknown</const>
</test>
<edit name="rgba" mode="assign"><const>rgb</const></edit>
</match>
This works good enough, and if you set to ANTIALIAS_GRAY, this will not
override that. Now one may forget to match on "font" target, or intentionally
match on the pattern. That happens before cairo font options are substituted
in the pattern. So, to give a hint of subpixel in your config file, you can
write:
<match target="pattern">
<edit name="rgba" mode="assign"><const>rgb</const></edit>
</match>
You don't really need to check for current values, as FcConfigSubstitute is
run before merging cairo_font_options_t in. What this patch does, is to reset
pattern's rgba property if the font options explicitly ask for ANTIALIAS_GRAY.
This is the only place in cairo-ft-font.c that we use FcPatternDel, so I
thought some explanation is needed.
|
|
Shouldn't make /any/ difference at all in any case.
|
|
otherwise, it looks like "I don't care" and fontconfig configuration is
allowed to decide to turn subpixel on. This fixes the bug that subpixel
colors where showing up in fallback images in PS/PDF/SVG backends, observed
in the test fallback-resolution.
|
|
Conflicts:
src/cairo-font-subset.c
|
|
|
|
|
|
right now. Failing disables the subsetting for vertical fonts, like
it was being done before the recent changes to the TrueType subsetter.
|
|
Add a load_truetype_table function to cairo_scaled_font_backend_t and
use it to load the truetype sfnt tables. Implement this with freetype
for the freetype font backend and use GetFontData for win32. Atsui
remains unimplemented, and still falls back to type3 fonts.
|
|
The TrueType font subsetting code fails to emit VHEA/VMTX headers for the
font, so WMode 1 doesn't work to switch to vertical metrics. Added a bug
about this, and changed the PS/PDF output code to just use Type3 in this
case until the bug is fixed. Updated the reference images to match the
output for PDF/PS backends for the vertical font check.
|