| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Add stride support to the basic bitmap type used for low-level
rasterization.
|
|
|
|
|
|
|
| |
This finally gets rid of the nasty hack that manipulated a glyph
we somehow got from FreeType. Simplifies drawing handling a bit and
decouples drawing code from all font handling and related (fontconfig,
etc.) code.
|
|
|
|
|
|
|
|
|
| |
This introduces functions to use and copy pointered outline objects
easily and uses these instead of glyphs everywhere.
Previously the glyph cache was abused for caching vector clipping masks,
but this isn't possible anymore (nor desirable), thus vector clipping
cache has been disabled for the moment.
|
|
|
|
|
| |
This covers rasterization, filtering and blending for one
render item.
|
| |
|
|
|
|
|
|
|
| |
Only try to remove any further whitespace in front of a line if the
first character of the line (the break character) is whitespace.
Addresses Issue 35.
|
|
|
|
|
|
|
|
| |
- less code, cleaner
- decoupled from ASS_Library
- better data encapsulation
- simpler interface
- avoids a nasty hack
|
| |
|
| |
|
|
|
|
|
| |
Track if we already parsed a fade or a alignment tag and ignore all
further tags.
|
|
|
|
|
| |
Yet another VSFilter idiosyncracy: when the glyph fill is invisible
(alpha 0xFF) and there is no border, do not render any shadow.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
wrap_lines_smart() got stuck if there was a long line without spaces
followed by a hard linebreak. When the loop got to the '\n' character
the hard linebreak was not handled because the line was already over
wrap length and soft linebreak handling had precedence. Then at the
end of the loop body the code noted that the hard linebreak hadn't yet
been handled, and the same glyph needed to be reprocessed for that.
However, the soft linebreak code hadn't actually done anything because
there was no space to break at, and thus the loop repeated from the
exact same state forever.
Handle this by removing the check for an additional hard linebreak
after a soft linebreak, which stepped back by one char. This is a
very marginal case and shouldn't really matter in practice.
Original patch and parts of this message by uau.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
It looks like VSFilter only ever wraps on spaces, even if the line
length is going to overflow. We should do that as well.
Fixes a pretty confusing problem with scrolling vertical text.
|
|
|
|
|
| |
The useless "if (foo) free(foo)" idiom is all over the place, just
get rid of it finally...
|
|
|
|
|
|
| |
Delay allocation of the "faux" glyph until a drawing is parsed.
This helps with fixing a (pretty bad) memory leak and also reduces frame
overhead a little.
|
|
|
|
|
|
| |
Similar to regular glyphs, check the bounding box of the clip mask and
refrain from rendering humongous masks, which can take up considerably
memory.
|
| |
|
| |
|
| |
|
|
|
|
| |
Gets rid of another forward declaration.
|
|
|
|
|
| |
Cosmetical simplifications, fix whitespace where useful, remove
deprecated comments.
|
| |
|
| |
|
|
|
|
| |
These are included by ass_render.h already.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Now that bitmap glyphs (for vector clip masks) are stored in the glyph
cache, make sure it cannot grow indefinitely easily. Similar to the
bitmap cache, track approximate size of the cached elements and reset
if the cache exceeds a certain limit.
Also, reduce default bitmap cache size to 30 MB as we have essentially
two bitmap caches now. That's still plenty in all use cases where
caching matters.
|
| |
|
|
|
|
|
| |
Cache pre-rasterized vector clip masks, big speedup if vector clipping
is used extensively.
|
|
|
|
| |
Gets rid of a few forward declarations.
|
|
|
|
|
|
|
|
|
|
| |
PAR correction so far merely applied a horizontal scaling factor to
glyphs right after loading. This screws up transformed text,
unfortunately.
It's a much better approach to typeset text without correction and scale
everything at the very end. In MPlayer, an EOSD rendering now looks
exactly the same as a video filter rendering (except for more sharpness
in the EOSD case).
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
Do not copy glyphs when it isn't really needed.
Profiling with valgrind's callgrind showed that FT_Glyph_Copy takes a
big fraction of the rendering time (~40%) for "simple styled softsubs"
cases. It turned out that glyphs are duplicated much more often than
is necessary. Reducing the number of copies cuts down the rendering
time for the "simple styled softsubs" case by about 70%!
|
|
|
|
|
|
|
|
| |
Reverse "outside" contours with wrong winding correction, require
that a contour is "inside" for considering its removal; Move this
hack into ass_font.c, where it belongs.
Initial patch by uau.
|
|
|
|
|
| |
The last point wasn't included in cbox calculation, sometimes triggering
removal of inside contours when it wasn't needed.
|
|
|
|
| |
It isn't needlessly run every frame this way. Also it's cleaner.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
If a character is completely collapsed in x or y direction (\fscx0,
\fscy0), the rasterizer will not generate any visible pixels. This also
means vsfilter will never draw any border in this case, since it works
on the pixel data. FreeType's stroker OTOH happily draws a border around
a character, no matter how collapsed it is. Emulate vsfilter's behavior
by skipping border generation if the glyph is collapsed.
|
| |
|
|
|
|
|
| |
Use the fixed-point conversion functions instead of (slightly incorrect)
manual conversion.
|
|
|
|
|
|
| |
In some cases 16.16 precision is not good enough. Instead use 10.22 and
use modulo 360.0 on the angles to make overflows impossible and improve
cache hit ratio sometimes.
|
|
|
|
|
|
|
| |
Make sure that the clip mode is reset to regular on new events.
Otherwise events after an event that used inverse clip will also use
inverse clip. Ouch! Usually the symptom is that subtitles become
invisible as the whole screen is clipped.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Move the function apply_transition_effects, which parses event-global
effects and adjusts a few state variables, into ass_parse.c.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|