| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
Picked up from XBMC svn. This should especially fix MPlayer's direct3d
video output (untested).
|
| |
|
|
|
|
|
| |
Move the function apply_transition_effects, which parses event-global
effects and adjusts a few state variables, into ass_parse.c.
|
|
|
|
|
| |
It's not necessary to create the shadow bitmap by adding the glyph
bitmap to the outline bitmap; the outline is a superset of the glyph.
|
|
|
|
|
|
| |
Many fonts don't have a non-breaking space (NBSP) character and this
can cause problems when these glyphs are substituted. Render them
like a regular space.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Kerning causes problems with many (broken) fonts. VSFilter doesn't use
kerning so these problems won't be apparant, while libass uses kerning
by default.
For compatibility reasons, disable kerning by default. In addition,
make it configurable through style overrides and the Script Info
header.
I.e. put "Kerning: yes" into the Script Info header to enable kerning.
With MPlayer, using "-ass-force-style Kerning=yes" will always
enable kerning.
This also includes a minor ABI change for tracking the kerning boolean.
As this only affects code that creates or modifies ASS_Tracks manually,
and I'm not aware of anyone doing that, the SONAME will not be bumped.
|
| |
|
|
|
|
|
| |
Move all code related to parsing event lines and processing override
tags into a separate file (ass_parse.c).
|
| |
|
|
|
|
| |
Treat the illegal \a value 8 like 5 for compatibility with VSFilter.
|
|
|
|
|
| |
Similar to VSFilter, do not subtract the glyph bitmap from the border
bitmap when BorderStyle 3 is used.
|
|
|
|
|
|
| |
This reverts commit d3cd5b0148d64ae0f6e288e69b09acfe639fdcce.
This hack improved blending in few situations, but at the same time
broke it in lots o others; get rid of it.
|
|
|
|
|
|
| |
If a glyph is wider than its advance width for italic to non-italic
style changes, assume it was obliqued by FreeType's FT_GlyphSlot_Oblique
function and offset the next glyph accordingly.
|
|
|
|
|
|
|
|
| |
If there are no points (i.e. illegal drawing), do not close the drawing
by incrementing the contour counter. Under certain circumstances, this
can crash the FreeType stroker.
This fixes issue 7.
|
| |
|
|
|
|
|
|
|
|
|
| |
Another try to get it to work like in VSFilter. Hopefully it's
behaving the same now (except in some cases, since VSFilter layouts
word-based, but libass is glyph-based).
Additionally, make sure horizontal letter spacing (\fsp) is scaled
according to ScaleX.
|
|
|
|
|
|
|
|
|
|
| |
Use the bitmap pointer for the cache hash key. This preserves the
blending history, which fixes occasional corruptions due to previous
replacements not being dealt with correctly. It also simplifies the
hash key a lot and thus speeds up cache lookups.
Additionally, change the blending equation from max(a, b) to min(a + b,
0xff), i.e. a saturating addition. Usually this looks a lot better.
|
| |
|
|
|
|
|
| |
Mark leading and trailing spaces on lines and adjust layouting code
to respect these marks and skip the spaces.
|
|
|
|
|
|
| |
Do not copy the padding on the last row into the new buffer since we
cannot rely on the padding actually existing; might fix a segfault in
some obscure cases.
|
|
|
|
|
|
|
|
| |
Make horizontal shearing (\fax) shear from top to bottom of a glyph;
scale shearing factors with horizontal and vertical scaling factors.
This makes the shearing operations similar to VSFilter, except for
\fay in some cases, but this is not unexpected. Vertical shearing
is implemented different on purpose.
|
|
|
|
|
|
|
| |
VSFilter double-scales the widths of the opaque box in X direction,
which gives much wider boxes than expected (or much less wider boxes)
if ScaleX != 100. Emulate this behavior, even if it is unbelievably
stupid and no doubt a bug in VSFilter.
|
|
|
|
|
|
| |
Exit early if no striking is needed; make sure to strike in reverse
direction for non-truetype font and use the usual return value
convention (0 == no errors).
|
| |
|
|
|
|
|
| |
Check whether the glyph bitmap used for cache size calculations really
exists.
|
|
|
|
|
| |
Skip application of the algorithm that moves words between the lines
to equalize line length for wrap style 1.
|
| |
|
|
|
|
|
|
| |
Consider the bounding box of an event for collision detection instead
of only its vertical position and height. This allows multiple events
per line if they don't overlap.
|
| |
|
| |
|
|
|
|
| |
This follows VSFilter's behavior.
|
|
|
|
|
| |
Add new fields to the cache hash key for BorderStyle 3 (glyph cache
and bitmap cache).
|
|
|
|
|
|
| |
According to the ASS specification, colors can only be specified in hex.
Modify the color parsing accordingly; this especially means that colors
where the hex sigil (the "H") is missing can now be parsed.
|
|
|
|
|
|
|
| |
Fallback to embolden manually with FreeType in case a bold face was
requested, but no bold variant is available. The glyphs are slightly
emboldened (much less than FT_GlyphSlot_Embolden would do) and the
metrics are not touched at all.
|
|
|
|
|
|
| |
Scan backwards in the glyph array for a glyph with some actual points
when correctin glyph spacing after italic to non-italic style changes.
This is mostly useful in case a space ends italicized text.
|
|
|
|
|
|
| |
Parse \q override tag and set a new state variable to its value.
The line wrapping code still needs improvements; wrap style 0/3 are not
entirely correctly implemented and style 1 is not implemented.
|
|
|
|
|
|
|
| |
The "opaque box" border style renders an opaque box in the glyph area
instead of rendering a regular stroked border. This implementation
replaces the glyph outline by an outline that contains only one
rectangle with the size of the glyph, plus optional extra border.
|
|
|
|
|
|
|
|
|
| |
After a italic to non-italic style change the space between the glyphs
is sometimes wrongly calculated, especially if the font doesn't have
an italic version and FreeType falls back to oblique glyphs.
In such cases, add additional space to the glyph's advance to make up
for the slant of the glyph; the amount is calculated from the glyph's
bbox.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Convert type for consistency with other booleans/flags that also use
int.
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
| |
Use the correct terms (SAR/DAR) for the aspect ratio parameters.
|
|
|
|
|
| |
Allocate the maximum possible number of used events in fix_collisions
dynamically, eliminating the MAX_EVENTS limit.
|
|
|
|
|
|
| |
Do not round the coordinates of the glyph bbox (when converting 26.6
fixed-point to integer); they are used for timing karaoke. Doing so
can sometimes make \k and \ko karaoke not apply correctly.
|
|
|
|
|
|
| |
For the event/style/track types, bring back the struct name, but
without the _s suffix. This is useful for forward declaration of
these types.
|
|
|
|
|
|
| |
The timing calculations for \k and \ko were off and still assumed
int values for a bbox, while it now uses a d6 representation.
This essentially made duration about 64 times as long as it should be.
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
Instead of passing a pointer to a va_list, pass the va_list itself.
Additionally, use const char for the format string and use names in
the prototype that describe the arguments' meaning.
|
|
|
|
|
|
|
| |
The shift is not calculated when fetching a glyph anymore. Instead,
it is calculated right before rasterizing a glyph. Remove the
shift vector and make get_outline_glyph, the glyph cache and
ass_font_set_transform work without supplying a shift vector.
|
|
|
|
|
| |
In case only one PlayResX/Y component is specified, calculate the other
component by assuming a 4:3 aspect ratio. This is similar to vsfilter.
|
|
|
|
|
| |
If rasterizing the clip vector fails, actually handle the situation
instead of crashing.
|
|
|
|
| |
Add a note to the docs regarding hinting method choice.
|
|
|
|
|
|
|
|
|
|
| |
Use the correct free order when freeing a ass_renderer and make sure
that the latest list of ass_images is freed, too.
Protect the font family string against double free and make sure it
is freed in free_render_context.
Leaks and access problems were found by valgrind/memcheck.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
When freeing a track, also free the track name and the track itself.
Leak found by valgrind/memcheck.
|
|
|
|
|
| |
Adjust fontconfig_select and fontconfig_update stubs for the recent
changes.
|
|
|
|
|
| |
The render_id (last_render_id) variable was the last remaining static
data object; move it into render_priv.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
In case rasterizing a glyph is successful, but rasterizing its outline
is not, do not free the glyph bitmap. It will be freed in cache cleanup
later. Freeing it earlier leads to a double free.
|
|
|
|
|
|
| |
Interpret the value -1 as "true", as specified in the ASS
specifications. Otherwise, clamp the value to 0 for other values <
0, so these are interpreted as "false".
|
|
|
|
| |
Reported by Martin Sourada.
|
|
|
|
|
|
|
| |
For clarity, factor out bitmap copying into a function. Do not pad the
bitmap with stride in the last row; this can not by guaranteed anyway.
Add a comment about this peculiarity to the API documentation in ass.h
Idea by Evgeniy Stepanov.
|
|
|
|
|
| |
Make sure the clip rectangle is inside the screen boundaries.
Idea by Evgeniy Stepanov.
|
|
|
|
|
|
| |
Do not set the end time of the animation to the end time of the event
in case end time and start time specified in a \t tag are equal.
This should sort out a problem introduced by commit 1f176b.
|
|
|
|
|
|
|
|
| |
The glyph striker (underline/strike-through) did not check for table
availability, possibly accessing a NULL pointer. Change this to
only strike the glyph if the table with the appropriate information
is available. Currently there is no fallback for fonts without the
required information.
|
|
|
|
|
|
| |
If possible, use ascender/descender from the OS/2 TTF table. This is
another try to get libass to match VSFilter in regard to vertical font
metrics.
|
| |
|
|
|
|
|
| |
Always free the drawing glyph in ass_drawing_free; do not double free
clip vector bitmap.
|
|
|
|
|
|
|
|
|
|
|
| |
libass' cache was basically unmanaged; it would grow without any limits,
depending on how complex the subtitles are. Introduce a simple limiting
that resets the cache if certain limits are exceeded. The bitmap cache
is limited to approx. 50 MB size by default, while the glyph cache
allows storing up to 1000 glyphs by default. A few tests with rather
heavily softsubbed fansubs show that these limits are fine.
The API was extended with the function ass_set_cache_limits which allows
modification of these limits.
|
|
|
|
|
|
|
| |
Match VSFilter behavior when centering non-positioned events
vertically. Previously, libass put the event on top of the vertical
center while VSFilter centered the event evenly. Adjust the centering
to behave like VSFilter.
|