summaryrefslogtreecommitdiffstats
path: root/libass/ass_render.h
Commit message (Collapse)AuthorAgeFilesLines
* Apply fade only when the fade alpha is positive (like VSFilter)Oleg Oshmyan2015-05-251-1/+1
|
* Remove RenderContext.drawingwm42015-05-101-1/+0
| | | | | This really didn't make a lot of sense. This is a simplification, and should not affect actual program behavior.
* Don't use margins for events that should not be overriddenwm42015-03-161-0/+2
| | | | | | | libass already does not use the margins for events using \pos. This is not quite complete: there are other tags that we consider as "not dialogue", and which should not be overridden. These tags do not use EVENT_POSITIONED, and thus use the margins, which can mess up rendering.
* Allow more fine grained control over style overrideswm42015-02-261-1/+3
| | | | | | | | Add tons of ASS_OVERRIDE_ flags, which control whether certain ASS_Style fields are copied when doing selective style overrides with ass_set_selective_style_override_enabled(). This comes with some cleanup. It should be fully backwards-compatible.
* Clean up bitmap combiningDr.Smile2015-01-281-40/+15
| | | | | | | | | | Now pre- and post-combining operations are clearly separated, many parameters in cache keys are no longer necessary due to that. Also an ambiguous (in case of multiple fonts) text string is replaced with a list of direct bitmap references in composite cache key. Fixes #153. Fixes #82.
* Replace FT_Outline with ASS_OutlineDr.Smile2014-11-231-2/+2
|
* Move apply_blur() to ass_bitmap.cwm42014-11-131-1/+0
| | | | Put all code into one place, which makes it easier to follow.
* Provide slightly more fine-grained control over style overrideswm42014-10-171-0/+3
|
* Add a mechanism for selective style overrideswm42014-06-051-0/+6
| | | | | | | | | | | | | | | 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 change detection when text is clipped to screenwm42014-06-011-1/+1
| | | | | | The glyphs are clipped before combining, so the combined bitmap can always have the same position, size, and address. This breaks the change detection. Or at least I think that's what happens.
* Remove bitmap restridingwm42014-06-011-4/+0
| | | | It turns out we don't need this.
* Implement fast quad-tree rasterizer in C and x86/SSE2/AVX2Dr.Smile2014-04-291-0/+4
| | | | Signed-off-by: Rodger Combs <rodger.combs@gmail.com>
* Fix change detection in presence of vector clipswm42014-03-061-0/+1
| | | | | | | | | | | | | | | | | 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.
* Fix subpixel jumping of rotated glyph runsOleg Oshmyan2014-01-291-0/+1
| | | | | Rotation origin was not taken into account when caching glyph run bitmaps.
* Make apply_blur and make_shadow_bitmap static; remove an unneeded local variable11rcombs2014-01-251-2/+0
|
* Simplify storage size handlingOleg Oshmyan2014-01-261-4/+2
| | | | No functional changes.
* Combine bitmaps before applying blur and shadow11rcombs2014-01-251-2/+74
|
* Do not reset \pbo and \p values after each drawingOleg Oshmyan2014-01-081-1/+2
| | | | Confirmed with VSFilter. This complements the previous commit.
* Fix Hinting againwm42013-09-261-0/+1
| | | | | | | | | | | | 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.
* Don't overwrite user-defined aspect ratio settingswm42013-03-291-2/+1
| | | | | | | | | | | | | | | | | | | | | ass_set_storage_size() overwrote the user-defined aspect ratio set with ass_set_aspect_ratio(). Change it so that if ass_set_aspect_ratio() is used, the ass_set_storage_size() parameters are not used for any aspect ratio calculations. (The storage size is still used for calculating the blur scale.) This simplifies the code as well, because the aspect ratio is now centrally calculated in ass_start_frame(). Update the doxygen. Make it clear that ass_set_storage_size() will be used for aspect ratio calculation, unless ass_set_aspect_ratio() is used. Also mention what libass actually does with the dar and sar parameters: it uses them to calculate a pixel aspect ratio, nothing else. Explicitly allow resetting the storage size with w=h=0. Document that it's allowed to remove the user defined aspect ratio by setting a pixel aspedct ratio of 0. See issue 6.
* shaper: proper script/language handlingGrigori Goronzy2013-03-041-0/+8
| | | | | | | | | | | | | | | | | | | | | Determine script for each character and use this as an additional property for splitting up the text into runs. Characters of Common or Inherited script assume the script of the preceding character. If that is not possible (First character(s) in a run are Common/Inherited, for instance), a backwards scan is done so they can assume the script of the following character. Additionally, determine default language in case no override is set. This simply maps a language to a script, if a language exists that is mostly representative for a given script. Pango's mapping has been adapted. This helps with fonts that don't have OpenType features set up for default script/language pairs. It's also considered to be right approach by most people, and might help with correct OpenType rendering in some other cases. Fixes issue 85.
* Add ass_set_storage_size and fix related scaling issuesOleg Oshmyan2013-03-031-0/+5
| | | | | | | | \blur radius is not scaled from script to storage resolution but is scaled from storage to display resolution. The same applies to borders and shadows if ScaledBorderAndShadow is "no". (If it is "yes", borders and shadows are scaled from script to display resolution just like before.)
* Fix change detection when cache is clearedwm42012-10-011-0/+1
| | | | | | | | | | | check_cache_limits() clears the image list. If all subtitles disappear right in the frame the cache has been cleared, ass_detect_change() will see two empty image lists (old - not empty, but cleared, new - empty), and signal to the application that there was no change. As result, media players which rely on the change detection will keep displaying the last subtitle until the next subtitle event. This bug was found by uau and has been reported on IRC in February.
* Add ass_set_line_position() API function for subtitle positionwm42012-10-011-0/+1
| | | | | | | | This allows users to change the vertical position of normal subtitles. MPlayer has such a feature as -sub-pos option using its internal subtitle renderer. Bump LIBASS_VERSION to indicate the API addition.
* Fix resetting border style with \rSTYLEwm42012-09-291-0/+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-0/+1
| | | | | Make sure to update the border appropriately in the second pass, after parsing.
* Support \rSTYLENAME syntaxGrigori Goronzy2012-03-111-1/+1
| | | | | This allows to reset to a certain style, instead of the default style for the current line. For some reason, this was completely missing.
* Letter spacing is a per-cluster propertyGrigori Goronzy2011-10-031-0/+1
| | | | | | | | Layout refactoring broke letter spacing and always used the last valid spacing specified for the whole line, which is of course wrong. Letter-spacing is an inline property and can be different for each glyph cluster. Add that property to GlyphInfo and use it to fix this regression.
* Runtime shaper selectionGrigori Goronzy2011-08-081-0/+1
| | | | | | | Add an API call, ass_set_shaper, and infrastructure to make shapers selectable at runtime. Currently, this allows to switch between two shapers: a SIMPLE shaper that maps to FriBidi and a COMPLEX shaper that maps to HarfBuzz.
* Use the "font encoding" property as a base direction hintGrigori Goronzy2011-07-151-0/+1
| | | | | | | | | | 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.
* Introduce ASS_Shaper objectGrigori Goronzy2011-07-131-0/+4
| | | | | | Encapsulate all data related to shaping into this new object and migrate all shaping-related code to it. The object is long-living; arrays are allocated only once and then grown as needed.
* Various small fixes to HarfBuzz renderingGrigori Goronzy2011-07-121-0/+1
| | | | | Handle advance of clusters correctly, fix drawings, calculate run direction correctly, fix y offset sign.
* Support glyph clusters of multiple glyphsGrigori Goronzy2011-07-111-1/+4
| | | | | | | | | Sometimes a glyph cluster resolves to multiple glyphs, for example when diacritics are used with Arabic script. This doesn't map well to the list of glyphs expected by libass. Extend the glyph list to a list of singly-linked glyph clusters of glyphs and adapt the renderer to support this.
* HarfBuzz shaping supportGrigori Goronzy2011-07-111-0/+4
| | | | | | | | Split up text into runs with the same direction, font face and font size, shape these runs with HarfBuzz and reorder accordingly. This noticeably improves Arabic shaping and should make shaping for many other scripts work. HarfBuzz also does kerning for Latin text.
* Provisional bidi and shaping supportGrigori Goronzy2011-07-061-0/+1
| | | | | | | | | | | | | | Adds fully working bidirectional text and simple shaping support. The following works: - bidirectional text according to the Unicode Bidirectional Algorithm - simple shaper for mirrored forms (brackets, etc.) according to rule L4 of the Unicode Bidirectional Algorithm - reordering into visual order with correct line wrapping However, the implementation certainly needs efficiency improvements (caching, less malloc'ing), a proper shaper (HarfBuzz) needs to be hooked up and various bugs with karaoke and positioning need to be fixed.
* Separate event parsing and layoutGrigori Goronzy2011-07-041-0/+7
| | | | | | Split up the combined event parsing and layout loop into two passes. State information needed for layout are duplicated in GlyphInfo structures.
* Remove unused struct memberGrigori Goronzy2011-07-041-1/+0
|
* Introduce bitmap runsGrigori Goronzy2011-07-041-0/+5
| | | | | | | | 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.
* cache: use outline-bitmap hierarchy to slim down bitmap hash keyGrigori Goronzy2011-06-271-0/+1
| | | | | | | | The bitmap hash key duplicated a lot of information the glyph hash key already saves. The subclassing introduced recently complicates this even more. Modify the hash key to utilize a pointer to the glyph hash value instead, which is faster and more flexible. Make sure to always empty the bitmap cache when the glyph cache is emptied.
* cache: unified outline cache for glyphs/drawingsGrigori Goronzy2011-06-271-1/+1
| | | | | | | | | Glyphs and drawings have wildly different hash keys. Subclass the hash keys of glyphs and drawings in a new, unified outline cache. This also fixes some issues with drawings in the glyph cache. Now, the textual description of the drawing is included in the key (the hash value isn't really good enough, especially not fnv32) and the baseline offset is saved as well.
* Convert outline processing and caching from glyphs to bare outlinesGrigori Goronzy2011-06-201-2/+2
| | | | | | | | | 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.
* Much improved cache/hashmap implementationGrigori Goronzy2011-06-071-4/+4
| | | | | | | | - less code, cleaner - decoupled from ASS_Library - better data encapsulation - simpler interface - avoids a nasty hack
* refactor: move track init into ass track parserGrigori Goronzy2011-06-061-0/+3
|
* Match first occurence of \fade, \fad, \an and \a tagsGrigori Goronzy2011-05-301-0/+4
| | | | | Track if we already parsed a fade or a alignment tag and ignore all further tags.
* Relicense to ISCGrigori Goronzy2010-09-281-12/+10
| | | | | | 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.
* refactor: move ASS_Renderer getters/setters/etc into separate fileGrigori Goronzy2010-08-011-0/+4
|
* Refactor: move event parsing code into separate fileGrigori Goronzy2009-09-011-0/+2
| | | | | Move all code related to parsing event lines and processing override tags into a separate file (ass_parse.c).
* Trim whitespace after line wrappingGrigori Goronzy2009-08-221-0/+1
| | | | | Mark leading and trailing spaces on lines and adjust layouting code to respect these marks and skip the spaces.
* Use event bbox for collision detectionGrigori Goronzy2009-08-131-2/+3
| | | | | | 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.
* Support \q override tagGrigori Goronzy2009-08-121-1/+1
| | | | | | 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.
* Factor out renderer types into separate fileGrigori Goronzy2009-08-071-0/+258