wm4 [Thu, 6 Mar 2014 21:23:01 +0000 (22:23 +0100)]
Fix change detection in presence of vector clips
Fixes this test case:
Dialogue: 0,0:00:00.00,0:00:02.00,,,0,0,0,,{\fs50\pos(250,250)\iclip(m 0 0 l 400 0 l 400 220 l0 220)}Hello
Dialogue: 0,0:00:02.00,0:10:00.00,,,0,0,0,,{\fs50\pos(250,250)\iclip(m 0 0 l 400 0 l 400 230 l0 230)}Hello
The problem here is that the rendered output bitmap list itself does
not change, only its contents (due to the different vector clip).
ass_render_frame() will not set *detect_change correctly, and an
application using this flag (like mplayer or mpv) will not update
the screen as needed.
Fix this with a very cheap hack: always report a full change if
there's a vector clip. This is basically an emergency fix until
we have a proper way to detect the change.
wm4 [Mon, 3 Mar 2014 14:52:54 +0000 (15:52 +0100)]
Don't crash on \fscx0
Freetype can return a bounding box with all fields set to INT_MIN if an
outline with all points set to 0 is used. This can happen e.g. with
\fscx0, but also in more complicated cases. (In the original crashing
sample, this was probably caused in combination with an embedded font.)
Such a bounding box causes libass to crash, because it will enlarge the
combined bitmap bounding box to a ridiculous size.
Just skip outlines that have en empty bounding box. This is probably
the correct thing to do, and won't pass INT_MAX down to other parts
of libass.
Grigori Goronzy [Wed, 29 Jan 2014 04:23:55 +0000 (05:23 +0100)]
shaper: use global features correctly
start/end of feature tags is unsigned, so use the proper constant
to signal to HarfBuzz that these features are global. This allows
HarfBuzz to cache shape plans, and that can considerably speed up
shaping, especially if many small runs need to be shaped.
Grigori Goronzy [Sun, 26 Jan 2014 02:30:45 +0000 (03:30 +0100)]
shaper: rewrite and simplify harfbuzz shaping
Rewrite the core of the harfbuzz shaping function. Gets rid of the
MAX_RUNS limit of runs per line and reuses a single hb_buffer_t,
which should be more efficient.
wm4 [Mon, 20 Jan 2014 23:32:28 +0000 (00:32 +0100)]
Remove some ass_msg() calls
These aren't very useful for debugging due to the high volume of the log
output in problem cases. In fact, all they do is making the code slower
(the message callback can easily appear in the profiler output, even if
the callback doesn't actually print the messages).
Oleg Oshmyan [Tue, 7 Jan 2014 21:41:43 +0000 (23:41 +0200)]
Don't try to remove end-of-line \fsp
VSFilter does not do this.
The code being removed was already buggy: i > 0 should
have been "got any non-skipped glyphs since last_break?",
and hspacing should have been taken from glyphs[i-1].
Oleg Oshmyan [Tue, 7 Jan 2014 13:32:05 +0000 (15:32 +0200)]
Fix \pbo
b61d260b attempted to add support for \p scaling to \pbo.
However, while it fixed the exact sample originally reported,
it broke \pbo with other \p values, including \p1, by confusing
the direction of scaling and the units in which \pbo is measured.
In addition, the descenders assigned to drawings have always
had a wrong sign, causing lines that contain drawings with \pbo
to be shifted in the wrong direction: negative \pbo raised bottom-
aligned lines, while positive \pbo lowered top-aligned lines.
All errors and fixes have been confirmed with VSFilter.
Thomas Goyne [Wed, 11 Dec 2013 00:21:53 +0000 (16:21 -0800)]
Fix compilation with VC++ 2013
For whatever reason FT_Vector points[4] = { ... }; needs to come at the
beginning of a scope. Since that block was duplicated, just extract it
to a function.
This does not include buildsystem support, so actually compiling with
VC++ requires creating a project and supplying a config.h file.
wm4 [Mon, 7 Oct 2013 11:59:08 +0000 (13:59 +0200)]
Don't rely on events being sorted in ass_step_sub()
ass_step_sub() assumed that the subtitle event list was sorted by event
start time, but that is not guaranteed. Making the list sorted is not
an option. (At least for now - too many issues are in the way to get
such a change being done.) Fix this function so that it works with an
unsorted event list.
Semantics regarding corner cases might be slightly different, such as
what happens if the now parameter coincides with event start/end, or
behavior with overlapping subtitles.
Commit 05eb520 missed some duplicated bits in ass_shaper.c.
<wm4> oh crap
<zgreg> oh crap indeed
Instead of duplicating the logic in ass_shaper.c, just change the
glyphs before they even get into processing. This way, all code
reading the font size etc. is affected. This essentially reverts
commit c207000c, because it's not needed anymore.
This was broken since commit f780146. For reasons why, read the commit
message of that commit. To make it short, we set the font size to
something large and constant (256), and scale the font outlines returned
by freetype to the size we need in order to get smooth animation and
accurate positioning.
Of course, this obviously breaks hinting. Fix hinting by not using the
hack mentioned above if hinting enabled.
To mitigate the issues caused by freetype grid fitting and extremely
bad ASS scripts (such as setting font size to very small values and
scaling them up with \fscx/y), we still adjust the font size such that
the font is never scaled in Y direction (only in X direction, because
the \fscx/y tags can change aspect ratio).