| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
| |
Purpose of this commit is to simplify logic behind drawing handling.
|
|
|
|
|
| |
Drawings always have advance.y = 0 and
FreeType guarantees that for horizontal writing.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
FT_Vector and FT_BBox types are based on FT_Pos, which is alias of long.
FreeType treats it as 32-bit integer, but on some platforms long can be
64-bit. That leads to wasted memory and suboptimal performance.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
This way, #include "config.h" is consistently the very
first thing the compiler sees when compiling any file.
Some source files currently don't use anything defined in config.h,
but it's easier and less error-prone to include it now to anticipate
possible future changes in those files, config.h or other headers.
|
|
|
|
| |
Fixes CID 146124.
|
|
|
|
|
|
|
|
|
|
|
| |
If there's an odd number of values, ignore the extra value, instead
of shifting all values after the next command. While such drawings are
boken strictly speaking, VSFilter handles them gracefully, and what
libass did before this commit made no sense anyway.
Test case:
{\an7\pos(0.01,0.7)\c&H5A493D&\p1\iclip(11,m 857379 -744112 l 517759 -744112 517759 -942768 857379 -942768 m 851235 -422238 l 689105 -422238 689105 -620546 851235 -620546 m 679889 -421552 l 517411 -421552 517411 -620894 679889 -620894 -55984 m 860113 425634 l 519459 425634 519459 226640 860113 226640 m 868305 992080 l 465361 992080 465361 793936 868305 793936 m 841343 1317200 l 520145 1317200 520145 1118206 841343 1118206 m 411662 -245762 b 411662 -242373 408918 -239618 405518 -239618 l 342931 -239618 b 339532 -239618 336787 -242373 336787 -245762 l 336787 -308226 b 336787 -311626 339532 -314370 342931 -314370 l 405518 -314370 b 408918 -314370 411662 -311626 411662 -308226 m 414929 -907440 b 414929 -904051 412174 -901296 408785 -901296 l 346198 -901296 b 342798 -901296 340054 -904051 340054 -907440 l 340054 -969904 b 340054 -973294 342798 -976048 346198 -976048 l 408785 -976048 b 412174 -976048 414929 -973294 414929 -969904 m 414417 -585904 b 414417 -582515 411652 -579760 408252 -579760 l 345450 -579760 b 342041 -579760 339286 -582515 339286 -585904 l 339286 -648368 b 339286 -651758 342041 -654512 345450 -654512 l 408252 -654512 b 411652 -654512 414417 -651758 414417 -648368 m 414929 -44997 b 414929 -41597 412174 -38832 408785 -38832 l 346198 -38832 b 342798 -38832 340054 -41597 340054 -44997 l 340054 -107676 b 340054 -111075 342798 -113840 346198 -113840 l 408785 -113840 b 412174 -113840 414929 -111075 414929 -107676 m 415932 261456 b 415932 264845 413178 267600 409788 267600 l 347191 267600 b 343802 267600 341047 264845 341047 261456 l 341047 198992 b 341047 195602 343802 192848 347191 192848 l 409788 192848 b 413178 192848 415932 195602 415932 198992 m 414929 564048 b 414929 567437 412174 570192 408785 570192 l 346198 570192 b 342798 570192 340054 567437 340054 564048 l 340054 501584 b 340054 498194 342798 495440 346198 495440 l 408785 495440 b 412174 495440 414929 498194 414929 501584 m 414929 781136 b 414929 784525 412174 787280 408785 787280 l 346198 787280 b 342798 787280 340054 784525 340054 781136 l 340054 718672 b 340054 715282 342798 712528 346198 712528 l 408785 712528 b 412174 712528 414929 715282 414929 718672 m 414929 1133525 b 414929 1136914 412174 1139669 408785 1139669 l 346198 1139669 b 342798 1139669 340054 1136914 340054 1133525 l 340054 1071061 b 340054 1067661 342798 1064917 346198 1064917 l 408785 1064917 b 412174 1064917 414929 1067661 414929 1071061)}m 0 0 l 1280 0 1280 720 0 720 0 0{\p0}
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Use strndup() instead of malloc+copy.
Make all code deal with the possibility that ASS_Drawing.text can be
NULL (which can happen on allocation failure).
Skip fix_collisions() on malloc failure - the lines will overlap, but at
least libass won't crash.
|
|
|
|
| |
This is just a start and gets most easy ones.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
Parse values as float and convert into 26.6 fixed point. This actually
simplifies scaling a bit.
Fixes #63.
|
|
|
|
| |
These were missing in several places. Fixes #50.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Fixes issue #68.
|
| |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
Use extremes of all points fed to the parser, instead of only points
that are added to the outline.
Fixes a rendering problem reported on IRC and should fix Issue #7.
|
|
|
|
|
| |
The glyph is inserted into the cache and freed upon cache reset,
so it shouldn't be freed alongside the drawing.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Always free the drawing glyph in ass_drawing_free; do not double free
clip vector bitmap.
|
|
|
|
|
|
|
|
|
| |
Make it possible to use drawings for clipping with \clip and \iclip.
parse_tag was extended to parse drawings in \clip or \iclip tags in case
parsing them as rectangular clips fails. These clip drawings are later
rasterized and used for blending bitmaps, just after bitmaps are
assembled into a list in render_text. Currently, the cache is not
utilized for storing the parsed drawings or blended bitmaps.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add support for the underline (\u) and strikethrough/strikeout (\s)
properties. This is a bit tricky, since FreeType doesn't offer
any method of adding the lines, so you have to draw them yourself.
libass uses various information from TrueType tables to get position
and size of the lines, does a few simple consistency checks (some fonts
might be broken) and if everything is alright, adds new contours for
the lines.
Sometimes, rendering errors can occur:
- Currently, kerning isn't taken into account, which means the lines
can overlap a little, leading to small optical glitches.
- Some (broken) fonts use the wrong winding direction. In this case,
the FreeType stroker will only consider the added lines to be "outside"
and only stroke the line instead of the whole glyph.
|
|
Finally implement the drawing mode, which allows drawing of custom
vector graphics. Drawings are intercepted in ass_render_event; a hash
of the drawing string is generated which is then used for looking
up drawings and bitmaps of drawings in the cache. The drawings
itself are "fake" glyphs. They are created by parsing the simple
drawing description language, evaluating the curves described (lines,
cubic beziers and/or a special kind of b-splines) and creating vector
outlines. Afterwards, these drawings are (with a few exceptions, e.g.
ascender/descender) exactly handled like regular glyphs.
Support for vector clippings is still missing, but otherwise the
implementation should be complete and compatible with VSFilter.
The libass integration of the drawing parsing/processing code is still a
bit sketchy and should be refactored.
History:
WIP: Drawing mode infrastructure
WIP: Drawing tokenizer
WIP: Parse drawing tokens, call evaluators
WIP: Bezier/b-spline evaluator
WIP: Final pieces for the drawing mode
WIP: Heavy modifications to the drawing parser/tokenizer
WIP: Dynamic outline memory allocation
WIP: Drawing position fixes
WIP: more drawing position fixup (similar to VSFilter now)
WIP: Lots of cleanup and fixes for drawings.
WIP: Drawing mode integration into ass_render_event
|