summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Update changelog0.10.20.10.2Grigori Goronzy2013-10-151-0/+27
|
* Update version infoGrigori Goronzy2013-10-142-2/+2
|
* Don't rely on events being sorted in ass_step_sub()wm42013-10-071-19/+31
| | | | | | | | | | | | 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.
* ass_shaper: changing scale_x/y starts a new glyph runwm42013-09-261-0/+2
| | | | | Since font_size is usually normalized to 256, scale_x/y has to be used for this purpose.
* Cosmetics: remove repetitionwm42013-09-261-38/+35
|
* Fix Hinting againwm42013-09-263-29/+49
| | | | | | | | | | | | 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.
* Skip both newline and carriage return.Reimar Döffinger2013-09-251-3/+5
| | | | | | | | '\r' characters weren't skipped correctly. SKIP_SYMBOL from original patch renamed to IS_SKIP_SYMBOL. Signed-off-by: wm4 <wm4@nowhere>
* Restore hintingwm42013-09-242-3/+17
| | | | | | | | | | | | | | | | | | | 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). Also see google code issue #46.
* enca: fix memory leakwangkun2013-09-241-0/+5
|
* Fix fribidi include pathwm42013-07-172-3/+1
| | | | | The old include statement works only by coincidence, and will actually break the build on certain setups.
* Document insane (xy-)vsfilter color semanticswm42013-07-061-13/+67
|
* Fix OS/2 usWinDescent/usWinAscent for quirky fontsGrigori Goronzy2013-07-061-3/+4
| | | | | | | | Some fonts stuff a signed, negative value into this unsigned field. This usually causes very small and wrongly positioned rendering. Also handle usWinAscent similarly, just in case. Fixes issue #106.
* Don't mutate input buffer for ass_read_memory()wm42013-06-231-4/+11
| | | | | | | | | | | | | | | Fixes google code issue #88. process_text() garbles the memory as the text is parsed. This also fixes that the user provided buffer implicitly had to be null terminated. This wasn't obvious, because the caller passes in the buffer length. libass ignored the buffer length (unless a codepage was provided and iconv was enabled), and happily read past the end of the buffer. It would be much nicer if the parsing code would be fixed, instead of just copying the input buffer. Maybe one day.
* Remove unused variableswm42013-06-222-7/+1
|
* Allow different ASS_Library for ASS_Track and ASS_Rendererwm42013-06-221-3/+0
| | | | | | | | | | | Remove the explicit check whether the ASS_Track and ASS_Renderer were created from the same ASS_Library object. Logging will not be entirely consistent (some log messages go to the ASS_Track library when rendering), but otherwise it works. ASS_Library also contains embedded fonts added with ass_add_font(). It looks like the renderer will use the fonts from the ASS_Renderer library object.
* Parse style names like VSFilter doesOleg Oshmyan2013-06-222-9/+21
| | | | | | Trim '*' from the start of style name fields of Style and Dialogue lines and normalize the case of "Default" in the style name field of Dialogue lines.
* Fix \r style lookupOleg Oshmyan2013-06-223-1/+22
| | | | | Make \rSTYLENAME with an invalid STYLENAME fall back to line style rather than to Default. This fixes issue #104.
* Fix blur scalingwm42013-06-221-0/+2
| | | | | | | | | Commit 0e1702ad7a6a827d "Add ass_set_storage_size and fix related scaling issues" attempted to fix blur scaling. This breaks blur scaling for players which don't call ass_set_storage_size(). This commit reverts the default behavior to the old behavior. The behavior when ass_set_storage_size() is called should be unchanged.
* Improve font mismatch messagewm42013-06-221-5/+12
| | | | | | | | | | | | | | | | | | | | | | | Example for an old message: [ass] fontconfig: Selected font is not the requested one: 'DejaVu Sans' != 'Wingdings' it was hard to tell which was the selected and the requested font. Also, it's not really clear what's the problem at all. Why would it select a different font? Obviously, the issue is that it can't find the font in the first place. Now it prints: [ass] fontconfig: cannot find glyph U+006C in font 'Wingdings', falling back to 'DejaVu Sans' Or if the code parameter for select_font() is 0: [ass] fontconfig: cannot find font 'Wingdings', falling back to 'DejaVu Sans' I'm not sure if this message is really accurate in all cases. It's possible that there are more reasons for failure. But all things considered, this should be easier to understand.
* Allow building as DLL on Windowswm42013-06-111-1/+1
| | | | Patch by jon_y on IRC.
* fontconfig: remove default "lang" setting from patternsUoti Urpala2013-05-141-0/+8
| | | | | | | | | | | | | | Fontconfig defaults set the "lang" value in patterns, and it then prefers fonts which are listed as supporting this language. The default value may not match actual script language, and even a setting of "en" for English subtitle can cause problems. Remove the "lang" setting from patterns used to find fonts. A file had a normal and an oblique version of the same font attached, with different character set coverage: the normal version lacked some non-ascii characters that fontconfig includes in its list of characters required for English support. As a result, the oblique version was picked for what was supposed to be normal text.
* 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.
* Bump LIBASS_VERSIONwm42013-04-121-1/+1
| | | | The ABI was broken and a new API function were introduced.
* 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.)
* Add ass_set_pixel_aspect(), deprecate ass_set_aspect_ratio()wm42013-03-293-11/+58
| | | | | | | | | | | | ass_set_aspect_ratio() is confusing, because it takes a DAR and SAR value, while libass just needs a single pixel aspect ratio. Introduce ass_set_pixel_aspect(), which sets the pixel aspect ratio directly. ass_set_aspect_ratio() is considered deprecated. There's no reason to remove it, but hopefully directing users to ass_set_pixel_aspect() will make for a simpler API. Improve the doxygen and document what ass_set_margins() actually does.
* Don't overwrite user-defined aspect ratio settingswm42013-03-294-19/+28
| | | | | | | | | | | | | | | | | | | | | 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.
* Fix crazy VSFilter behavior for \move tagwm42013-03-201-1/+9
| | | | Fixes issue 90 (both cases).
* Add type field to ASS_Image structwm42013-03-202-9/+20
| | | | Patch by chrisburel, posted on Google code issue 31.
* shaper: proper script/language handlingGrigori Goronzy2013-03-043-6/+179
| | | | | | | | | | | | | | | | | | | | | 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.
* shaper: correctly handle @font advanceGrigori Goronzy2013-03-031-3/+6
| | | | | | The code was confusing glyph index and unicode codepoint index. Fixes issue 94.
* Support reading the YCbCr Matrix headerOleg Oshmyan2013-03-034-0/+58
| | | | | | | | | | | | The value is parsed and stored as an enum constant that the consumer can read from ASS_Track. All output images are still plain RGB, and the consumer is expected to perform its own color correction. Supported header values: (TV|PC).(601|709|240M|FCC) and None. If the header is missing, a special compatibility value is used that should be treated as TV.601 if the accompanying video stream is YCbCr and as None otherwise. If the header is present but has an invalid/unknown value, a different special value is substituted.
* Add ass_set_storage_size and fix related scaling issuesOleg Oshmyan2013-03-035-4/+47
| | | | | | | | \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.)
* 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.
* Scale border size with user font size coefficientwm42013-01-111-0/+1
|
* Add Blur field to ASS_Stylewm42013-01-113-1/+3
| | | | | Useful when applications specify the style manually for non-ASS subtitles.
* Fix fallback event formatsGrigori Goronzy2013-01-091-2/+2
| | | | Fixes issue 83.
* Parse angle in styles as double numberGrigori Goronzy2013-01-072-2/+2
| | | | | | Similar to VSFilter. Thanks to Iroha for reporting this issue. Note: this breaks the ABI!
* Use glyph properties instead of renderer state in draw_opaque_boxOleg Oshmyan2012-12-281-7/+7
| | | | | | | scale_x, scale_y and hspacing should be read from the GlyphInfo of the glyph the box is based on, not from render_priv->state. The values in the renderer state are affected by override tags specified after this glyph, so they are irrelevant.
* Properly render opaque box shadows even when there is no borderOleg Oshmyan2012-12-283-6/+10
| | | | | | | | | | | | Even if the border size is zero, the shadow is supposed to be a copy of a hypothetical border: when border_style is 1, this coincides with the borderless glyph, but when border_style is 3, the shadow must be an opaque box. Opaque box borders are now generated regardless of border size being non-zero, and outline_to_bitmap3 gets a new flag indicating whether it should discard the border (after generating a shadow from it).
* Apply blur to both glyph and border when using opaque box bordersOleg Oshmyan2012-12-281-3/+3
|
* Fix fix_freetype_strokerOleg Oshmyan2012-12-281-5/+5
| | | | | | | | | | | | The first point in a countour is not allowed to be a cubic control point, which is sometimes violated by blindly reversing a countour, producing the following errors: [ass] FT_Stroker_ParseOutline failed, error: 20 [ass] Failed to rasterize glyph: 1 To avoid this, let the first point remain the first and only reverse the order of the remaining points.
* Fix leaks when error occurs.Xidorn Quan2012-12-141-1/+4
|
* Fix a wrong condition.Xidorn Quan2012-12-141-1/+1
|
* Removes an useless warning message.Xidorn Quan2012-12-141-5/+0
| | | | | | Function "outline_to_bitmap" gives a warning itself when it returns NULL, so it is useless to print an addition warning for checking its return value.
* Fix generation of libass.pc0.10.1Grigori Goronzy2012-10-161-2/+2
|
* Bump minimum Harfbuzz version to 0.9.5Grigori Goronzy2012-10-161-2/+2
|
* shaper: add hack to workaround grid-fittingGrigori Goronzy2012-10-162-7/+10
| | | | | This complements commit 7af780, which didn't correctly apply the hack to the advance/position as calculated by the shaper.
* Update changelogGrigori Goronzy2012-10-151-0/+3
|
* Revert "shaper: add UCDN support"Grigori Goronzy2012-10-154-216/+1
| | | | | | | | This reverts commit 840ce4c2d9381e340c3239d104933fea85fff3e5. Harfbuzz added UCDN support much quicker than I thought and the latest release 0.9.5 contains UCDN already, so we don't need it in libass anymore.
* shaper: improve skipping of zero-width charactersGrigori Goronzy2012-10-011-13/+25
| | | | | | The list was somewhat incomplete. Add what's important and left, and disable removal if HarfBuzz is used. HarfBuzz removes these characters now by itself. Refactor a little into a separate function.
* drawing: scale pbo according to drawing scaleGrigori Goronzy2012-10-011-2/+4
| | | | Fixes issue #68.
* Fix change detection in a rare caseGrigori Goronzy2012-10-011-1/+5
| | | | | | | | | If an empty track is passed to ass_render_frame, always set the change detection value to 2 (content and positions changed). This is acceptable in both the case that the previous call resulted in images (obviously) and in the case that the previous call resulted in no images (in that case the change detection result doesn't actually matter).
* shaper: add UCDN supportGrigori Goronzy2012-10-014-1/+216
| | | | | | Add explicit support for UCDN, without relying on any HarfBuzz integration. This finally allows easy usage of HarfBuzz without glib, ICU, or some other big bloated library!
* Update changelogGrigori Goronzy2012-10-011-0/+11
|
* shaper: allow font encoding -1 for neutral base directionGrigori Goronzy2012-10-011-2/+5
|
* shaper: always use LTR base direction by defaultGrigori Goronzy2012-10-011-4/+2
| | | | | | | | | | Unfortunately, VSFilter always assumes LTR base direction. All existing Arabic subtitles have been designed with that in mind. This causes various issues, for instance punctuation placed at the wrong side of a line. We have no other choice than to use the same braindead always-LTR assumption (except if overridden by the font encoding property).
* Fix change detection when cache is clearedwm42012-10-012-0/+7
| | | | | | | | | | | 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-016-5/+32
| | | | | | | | 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 \fay when used with multiline subswm42012-09-291-0/+1
| | | | | | | | | When \fay tag is applied to a multiline sub, it causes subsequent lines of the sub to be offset vertically as if it was rendered next to the previous line (not below). Patch by Hector Martin <hector@marcansoft.com>, with an additional correction related to libass issue #46.
* Fix issues with shearing in combination with scalingwm42012-09-291-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two problems. First, the shearing tags (\fay and \fax) misbehave when used with scaling tags (\fscx and \fscy). We have to compensate for the scaling in either direction when shearing, because the shearing is applied after scaling. VSFilter, which by definition has the correct behavior, does it the other way around. Second, libass doesn't scale smoothly when small font sizes are involved. These can come either from downscaling (e.g. make the mplayer window smaller than the video with a video output like gl or vdpau), or from setting the font size manually. In these cases, the font size passed to freetype get very low, so that rounding errors or size adjustments due to hinting or other pixel grid fitting add up. The result is text rendered in the wrong size, or "pulsating" text if the font size depends on animated parameters. This is worsened by the practice found in subtitle scripts to use tag combinations like "\fscy2500\fs2" to get more precision for controlling font size (needed because VSFilter doesn't read fractional scale values). We solve the second issue by always requesting a constant font size from freetype, and then scaling the resulting glyph to the desired size. This seems to disable freetype's glyph fitting issue. The caveat is that it (obviously) also disables hinting, which may result in worse text quality. However, the combination of applying \fs and \fscx tags, and animating them, seems to leave no other choice. This fixes libass issue #46 (hopefully).
* Terminate drawings immediately on a \p0 tagwm42012-09-293-25/+35
| | | | | | | | | | | | | | | | 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-293-6/+10
| | | | | | | | | 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.
* shaper: fix control character filteringGrigori Goronz