summaryrefslogtreecommitdiffstats
path: root/libass/ass_parse.c
Commit message (Collapse)AuthorAgeFilesLines
* Refine list of tags that prevent selective style overrideswm42015-03-061-4/+7
| | | | | | | Somewhat stolen from: https://github.com/Cyberbeing/xy-VSFilter/blob/xy_sub_filter_rc3/src/subtitles/RTS.cpp#L2004 (xy-VSFilter started work on this in commit 014da6d9766417d7886eb867c9f2c14038f2a226)
* More malloc checkingwm42014-11-171-3/+1
| | | | | | | | | | 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.
* Fix \fade(7-argument version) parseMaks Naumov2014-08-231-2/+2
|
* ass_parse: remove 2 unused variableswm42014-06-091-2/+0
| | | | Fallout from the previous commits.
* Simplify drawing text assignmentOleg Oshmyan2014-06-061-1/+1
|
* parse_tag: remove unnecessary mallocOleg Oshmyan2014-06-061-8/+2
|
* Require closing '}' for override tagsOleg Oshmyan2014-06-061-12/+9
| | | | | | | | Like VSFilter. '{' without a following '}' is just text, though in vector drawing mode it still delimits individual drawings. This also lets us nicely avoid '\0' hacks in the \t override tag handler in parse_tag.
* Introduce ass_drawing_add_chars for adding a whole string at onceOleg Oshmyan2014-06-061-4/+3
|
* Parse override tag arguments exactly like VSFilter 2.38Oleg Oshmyan2014-06-061-236/+308
| | | | | Also replace strtocolor in ass_utils with string2color from ass.c, because that is more useful everywhere now.
* parse_tag: merge \fs+, \fs-, \fsOleg Oshmyan2014-06-061-18/+7
|
* parse_tag: split \fscx, \fscy, \fscOleg Oshmyan2014-06-061-23/+20
|
* Add a mechanism for selective style overrideswm42014-06-051-0/+26
| | | | | | | | | | | | | | | This adds 2 new API functions: ass_set_selective_style_override() ass_set_selective_style_override_enabled() They can be used to force dialog text to use a specific ASS_Style. It uses a fuzzy heuristic for that, and the quality of results may vary. It does style overriding selectively and tries not to override things that need explicit styling. The heuristic for that isn't set in stone either, and can change with future libass versions. Closes libass#88.
* Fix \1a, \2a, \3a, \4a with invalid argumentOleg Oshmyan2014-05-121-0/+2
| | | | Reset to the initial color's alpha component, not red.
* Reset clipping mode on every rectangle \clipOleg Oshmyan2014-05-121-0/+1
| | | | | | | | Prior to this fix, both of the following: \iclip(0,0,9999,9999)\clip(0,0,9999,9999) \iclip(0,0,0,0)\clip(0,0,9999,9999) hid the whole picture in libass. The correct behavior in both cases is to display the whole picture.
* Make \be animatableOleg Oshmyan2014-05-121-2/+5
| | | | | | | VSFilter has supported this since version 2.39. Use the raw floating-point value of the \be argument in the animation formula, like xy-VSFilter has done since version 3.0.0.45 (404301a3).
* Fix corner case: \move with identical start and end timesOleg Oshmyan2014-05-121-2/+2
|
* Parser: don't increment render_priv->state.bm_run_id (unnecessary)11rcombs2014-01-251-14/+0
|
* Combine bitmaps before applying blur and shadow11rcombs2014-01-251-0/+1
|
* Start \k, \ko at exact start time, not right after itOleg Oshmyan2014-01-241-1/+1
|
* Remove some ass_msg() callswm42014-01-241-12/+0
| | | | | | | 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).
* Fix \fade corner casesOleg Oshmyan2014-01-151-9/+14
| | | | | | | | Times in \fade(,,,-1,fadein,fadeout,-1) are interpreted as in \fad(fadein,fadeout). Make sure we check the times in the same order as VSFilter in case they are not sorted.
* Fix \t corner casesOleg Oshmyan2014-01-151-20/+17
| | | | | The end time is reset to line duration if and only if it is zero. Negative accelerations are allowed (and can cause overflow later).
* Do not reset \pbo and \p values after each drawingOleg Oshmyan2014-01-081-4/+3
| | | | Confirmed with VSFilter. This complements the previous commit.
* A whole bunch of parsing and default value fixesOleg Oshmyan2014-01-071-116/+111
| | | | Obtained by reading the xy-VSFilter source code.
* Fix \fs+ and \fs-Oleg Oshmyan2014-01-071-2/+2
| | | | The argument is a relative amount. The unit is: \fs+1 = +10%.
* Stop animating \b and \iOleg Oshmyan2014-01-071-12/+8
| | | | Unlike what the cc635086 message says, VSFilter does not animate them.
* Stop misparsing and add support for \fscOleg Oshmyan2014-01-071-0/+4
|
* Support fractional \org argumentsOleg Oshmyan2014-01-071-4/+4
|
* Fix \r style lookupOleg Oshmyan2013-06-221-1/+1
| | | | | Make \rSTYLENAME with an invalid STYLENAME fall back to line style rather than to Default. This fixes issue #104.
* Clip tag arguments are not optionalwm42013-04-121-2/+2
| | | | | | | | | | | | | | | This fixes: {\clip(1,1,20,20)\clip\alpha&H1E&\c&HC7E5C0&}X libass tries to interpret the second \clip, which has no arguments. Since the parsing code doesn't require a starting '(', the parser will skip over the other tags (treating them as junk) and interpret the numbers that happen to be in the rest of the string. The result is a bogus drawing command, which happens to rasterize an extremely wide glyph, which takes several seconds to finish. Make the '(' required. Neither the aegisub manual nor the vsfilter source code have any indication that \clip without starting '(' is allowed, so this should not break anything.
* Ignore junk in nested \t tagswm42013-03-311-3/+2
| | | | | | | | | | | | | | | | Normally, junk between tags is ignored. But unlike vsfilter, libass doesn't do that inside \t tags. So the following fails and will never actually switch the color: {\t(1000,1000,(\c&HFF0000&))} (The '(' and ')' are junk, and are not covered by any ASS documentation.) Instead expecting that the last parameter to \t (the parameter that takes nested tags) starts with '\', turn it around and assume that the first parameter that's not a number is the last parameter. (This parsing is kind of awkward because we don't do any lookahead.) Likewise, let the nested tag parsing terminate on ')' instead of checking whether a tag is started with '\'. This allows skipping junk in the middle of the nested tag, without terminating too early. (Check '}' and '\0' in case the tag is not properly terminated.)
* Fix crazy VSFilter behavior for \move tagwm42013-03-201-1/+9
| | | | Fixes issue 90 (both cases).
* Make closing ')' optional for some ASS tagswm42013-01-121-5/+5
| | | | | | | | | It appears VSFilter generally accepts the tag anyway if closing ')' are missing in tags like \pos(1,2). Since they're not strictly needed anyway, make the last ')' optional in order to make parsing more tolerant against broken subs. Fixes issue #79.
* Fix a wrong condition.Xidorn Quan2012-12-141-1/+1
|
* Terminate drawings immediately on a \p0 tagwm42012-09-291-20/+2
| | | | | | | | | | | | | | | | The parsing code allowed override tags after \p0 to affect the drawing. This is incorrect. Finish the drawing object as soon as \p0 is encountered instead. This requires moving the code executing the style overrides from get_next_char() in ass_parse.c to the main render loop in ass_renderer.c, because we have to re-enter the rendering loop inside of a tag. The old code was simply executing all tags until a new character could be returned to the renderer loop, mutating up the state (RenderContext fields) for the drawing after the drawing was closed, but before it was rendered. This fixes libass issue #47.
* Fix resetting border style with \rSTYLEwm42012-09-291-2/+2
| | | | | | | | | With \rSTYLE, it is possible to change the border style within the same subtitle event. You can do this by setting a different BorderStyle value in the newly requested style. VSFilter handles this as expected, while libass uses a single border style for the whole subtitle event. This fixes libass issue #56.
* Refactor and fix border generationGrigori Goronzy2012-04-211-19/+30
| | | | | Make sure to update the border appropriately in the second pass, after parsing.
* Support \rSTYLENAME syntaxGrigori Goronzy2012-03-111-1/+12
| | | | | This allows to reset to a certain style, instead of the default style for the current line. For some reason, this was completely missing.
* Fix off-by-one error in \fad, \fadeGrigori Goronzy2011-08-291-4/+5
| | | | | | | | | | Typical greater vs. greater-or-equal case. This especially fixes fades with zero delays. A zero delay in the two-argument form means no fade at all, but previously this faded over a single frame, since the code used "greater" semantics, while "greater or equal" is required here. Notably, this avoids blinking/flickering in some tightly timed karaoke scripts.
* Use the "font encoding" property as a base direction hintGrigori Goronzy2011-07-151-0/+5
| | | | | | | | | | ASS specifies a "font encoding", both in the styles as well as with the \fe override tag. This font encoding is very Windows-specific and libass doesn't use it for charmap matching or anything like that. However, it can be useful for hinting the base direction of text. Make Hebrew and Arabic encodings switch to RTL base direction, other languages to LTR and use neutral base direction for the autodetect setting.
* Separate event parsing and layoutGrigori Goronzy2011-07-041-6/+7
| | | | | | Split up the combined event parsing and layout loop into two passes. State information needed for layout are duplicated in GlyphInfo structures.
* Introduce bitmap runsGrigori Goronzy2011-07-041-0/+13
| | | | | | | | Prepare for run-based rendering. In the parser, increment a run id according to relevant style changes (color, border, shadow, etc.) to mark the points where a new bitmap needs to be started. Modify the line wrapper to increment the run ids of each glyph after a break. Add functions to calculate the render size of runs for rasterization.
* Use bare outlines for drawingsGrigori Goronzy2011-06-201-6/+2
| | | | | | | 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.
* refactor: move karaoke effect parsing into event parserGrigori Goronzy2011-06-061-0/+71
|
* Match first occurence of \fade, \fad, \an and \a tagsGrigori Goronzy2011-05-301-9/+18
| | | | | Track if we already parsed a fade or a alignment tag and ignore all further tags.
* Add support for \fs+ and \fs- syntaxGrigori Goronzy2010-08-121-0/+16
| | | | | | | These forms can be used to add or subtract a value from the current font size instead of setting a new font size. Animations are supported, but not recommended, as they won't be fluid due to grid-fitting/hinting.
* Get rid of NULL checks for freeGrigori Goronzy2010-08-091-2/+1
| | | | | The useless "if (foo) free(foo)" idiom is all over the place, just get rid of it finally...
* Fix drawing leakage: delay glyph allocationGrigori Goronzy2010-08-091-3/+4
| | | | | | 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.
* Raise verbosity level of "unknown transition effect" messageGrigori Goronzy2010-08-011-1/+1
| | | | This is more irritating than it helps and can seriously spam output.
* Fix potential, small memory leakGrigori Goronzy2010-07-291-0/+1
| | | | | Free clip vector drawing if multiple clip vectors appear in a single line. (In this case the last clip vector is used.)
* Parse vector clip mask only after cache missGrigori Goronzy2010-07-291-14/+0
|
* Limit debug output on parsing errorsGrigori Goronzy2010-07-191-1/+1
| | | | Limit context printed after parsing errors to 30 characters
* Handle simple backquotingClément Bœsch2010-05-221-0/+8
| | | | This allows this kind of subtitle to be displayed: \{Hello World\}
* Basic @font supportGrigori Goronzy2010-04-111-3/+9
| | | | | | Do not skip '@' at the start of a font name in styles; detect '@' at font name start and set a new attribute in ASS_Font accordingly. Rotate affected glyphs after loading and calculate a suitable advance.
* Fix leftovers from conversion to ass_strtodYuriy M. Kaminskiy2010-01-121-1/+1
|
* Remove support for freetype < 2.2.1Grigori Goronzy2010-01-081-6/+0
| | | | | Get rid of compatibility #ifdefs and some code to support very old versions of freetype. libass now requires at least version 2.2.1.
* Fix libass w/o fontconfigGrigori Goronzy2009-10-111-13/+13
| | | | | | | | | 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.
* Remove superfluous castGrigori Goronzy2009-10-081-1/+1
|
* Fix alpha calculation in some casesGrigori Goronzy2009-10-021-2/+2
| | | | | Picked up from XBMC svn. This should especially fix MPlayer's direct3d video output (untested).
* Refactor: effect parsing should be in ass_parse.cGrigori Goronzy2009-09-161-0/+75
| | | | | Move the function apply_transition_effects, which parses event-global effects and adjusts a few state variables, into ass_parse.c.
* Refactor: move event parsing code into separate fileGrigori Goronzy2009-09-011-0/+857
Move all code related to parsing event lines and processing override tags into a separate file (ass_parse.c).