summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* 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 Goronzy2012-05-191-1/+2
| | | | | | | | Correct off-by-one error and add 0x200c-0x200f range. This range is compromised of explicit direction and join marks. Fixes issue 54 Fixes issue 55
* Refactor and fix border generationGrigori Goronzy2012-04-214-20/+35
| | | | | Make sure to update the border appropriately in the second pass, after parsing.
* Support \rSTYLENAME syntaxGrigori Goronzy2012-03-116-46/+61
| | | | | 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-032-1/+3
| | | | | | | | 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.
* Bump version to 0.10.00.10.0Grigori Goronzy2011-09-252-2/+2
|
* Remove unused code for bitmap runsGrigori Goronzy2011-09-251-58/+0
| | | | They are going to be reintroduced later.
* Update changelogGrigori Goronzy2011-09-251-0/+2
|
* autoconf: lowercase variablesGrigori Goronzy2011-09-251-10/+10
| | | | | Use lowercase variable names to avoid bogus "possibly undefined macro" errors.
* test: separate linker flagsGrigori Goronzy2011-09-252-2/+1
| | | | | Use separate linker flags for the test program to avoid unnecessarily linking the libass library against libpng.
* pkg-config: tailor libass.pc for static-only buildsGrigori Goronzy2011-09-252-5/+11
| | | | | | | Add library and package dependencies to the default (non-private) pkg-config fields for static-only builds. This makes sure the packages and libraries are always picked up and used, even if the --static option is not supplied to the pkg-config commandline.
* harfbuzz: adjust to API changeGrigori Goronzy2011-09-241-1/+1
|
* Fix x coordinates with PAR correction and left borderGrigori Goronzy2011-08-291-1/+2
| | | | | This is a bit hacky, but I'm planning to rewrite positioning in a much cleaner way. Addresses GC issue #27.
* harfbuzz: adjust to hb_buffer_t API changeGrigori Goronzy2011-08-291-1/+2
|
* Add changelog for 0.10.0Grigori Goronzy2011-08-291-0/+18
|
* 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.
* Fix drawing leak on cache hitGrigori Goronzy2011-08-291-3/+6
| | | | This was introduced by the new cache code.
* vertical: improve glyph positioningGrigori Goronzy2011-08-251-2/+8
| | | | | | | | | | | | It is a bit crazy, but for vertical layout the sTypoAscender and sTypoDescender fields of the OS/2 table are supposed to be used for determining the size of the ideographic EM box [1], so that glyphs can be centered on the baseline more neatly. With this change, vertical layout should be completely equal to VSFilter. [1] http://www.microsoft.com/typography/otspec150/os2.htm#sta
* harfbuzz: fix vertical advanceGrigori Goronzy2011-08-253-2/+7
| | | | | Make sure to use vertical advance under the right conditions - vertical font selected, requested glyph is non-latin.
* Nicer initialization messagesGrigori Goronzy2011-08-221-5/+3
| | | | | Adjust the renderer initialization messages and get rid of a rather useless message, FreeType headers version.
* opaque box: avoid unnecessary outline copyGrigori Goronzy2011-08-221-2/+1
| | | | | | It's faster and easier to just create a new outline, than to copy it, free it, and create a new one. The old glyph-based code needed to do this since it's not possible to create a glyph "from scratch".
* Fix and simplify opaque box borderGrigori Goronzy2011-08-221-15/+14
| | | | | | Make sure to pass the correct advance and ascender/descender to the opaque box creation function. We can also simplify this a bit as we do not need to check if it's a glyph or drawing anymore.
* Deterministic bitmap loadingGrigori Goronzy2011-08-151-62/+61
| | | | This is similar to the earlier change, but for bitmaps.
* Deterministic outline glyph loadingGrigori Goronzy2011-08-101-39/+34
| | | | | Make sure to always load and process outlines the same way, no matter if cached or not.
* Add compile time switch for HarfBuzz supportGrigori Goronzy2011-08-084-53/+87
| | | | | | | | | | | | | Now that it's possible to switch shapers at runtime, it also becomes a lot easier to disable them at compile time. Add ifdefs and build system changes so that HarfBuzz can be safely disabled. It's autodetected now and enabled if available. This shuffles a bit of code around, but there are no functional changes. Note that FriBidi remains mandatory for the time being, but this shouldn't pose any problems, since it is a small and very portable library without any special dependencies.
* Runtime shaper selectionGrigori Goronzy2011-08-087-32/+86
| | | | | | | 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.
* Adjust italic to non-italic style spacingGrigori Goronzy2011-08-061-4/+2
| | | | | | | | | | Previously, the space added was quite a lot, since it was calculated so that it would be enough to accommodate a heavily FreeType-slanted glyph in the worst case. In many cases this was too much spacing, especially if the italic font was only slightly angled. The new fix simply ensures that the glyph is inside the bounds of the advance.
* Remove a bunch of debug printf callsGrigori Goronzy2011-08-041-34/+1
| | | | Shaping works well now, they aren't needed anymore.
* Support language hint in the Script Info sectionGrigori Goronzy2011-08-015-0/+25
| | | | | | Parse a hint in the form "Language: xx" with xx being an ISO 639-1 language code, and pass it to HarfBuzz. This can be useful to render scripts with language-specific character variants.
* harfbuzz: cache glyph metricsGrigori Goronzy2011-07-294-4/+242
| | | | | | HarfBuzz' FreeType font functions do not cache anything and call FT_Load_Glyph all the time, which can be slow. Add a cache for metrics and use it with custom font functions.
* Fix crash in ass_set_style_overridesGrigori Goronzy2011-07-281-0/+1
| | | | | Set pointer to the style overrides to NULL to make sure a freed buffer will not be accessed anymore later. Reported by uau.
* Axe misleading comment, reordering works fineGrigori Goronzy2011-07-251-2/+0
|
* Disable reordering of non-spacing marksGrigori Goronzy2011-07-251-1/+1
| | | | | | | | FriBidi's line reordering algorithm reorders non-spacing marks (diacritics, etc.) to come after the base character by default. This doesn't work particularly well with our layout model and leads to wrongly positioned marks in some cases with HarfBuzz and all cases with FriBidi shaping.
* Don't extend face runs as much as possibleGrigori Goronzy2011-07-221-5/+0
| | | | This leads to fewer shaping runs, but has many unwanted side effects.
* Update HarfBuzz' font metricsGrigori Goronzy2011-07-221-0/+16
|
* Hack: return a valid face index even if no glyph is foundGrigori Goronzy2011-07-171-0/+2
| | | | | Temporary fix for a crash when a font face doesn't actually contain the glyph that fontconfig reports. Needs a real solution.
* Fix crash with FreeType's updated strokerGrigori Goronzy2011-07-171-7/+26
| | | | | | The new revision of the stroker in FreeType doesn't like the way contours are zero-filled to disable them. It's not particularly clean anyway, so rewrite the whole outline instead.
* Fix line counting and breakingGrigori Goronzy2011-07-171-5/+6
| | | | | | | | | Make sure to increment the line counter only if the offset of the new line is actually legal and inside the bounds of the text size. Fixes random crashes in case the last symbol of the line is a break. git-blame says it's Evgeniys fault, it wasn't caused by the recent layout changes.
* Set requested font face correctlyGrigori Goronzy2011-07-161-1/+1
|
* Remove unused variableGrigori Goronzy2011-07-161-2/+0
|
* shaper: fix run-specific font sizeGrigori Goronzy2011-07-164-10/+10
| | | | | Make sure to set the font size for every run, as needed, to get metrics (advance/offset) for the right size.
* test: free imageGrigori Goronzy2011-07-151-0/+2
| | | | Reduces the noise in valgrind output.
* Cache HarfBuzz fontsGrigori Goronzy2011-07-154-3/+45
| | | | | | Add a new opaque data structure to store shaper-specific font data in an ASS_Font. At the moment, this is used for caching HarfBuzz fonts, to reduce allocation and font initialization overhead.
* Revert @font ascender/descender hackGrigori Goronzy2011-07-151-3/+0
| | | | | | | | | This was introduced with commit e051ab. After re-evaluation, it seems to be rather wrong. Windows appears to use the same ascender as horizontal rendering, except for the first line. We don't have this special handling of the first line, but apart from that, everything is similar to Windows now. Verified with a couple of popular CJK fonts, such as MS Mincho, Meiryo, etc.
* Use the "font encoding" property as a base direction hintGrigori Goronzy2011-07-155-3/+45
| | | | | | | | | | 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.
* Restore italic to non-italic transition layout fixGrigori Goronzy2011-07-131-16/+14
|
* Disable currently unused bitmap run codeGrigori Goronzy2011-07-131-0/+2
|
* Add kerning toggle for HarfBuzz shapingGrigori Goronzy2011-07-133-1/+13
| | | | | Make the "Kerning" track property toggle the OpenType feature "kern". The old TrueType kerning code won't come back.
* Enable vert/vkna features for @font vertical textGrigori Goronzy2011-07-131-1/+44
| | | | | | Set up a feature list and toggles these features as needed. The "vert" feature enables vertical glyph variants in general, while "vkna" additionally enables vertical variants for Kana.
* Fix layout with fsp/fay features enabledGrigori Goronzy2011-07-131-3/+6
|
* Introduce ASS_Shaper objectGrigori Goronzy2011-07-134-116/+199
| | | | | | 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-123-24/+31
| | | | | Handle advance of clusters correctly, fix drawings, calculate run direction correctly, fix y offset sign.
* Support glyph clusters of multiple glyphsGrigori Goronzy2011-07-114-107/+203
| | | | | | | | | 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-115-34/+145
| | | | | | | | 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.
* Add HarfBuzz checks to build systemGrigori Goronzy2011-07-111-0/+12
|
* Separate glyph font face matching and glyph loadingGrigori Goronzy2011-07-113-23/+50
| | | | | | | | | | | Split up ass_font_get_glyph into two functions: one function matches checks the fonts for support of the requested codepoint and returns a face_index and glyph_index to later load the glyph, with a second function. This approach is very useful for shaping, which needs to be done on runs with the same font face and font size and changes the glyph_index.
* Hook up FriBidi's simple Arabic shaperGrigori Goronzy2011-07-101-9/+12
| | | | | Use FriBidi's shaper not only for mirroring, but also for simplified Arabic shaping.
* Fix bitmap cacheGrigori Goronzy2011-07-101-2/+3
| | | | | | Pass the *complete* hash key to the cache handling functions, not only the outline-specific subkey. This mistake completely stopped the cache from actually working and resulted in great slowdown!
* Reorder positions for "Banner" effect textGrigori Goronzy2011-07-101-32/+36
| | | | | | Events that use the "Banner" effect have different wrapping/breaking handling (none at all, to be exact) and need special treatment to make reordering work.
* Redesign horizontal alignment calculations for bidiGrigori Goronzy2011-07-091-18/+7
| | | | | | | The line alignment code determined the first and last glyph in a line and calculated the distance from that. This is rather arcane and doesn't easily work with bidi. Redesign the algorithm to simply add together all individual character widths instead.
* Fix coordinates after repositioningGrigori Goronzy2011-07-081-2/+11
|
* shaper: always use neutral base directionGrigori Goronzy2011-07-081-1/+2
|
* shaper: print version info stringGrigori Goronzy2011-07-063-0/+12
|
* Provisional bidi and shaping supportGrigori Goronzy2011-07-065-15/+210
| | | | | | | | | | | | | | 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.
* Fix cache leakGrigori Goronzy2011-07-061-1/+1
| | | | | Fixes a leak introduced with the new cache functions, caused by wrong pointer usage.
* Add FriBidi checks to build systemGrigori Goronzy2011-07-041-0/+14
|
* Separate event parsing and layoutGrigori Goronzy2011-07-044-133/+148
| | | | | | 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-043-0/+80
| | | | | | | | 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.
* Fix box blur for non-bordered outlinesGrigori Goronzy2011-07-041-1/+1
| | | | | | This horrible bug was introduced by commit c13cb2. Pointed out by uau.
* Fix: VSFilter compat: don't render shadow when glyph/border invisibleGrigori Goronzy