| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
This does not affect functionality in any way,
but it hopefully makes the logic easier to follow.
Resolves CID 175691.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
DirectWrite does not provide fast access to the is_postscript flag,
requiring each font to be loaded before its format can be determined.
Eagerly doing this for every installed font can be quite slow,
on the order of seconds.
To improve performance, ask the font provider for this information
only when it is actually needed, i.e. when one of the font's full
names or its PostScript name matches a requested font name and we
need to know whether to accept this match.
The return value of check_postscript is not cached in this commit.
This makes repeated calls slower than accessing is_postscript was.
This should not be a problem, but if it is, the value can be cached
(or precomputed) by font providers in their font private data.
This commit also potentially increases the memory usage of some
font providers by retaining data structures needed to implement
check_postscript in their font private data. This should not be
a problem either, but if it is, the value of check_postscript
can be precomputed by all providers other than DirectWrite.
|
| |
|
|
|
|
|
|
|
| |
Fonts without PostScript outlines (such as TrueType fonts) are unaffected,
and their PostScript names continue to be ignored when searching for fonts.
This matches the behavior of GDI and hence VSFilter.
|
|
|
|
|
|
|
| |
And fix two wrong comments.
Bump the Fontconfig version requirement to 2.10.92 (2.11 RC2), released
on 2013-03-29, to ensure Fontconfig caches and exposes PostScript names.
|
| |
|
|
|
|
|
|
|
|
|
| |
As before, this does not add any build system support:
a config.h file and a project must still be manually created
(or the compiler can be run manually instead of using a project).
Signed-off-by: Grigori Goronzy <greg@kinoho.net>
Signed-off-by: Oleg Oshmyan <chortos@inbox.lv>
|
|
|
|
| |
Found by clang static analysis.
|
|
|
|
|
|
| |
If no particular codepoint is requested (codepoint == 0), just return
the first font family. Additionally, handle fontconfig errors, albeit
they're unlikely to happen.
|
|
|
|
|
| |
Apparently we only need the font family (and even that isn't used in all
font providers). Drop the others.
|
|
|
|
|
|
| |
Tired of matching the names and order of the callbacks in my head.
While we're at it, also give some of the callbacks better names.
|
|
|
|
|
|
|
| |
FcInitLoadConfig() could faul, leaving rc=1 and fc->config=NULL, making
FcConfigBuildFonts() potentially crash.
Also, the FcConfigBuildFonts() return value was not checked.
|
|
|
|
| |
Signed-off-by: wm4 <wm4@nowhere>
|
|
|
|
|
| |
This creates a sorted list of fallback fonts and reuses it, for speed.
Font sorting is very slow.
|
|
|
|
|
| |
Add callbacks to introduce more sane fallback handling and font
alias substitutions.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Up until now fontselect used the face index to identify which font to load
from a font collection. While this pretty convenient when using something
freetype based like fontconfig, it seems to be somewhat freetype specific.
CoreText uses the PostScript name as the unique identifier of a font. This
commit allows to use that instead of the index to decide which face to open
with FT_New_Face. To use the PostScript name the provider must return a -1
index and the PostScript name.
|
|
|
|
|
|
| |
Some fonts use localized family names, especially CJK fonts, which
often have English and Japanese or Chinese names. Handle these cases
just like full names.
|
|
|
|
|
|
| |
Add a width field to metadata. This is used for sorting fonts as
well. Fixes wrong matches with different width variants in the same
font family.
|
|
|
|
|
|
|
|
|
|
| |
fontconfig uses an unusual scale from 0-215 for the font weight. It
looks like it is somewhat derived from the typographic scale some font
families use, but is still rather nonstandard. Nowadays the TrueType
scale from 100-900 seems to be standard. CSS uses it, for example.
However, most importantly, VSFilter also uses the TrueType scale. So
let's use it in libass, too.
|
|
|
|
|
|
|
| |
Implement a simple font sorter (FontSelector) and an interface to deal
with multiple font sources (FontProvider). Unfinished business,
but works for the most part. Currently the only implemented FontProvider
uses fontconfig.
|
|
|
|
|
|
|
|
| |
Don't crash if running out of memory when allocating per-glyph data
during shaping. Also some fixes to initialization.
The caller of ass_fontconfig.c/match_fullname() actually handles a NULL
return value correctly.
|
| |
|
|
|
|
| |
This is just a start and gets most easy ones.
|
|
|
|
| |
Some broken fonts are dropped by Fontconfig during compacting.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Example for an old message:
[ass] fontconfig: Selected font is not the requested one: 'DejaVu Sans' != 'Wingdings'
it was hard to tell which was the selected and the requested font.
Also, it's not really clear what's the problem at all. Why would it
select a different font? Obviously, the issue is that it can't find
the font in the first place.
Now it prints:
[ass] fontconfig: cannot find glyph U+006C in font 'Wingdings', falling back to 'DejaVu Sans'
Or if the code parameter for select_font() is 0:
[ass] fontconfig: cannot find font 'Wingdings', falling back to 'DejaVu Sans'
I'm not sure if this message is really accurate in all cases. It's
possible that there are more reasons for failure. But all things
considered, this should be easier to understand.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fontconfig defaults set the "lang" value in patterns, and it then
prefers fonts which are listed as supporting this language. The
default value may not match actual script language, and even a setting
of "en" for English subtitle can cause problems. Remove the "lang"
setting from patterns used to find fonts.
A file had a normal and an oblique version of the same font attached,
with different character set coverage: the normal version lacked some
non-ascii characters that fontconfig includes in its list of
characters required for English support. As a result, the oblique
version was picked for what was supposed to be normal text.
|
|
|
|
|
|
| |
MPlayer is able to use this configuration with the -nofontconfig flag;
this fixes crashes in case no font is available. Fixes a crash at uninit
as well.
|
|
|
|
|
|
| |
In hope to make libass as useful as possible, relicense libass to ISC, a
simplified 2-clause BSD license. All contributors who provided
non-trivial changes have granted their permission for this.
|
|
|
|
|
| |
The useless "if (foo) free(foo)" idiom is all over the place, just
get rid of it finally...
|
|
|
|
|
| |
strcasecmp/strncasecmp needs strings.h according to POSIX, so add this
include where these occur.
|
|
|
|
|
| |
Let's loop over everything and not just the outline check. *sigh*
Fixes a crash reported by lachs0r on IRC.
|
|
|
|
|
|
|
|
| |
Only match outline fonts and take slant and weight into consideration.
This matches all font faces which have at least the slant/weight that is
requested. This fixes issue 23; however, corner cases can be constructed
in which wrong fonts will be matched, if multiple slant/weight variants
of the same font exist, but that is very unlikely in practice.
|
|
|
|
|
|
|
|
| |
Store the real font face id instead of using 0 all the time and use the
real font face id for font lookup as well. This makes font attachments
with multiple faces work correctly.
Thanks to ubitux and uau!
|
| |
|
|
|
|
|
|
|
| |
Additionally match fonts via the fullname (or name for humans) and
prefer these matches. Previously, libass matched against the family name
only and this name can be completely different from the fullname (which
is used by VSFilter!).
|
| |
|
| |
|
|
|
|
|
| |
Get rid of compatibility code and #ifdefs for very old fontconfig
versions. libass now requires at least version 2.4.2.
|
|
|
|
|
|
|
|
|
| |
Make sure that libass does not crash even if no default font is
provided. Additionally, fix crashes related to drawings in this and
possibly other unusual cases.
Document the default_path and default_family parameters of
ass_set_fonts.
|
|
|
|
|
| |
fontconfig_select() can return the path to the default font as fallback,
but the caller frees it later. Return a copy with strdup() instead.
|
| |
|
|
|
|
|
|
| |
Rename all typedefs from the convention foo_bar_t, which can possibly
conflict with POSIX types, to FooBar (and ASS_FooBar for public
API typedefs). Fix formatting and stray comments while at it.
|
|
|
|
|
| |
Remove useless _s suffix from struct names and remove struct name where
not needed (only the typedef'd struct is used). Clean up API headers.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Do not manually use FcConfigFilename; passing a NULL pointer to
FcConfigParseAndLoad is just as effective and also avoids a memory leak
since the string allocated by FcConfigFilename was never freed.
Free FcConfig instance in fontconfig_done; since we're not using the
default configuration anymore it doesn't make sense to keep the
configuration around.
Leaks were found by valgrind/memcheck.
|
|
|
|
|
| |
Adjust fontconfig_select and fontconfig_update stubs for the recent
changes.
|
|
|
|
|
|
|
|
| |
If parsing or loading the fontconfig configuration file, either
using the default or a specified one, fails, try to load the
default fontconfig configuration. This triggers loading a fallback
configuration if no configuration file is available at all. A warning
message is emitted to notify the user about this.
|
|
|
|
|
|
|
| |
Add an argument to ass_set_fonts for controlling whether the fontconfig
font cache should be built/updated. Add a new function ass_fonts_update
to make it possible to update fonts later on.
Additionally, stop using FcConfigSetDefault for thread safety.
|
|
|
|
|
|
|
|
|
|
|
| |
Introduce functionality for providing a message callback that is used
for passing messages to the controlling application instead of simply
printing them to standard output. The function pointer to the callback
is stored in the ass_library_t instance. ass_msg needs access to it, so
in many places the library instance needs to be passed around now.
The default behavior is the old one: messages of MSGL_INFO or lower
are printed to the standard output, prefixed with "[ass]".
|
|
|
|
|
|
| |
Instead of referencing string defines from help_mp.h, use the strings
directly in ass_msg. Consequently, help_mp.h is useless and can
be deleted.
|
| |
|
|
|
|
|
| |
Rename a few functions to avoid symbol clashes.
Clean up mputils.h.
|
| |
|
|
|
|
|
|
|
| |
Optionally pass a fontconfig config file to the fontconfig
initialisation.
This changes the public API.
|
|
|
|
|
| |
Silence a few warnings that should be harmless and were introduced by
the -Wall option.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reindent complete source code (*.c, *.h) with indent, the exact command
line being:
indent -kr -i4 -bap -nut -l76 *.c *.h
From now on, new code should use (more or less) K&R style,
only spaces and no tabs, 4 spaces indent width. Avoid long lines.
Fix function declaration pointer spacing.
Remove spaces that were added to many function declarations by indent,
like some_func(foo_t * bar).
Fix indenting of macros in ass.c
|
|
|
|
| |
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29305 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
| |
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28977 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
|
|
|
| |
This fixes hangups with plaintext subtitles happening when
the first subtitle is about to be displayed.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28976 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
| |
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28896 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
|
|
| |
Patch by Adrian Stutz (adrian sttz ch).
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28895 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
| |
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27876 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
|
|
|
| |
Also fixes a memleak in that case, bug #1313.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27875 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
|
|
|
| |
Switch them from a HAVE_ to a CONFIG_ prefix.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27425 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
| |
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27128 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
| |
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27127 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
|
|
|
|
| |
This can be the case if ass_set_fonts_dir() call is omitted, results in
segfault. Never happens in the current MPlayer.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27126 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
| |
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26857 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
| |
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26856 b3059339-0415-0410-9bf9-f77b7e298cf2
|
|
|
|
|
|
|
|
| |
It lacks FcPatternRemove function. The code will work fine, but produce an
incorrect "Selected font is not the requested one" warning in rare cases.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26851 b3059339-0415-0410-9bf9-f77b7e298cf2
|