summaryrefslogtreecommitdiffstats
path: root/libass
Commit message (Collapse)AuthorAgeFilesLines
* Fix libass w/o fontconfigGrigori Goronzy2009-10-115-28/+41
| | | | | | | | | 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.
* strdup() fontconfig strings freed by callerGrigori Goronzy2009-10-081-3/+5
| | | | | fontconfig_select() can return the path to the default font as fallback, but the caller frees it later. Return a copy with strdup() instead.
* 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).
* Bump version to 0.9.8Grigori Goronzy2009-09-181-1/+1
|
* Refactor: effect parsing should be in ass_parse.cGrigori Goronzy2009-09-163-76/+76
| | | | | Move the function apply_transition_effects, which parses event-global effects and adjusts a few state variables, into ass_parse.c.
* Copy shadow bitmap from glyph bitmapGrigori Goronzy2009-09-161-19/+13
| | | | | It's not necessary to create the shadow bitmap by adding the glyph bitmap to the outline bitmap; the outline is a superset of the glyph.
* Render NBSP (\h) as normal spaceGrigori Goronzy2009-09-161-0/+3
| | | | | | Many fonts don't have a non-breaking space (NBSP) character and this can cause problems when these glyphs are substituted. Render them like a regular space.
* Disable kerning by default and make it configurableGrigori Goronzy2009-09-083-1/+7
| | | | | | | | | | | | | | | | | | 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.
* Fix inline function prototypesGrigori Goronzy2009-09-021-2/+2
|
* Refactor: move event parsing code into separate fileGrigori Goronzy2009-09-015-844/+900
| | | | | Move all code related to parsing event lines and processing override tags into a separate file (ass_parse.c).
* Fix underrun in slant pen correctionGrigori Goronzy2009-09-011-1/+2
|
* Handle illegal \a tags like VSFilterGrigori Goronzy2009-09-011-1/+2
| | | | Treat the illegal \a value 8 like 5 for compatibility with VSFilter.
* opaque box: do not subtract glyph from borderGrigori Goronzy2009-09-013-4/+9
| | | | | Similar to VSFilter, do not subtract the glyph bitmap from the border bitmap when BorderStyle 3 is used.
* Revert "Merge glyph and outline bitmap better"Grigori Goronzy2009-09-011-1/+1
| | | | | | This reverts commit d3cd5b0148d64ae0f6e288e69b09acfe639fdcce. This hack improved blending in few situations, but at the same time broke it in lots o others; get rid of it.
* Calculate glyph slant width correctlyGrigori Goronzy2009-08-311-4/+7
| | | | | | 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.
* Do not close empty drawingsGrigori Goronzy2009-08-291-2/+4
| | | | | | | | 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.
* Fix order of pen advance assignmentsGrigori Goronzy2009-08-231-3/+3
|
* Fix opaque box sizing againGrigori Goronzy2009-08-231-7/+20
| | | | | | | | | 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.
* Fix glyph overlap blendingGrigori Goronzy2009-08-232-16/+17
| | | | | | | | | | 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.
* Scale kerning according to x font scaling factorGrigori Goronzy2009-08-221-2/+4
|
* Trim whitespace after line wrappingGrigori Goronzy2009-08-222-6/+86
| | | | | Mark leading and trailing spaces on lines and adjust layouting code to respect these marks and skip the spaces.
* Clip vector blending: do not copy last row paddingGrigori Goronzy2009-08-201-1/+1
| | | | | | 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.
* Adjust shearing behavior to match VSFilterGrigori Goronzy2009-08-201-9/+15
| | | | | | | | 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 quirk: double-scale widths of opaque boxesGrigori Goronzy2009-08-201-0/+5
| | | | | | | 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.
* Improve and fix outline strikerGrigori Goronzy2009-08-151-10/+31
| | | | | | Exit early if no striking is needed; make sure to strike in reverse direction for non-truetype font and use the usual return value convention (0 == no errors).
* Fix caching of underlined/striked out glyphsGrigori Goronzy2009-08-152-1/+4
|
* Fix crash if glyph bitmap rasterization failsGrigori Goronzy2009-08-141-1/+1
| | | | | Check whether the glyph bitmap used for cache size calculations really exists.
* Implement wrap style 1Grigori Goronzy2009-08-141-5/+4
| | | | | Skip application of the algorithm that moves words between the lines to equalize line length for wrap style 1.
* Cosmetics: ass_render.c formattingGrigori Goronzy2009-08-141-19/+18
|
* Use event bbox for collision detectionGrigori Goronzy2009-08-132-8/+27
| | | | | | 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.
* Scale ascender/descender for opaque boxesGrigori Goronzy2009-08-131-0/+4
|
* Fix build without fontconfigAlexis Ballier2009-08-121-0/+2
|
* Do not draw opaque box if border size zeroGrigori Goronzy2009-08-121-1/+3
| | | | This follows VSFilter's behavior.
* BorderStyle cache integrationGrigori Goronzy2009-08-122-0/+6
| | | | | Add new fields to the cache hash key for BorderStyle 3 (glyph cache and bitmap cache).
* Always parse colors as hex for ASS tracksGrigori Goronzy2009-08-124-7/+11
| | | | | | 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.
* Add glyph emboldening fallbackGrigori Goronzy2009-08-121-0/+22
| | | | | | | Fallback to embolden manually with FreeType in case a bold face was requested, but no bold variant is available. The glyphs are slightly emboldened (much less than FT_GlyphSlot_Embolden would do) and the metrics are not touched at all.
* Fix italic to non-italic space handlingGrigori Goronzy2009-08-121-4/+6
| | | | | | 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.
* Support \q override tagGrigori Goronzy2009-08-122-3/+11
| | | | | | 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.
* Implement BorderStyle 3Grigori Goronzy2009-08-121-3/+48
| | | | | | | 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.
* Fix advance for italic to non-italic style changesGrigori Goronzy2009-08-121-0/+9
| | | | | | | | | 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.
* Factor out renderer types into separate fileGrigori Goronzy2009-08-073-217/+260
|
* Bump shared library version0.9.7Grigori Goronzy2009-08-071-1/+1
|
* Bump LIBASS_VERSION due to renamesGrigori Goronzy2009-08-061-1/+1
|
* Use int for ScaledBorderAndShadowGrigori Goronzy2009-08-061-1/+1
| | | | | Convert type for consistency with other booleans/flags that also use int.
* Rename typedefs (breaks API)Grigori Goronzy2009-08-0619-601/+607
| | | | | | 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.
* Cosmetics: add parameter name in prototypeGrigori Goronzy2009-08-051-1/+1
|
* Fix typoGrigori Goronzy2009-08-051-1/+1
|
* Clarify the AR parameter meaningsGrigori Goronzy2009-08-052-10/+10
| | | | Use the correct terms (SAR/DAR) for the aspect ratio parameters.
* Get rid of MAX_EVENTS limitGrigori Goronzy2009-07-301-3/+3
| | | | | Allocate the maximum possible number of used events in fix_collisions dynamically, eliminating the MAX_EVENTS limit.
* Do not round karaoke timing coordinatesGrigori Goronzy2009-07-291-2/+2
| | | | | | Do not round the coordinates of the glyph bbox (when converting 26.6 fixed-point to integer); they are used for timing karaoke. Doing so can sometimes make \k and \ko karaoke not apply correctly.
* Bring back names for public typesGrigori Goronzy2009-07-281-3/+3
| | | | | | For the event/style/track types, bring back the struct name, but without the _s suffix. This is useful for forward declaration of these types.
* Fix \k and \ko tagsGrigori Goronzy2009-07-281-2/+2
| | | | | | The timing calculations for \k and \ko were off and still assumed int values for a bbox, while it now uses a d6 representation. This essentially made duration about 64 times as long as it should be.
* Clean up typedefs/structsGrigori Goronzy2009-07-2813-54/+52
| | | | | Remove useless _s suffix from struct names and remove struct name where not needed (only the typedef'd struct is used). Clean up API headers.
* Improve message callback APIGrigori Goronzy2009-07-264-8/+7
| | | | | | Instead of passing a pointer to a va_list, pass the va_list itself. Additionally, use const char for the format string and use names in the prototype that describe the arguments' meaning.
* Remove shift vector in ass_render_eventGrigori Goronzy2009-07-254-13/+8
| | | | | | | The shift is not calculated when fetching a glyph anymore. Instead, it is calculated right before rasterizing a glyph. Remove the shift vector and make get_outline_glyph, the glyph cache and ass_font_set_transform work without supplying a shift vector.
* Assume 4:3 AR when calculating missing PlayResX/YGrigori Goronzy2009-07-251-7/+2
| | | | | In case only one PlayResX/Y component is specified, calculate the other component by assuming a 4:3 aspect ratio. This is similar to vsfilter.
* Handle clip vector rasterizer errorsGrigori Goronzy2009-07-241-1/+8
| | | | | If rasterizing the clip vector fails, actually handle the situation instead of crashing.
* Document ass_hinting enumGrigori Goronzy2009-07-241-1/+7
| | | | Add a note to the docs regarding hinting method choice.
* Fix renderer memory leaksGrigori Goronzy2009-07-241-3/+13
| | | | | | | | | | Use the correct free order when freeing a ass_renderer and make sure that the latest list of ass_images is freed, too. Protect the font family string against double free and make sure it is freed in free_render_context. Leaks and access problems were found by valgrind/memcheck.
* Fix fontconfig memory leaksGrigori Goronzy2009-07-241-4/+2
| | | | | | | | | | | | Do not manually use FcConfigFilename; passing a NULL pointer to FcConfigParseAndLoad is just as effective and also avoids a memory leak since the string allocated by FcConfigFilename was never freed. Free FcConfig instance in fontconfig_done; since we're not using the default configuration anymore it doesn't make sense to keep the configuration around. Leaks were found by valgrind/memcheck.
* Free tracks properlyGrigori Goronzy2009-07-241-0/+2
| | | | | When freeing a track, also free the track name and the track itself. Leak found by valgrind/memcheck.
* Fix compilation without fontconfigGrigori Goronzy2009-07-241-3/+5
| | | | | Adjust fontconfig_select and fontconfig_update stubs for the recent changes.
* Move render_id into ass_rendererGrigori Goronzy2009-07-241-3/+1
| | | | | The render_id (last_render_id) variable was the last remaining static data object; move it into render_priv.
* Fallback to default fontconfig configurationGrigori Goronzy2009-07-221-1/+9
| | | | | | | | If parsing or loading the fontconfig configuration file, either using the default or a specified one, fails, try to load the default fontconfig configuration. This triggers loading a fallback configuration if no configuration file is available at all. A warning message is emitted to notify the user about this.
* Fix rasterizer error handling (double free)Grigori Goronzy2009-07-221-1/+0
| | | | | | In case rasterizing a glyph is successful, but rasterizing its outline is not, do not free the glyph bitmap. It will be freed in cache cleanup later. Freeing it earlier leads to a double free.
* Bold/italic: interpret -1 as "true"Grigori Goronzy2009-07-221-6/+6
| | | | | | Interpret the value -1 as "true", as specified in the ASS specifications. Otherwise, clamp the value to 0 for other values < 0, so these are interpreted as "false".
* Do not double free default font/family buffersGrigori Goronzy2009-07-211-5/+0
| | | | Reported by Martin Sourada.
* Factor out bitmap buffer copyGrigori Goronzy2009-07-212-7/+27
| | | | | | | For clarity, factor out bitmap copying into a function. Do not pad the bitmap with stride in the last row; this can not by guaranteed anyway. Add a comment about this peculiarity to the API documentation in ass.h Idea by Evgeniy Stepanov.
* Clamp clip rectangle to frame sizeGrigori Goronzy2009-07-212-4/+5
| | | | | Make sure the clip rectangle is inside the screen boundaries. Idea by Evgeniy Stepanov.
* Animations: allow equal start and end timeGrigori Goronzy2009-07-211-2/+2
| | | | | | Do not set the end time of the animation to the end time of the event in case end time and start time specified in a \t tag are equal. This should sort out a problem introduced by commit 1f176b.
* Check for table availability when striking a glyphGrigori Goronzy2009-07-201-2/+2
| | | | | | | | The glyph striker (underline/strike-through) did not check for table availability, possibly accessing a NULL pointer. Change this to only strike the glyph if the table with the appropriate information is available. Currently there is no fallback for fonts without the required information.
* Font metrics: prefer OS/2 table for ascender/descenderGrigori Goronzy2009-07-201-4/+10
| | | | | | If possible, use ascender/descender from the OS/2 TTF table. This is another try to get libass to match VSFilter in regard to vertical font metrics.
* Fix borders when a x/y component is zeroGrigori Goronzy2009-07-191-1/+1
|
* Fix drawing parser memory leakGrigori Goronzy2009-07-192-3/+1
| | | | | Always free the drawing glyph in ass_drawing_free; do not double free clip vector bitmap.
* Introduce simple cache memory managementGrigori Goronzy2009-07-195-5/+58
| | | | | | | | | | | libass' cache was basically unmanaged; it would grow without any limits, depending on how complex the subtitles are. Introduce a simple limiting that resets the cache if certain limits are exceeded. The bitmap cache is limited to approx. 50 MB size by default, while the glyph cache allows storing up to 1000 glyphs by default. A few tests with rather heavily softsubbed fansubs show that these limits are fine. The API was extended with the function ass_set_cache_limits which allows modification of these limits.
* Fix vertical centering (VALIGN_CENTER)Grigori Goronzy2009-07-191-1/+1
| | | | | | | Match VSFilter behavior when centering non-positioned events vertically. Previously, libass put the event on top of the vertical center while VSFilter centered the event evenly. Adjust the centering to behave like VSFilter.
*