summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* cache: cleanupDr.Smile2019-05-194-79/+92
|
* cache: construct cache values only from corresponding keysDr.Smile2019-05-199-434/+448
| | | | | | | | | | | | | | | | | | | | This commit forces construction of cache values using only data available in its companion keys. That ensures logical correctness: keys are guaranteed to have all the necessary data, and prevents accidental collisions. Most fixes of cache logic correspond to minor problem when rendering is done with double parameter but cache key stores its approximate fixed-point representation. The only serious problem is missing scale of clip drawing. Also this commit removes unused scale parameters from glyph metrics cache key. Due to missing scale clip shapes that differed only in scale treated by cache system as identical. That can lead to incorrect reuse of cached bitmap of different scale instead of correct one. The only hack left is in glyph metrics cache with its unicode >= VERTICAL_LOWER_BOUND check.
* renderer: rewrite measure_text() to correctly account for leading newlinesDr.Smile2019-05-191-31/+22
|
* font: remove dependency on symbol codesDr.Smile2019-05-193-33/+27
| | | | | Leading newlines are now rendered, but still incorrectly: at full height rather than at half-height as required.
* renderer: use C99 features in some functionsDr.Smile2019-05-191-37/+30
| | | | | Note that return value is reversed in parse_events(), ass_render_event() and ass_start_frame() functions.
* drawing: separate drawing text reading from outline constructionDr.Smile2019-05-197-120/+83
| | | | Purpose of this commit is to simplify logic behind drawing handling.
* Eliminate advance.y from drawings and glyphsDr.Smile2019-05-194-15/+11
| | | | | Drawings always have advance.y = 0 and FreeType guarantees that for horizontal writing.
* drawing: remove unnecessary fields from ASS_Drawing structDr.Smile2019-05-194-22/+4
|
* font: remove unused fieldDr.Smile2019-05-193-15/+5
|
* stroker: correctly handle case of many small segmentsDr.Smile2019-01-111-45/+49
| | | | Fixes: https://github.com/libass/libass/issues/326.
* render: simplify detection of hard overridesDr.Smile2018-01-211-7/+7
| | | | | | | | | | | Previously each \r triggered full rescan of event string. After this commit such scanning is done once in init_render_context(). Additionally some lines have moved around to correctly account for state.evt_type (calculated in apply_transition_effects) and state.explicit (used in reset_render_context). That should fix cases with incorrectly applied style overrides for subs with banner scrolling effect before the first \r.
* parse_tags: handle argumentless \t inside \t() like VSFilterOleg Oshmyan2018-01-084-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | \t with no parantheses inside \t() resets the animation parameters of the \t() for subsequent tags, so they are animated as if the \t() was the single-argument version regardless of the actual number of arguments the \t() has. Equivalently, you could say parentheses are implied for \t inside \t(). For example, \t(20,60,\frx0\t\fry0\frz0) animates \frx from 20 to 60 ms and animates \fry and \frz for the whole duration of the line, just like \t(20,60,\frx0)\t(\fry0\frz0) or \t(20,60,\frx0\t(\fry0\frz0)). Technically, VSFilter simply resets the animation parameters for any \t it encounters but parses the embedded tags only if the \t has the right number of arguments. However, top-level animation parameters don't matter because top-level tags are not animated, while any nested \t that has parentheses terminates the containing \t because they share the closing parenthesis, so the fact that a nested \t with empty parentheses or with at least four arguments changes the animation parameters also doesn't matter because the containing \t immediately ends and the changed parameters have nothing to apply to. Thus the only situation where this has a visible effect is a nested \t without parentheses. Closes https://github.com/libass/libass/pull/296.
* parse_tags: don't recurse for nested \t()Oleg Oshmyan2018-01-082-1/+14
| | | | | | | | | | | | | This fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4892 (stack overflow on deeply nested \t()). This is possible because parentheses do not nest and the first ')' terminates the whole tag. Thus something like \t(\t(\t(\t(\t() can be read in a simple loop with no recursion required. Recursion is also not required if the ')' is missing entirely and the outermost \t(... never ends. See https://github.com/libass/libass/pull/296 for more backstory.
* Move parse_tag loop into parse_tag itself, now called parse_tagsOleg Oshmyan2018-01-053-589/+588
| | | | This commit is mostly transparent to `git blame -w`.
* Release 0.14.00.14.0Oleg Oshmyan2017-10-315-4/+14
|
* configure: remove obsolete --disable-rasterizer optionOleg Oshmyan2017-10-311-2/+0
| | | | | The internal rasterizer cannot be disabled (and the option has no effect) since commit ef6cc020bc00118a5b142b37fe401327a029a1fc.
* Support Core Text on earlier versions of Mac OS XOleg Oshmyan2017-10-312-12/+26
| | | | | | | | | | | | | | | | | | | Loosely based on behdad/harfbuzz@b96af03c20e46105982b3608b608614403540661. Prefer to link against ApplicationServices to maximize the portability of binaries built on newer versions of macOS. The symbol kCTFontURLAttribute, which is checked in this commit, was introduced in Mac OS X 10.6, the latest of any Core Text symbols that we use. It is essential to our Core Text font provider, so this is the earliest version of Mac OS X where we can support this font provider. The TARGET_OS_IPHONE conditional that this commit adds is necessary to continue supporting iOS in addition to supporting old Mac OS X. On iOS, CoreText.h *must* be included to use Core Text, whereas on old Mac OS X, CoreText.h is not directly accessible and ApplicationServices.h must be used. On modern macOS, either header works. This conditional is also used in HarfBuzz.
* Don't link Core Text font provider to unneeded CoreGraphics frameworkOleg Oshmyan2017-10-311-1/+1
|
* coretext: don't use a variable-length arrayOleg Oshmyan2017-10-311-1/+1
| | | | | This fixes compilation with GCC, which complains that a variable-length array declaration must not have an initializer.
* Silence missing-field-initializers warningRodger Combs2017-10-271-1/+2
| | | | | | | Clang gives this warning for the universal initializer `={0}`: https://bugs.llvm.org/show_bug.cgi?id=21689 Signed-off-by: Oleg Oshmyan <chortos@inbox.lv>
* fontselect: fix include guard macro nameOleg Oshmyan2017-10-271-3/+3
|
* Completely exclude ass_fontconfig.c from build when it is disabledOleg Oshmyan2017-10-273-5/+7
|
* ass_set_fonts: empty cache as wellRodger Combs2017-10-223-0/+12
|
* rasterizer: fix warningDr.Smile2017-09-181-2/+2
| | | | While int8_t work in practice, uint8_t is more correct type here.
* Consolidate bounding box operationsDr.Smile2017-09-176-48/+43
|
* Rename DBBox to ASS_DRect for uniformityDr.Smile2017-09-173-50/+38
|
* Reorganize outline transformation functionsDr.Smile2017-09-173-63/+66
|
* Switch to more efficient representation of outlinesDr.Smile2017-09-175-416/+355
|
* Switch to native coordinate system for outlinesDr.Smile2017-09-174-78/+52
|
* Replace FreeType types with libass native typesDr.Smile2017-09-1711-250/+207
| | | | | | FT_Vector and FT_BBox types are based on FT_Pos, which is alias of long. FreeType treats it as 32-bit integer, but on some platforms long can be 64-bit. That leads to wasted memory and suboptimal performance.
* stroker: fix wording of algorithm descriptionDr.Smile2017-09-171-6/+6
|
* x86: fix out-of-root builds after 8bddaa2a7Ricardo Constantino2017-09-161-1/+1
| | | | | nasm always uses %include paths starting from the directory from where it's started.
* build: switch from yasm to nasmRodger Combs2017-09-053-14/+14
|
* Makefile: silence warning when x86/utils has no symbolsRodger Combs2017-09-051-2/+2
|
* x86: update x86inc.asmRodger Combs2017-09-051-497/+599
|
* x86: asm adjustments for nasm compatibilityRodger Combs2017-09-057-63/+62
|
* configure: cleanup in preparation for x86inc update and switch to nasmRodger Combs2017-09-051-16/+20
|
* renderer: fix border existence checkDr.Smile2017-08-011-1/+1
| | | | Found by coverity scan.
* stroker: add algorithm descriptionDr.Smile2017-08-011-6/+215
|
* stroker: skip degenerate 2-point contours from broken fontsDr.Smile2017-07-311-6/+14
|
* cosmetic: fix codestyleDr.Smile2017-07-314-75/+75
|
* renderer: fix handling of empty outlinesDr.Smile2017-07-314-38/+41
|
* renderer: switch to using two border outlines instead of oneDr.Smile2017-07-318-132/+134
|
* renderer: remove legacy FreeType rasterizerDr.Smile2017-07-318-143/+10
|
* stroker: implement fast two-outline strokerDr.Smile2017-07-317-348/+1062
|
* rasterizer: implement simultaneous rasterization of two outlinesDr.Smile2017-07-314-110/+202
|
* rasterizer: refactoringDr.Smile2017-07-313-192/+186
|
* cosmetic: extract most of the outline-related functions into separate fileDr.Smile2017-07-3112-275/+335
|
* Release 0.13.70.13.7Grigori Goronzy2017-06-035-5/+7
|
* Allow using shadow offset to adjust size of text backgroundRicardo Constantino2017-06-011-4/+8
| | | | | | | | | | | | Text background refers to the libass-only BorderStyle 4, which is similar to 3, but isn't affected by outline/border size and doesn't render shadow, so shadow offset can be used. You can override the horizontal and vertical box size separately with override tags, just like you can override the color with shadow color. Closes #270
* Fix function prototypeGrigori Goronzy2017-06-011-1/+1
| | | | | Not a serious issue: arguments were named/ordered incorrectly. No functional change.
* fontselect: cleanup lazy font index evaluationGrigori Goronzy2017-06-011-6/+8
| | | | Fixes a possible NULL pointer dereference, reported by Coverity.
* directwrite: fix font collectionsGrigori Goronzy2017-06-014-0/+33
| | | | | | | | | | | | | | | | DirectWrite's FontFileStream does not actually use the data of a specific font in a collection, which was an expectation of the existing code. It simply returns a stream to the underlying file, collection or not. So we need to get the index of the font. This needs to be done lazily as this information is only available in a FontFace, which is expensive to initialize. Add a new optional font provider function for lazy initialization of the index and use it. This is similar to the check_postscript callback. Fixes libass#275. v2: fix type of returned value.
* Fix PlayResX/Y calculationsGrigori Goronzy2017-05-101-2/+2
| | | | | | | | | Avoid that PlayResY is set to 0 when only PlayResX is specified and set to 1. Setting PlayResY to 0 results in divide-by-zero errors. Also fix PlayResX calculations in case only PlayResY is specified, for completeness. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1474.
* Changelog: updatewm42017-04-271-0/+12
|
* Remove arbitrary bitmap size limitRodger Combs2017-02-141-2/+2
| | | | | | | | We're not aware of any specific reason for this number to be used, and actual potentially-dangerous cases should be handled by the other limits. Fixes #260
* Don't limit size of "uuencoded" font linesOleg Oshmyan2017-02-141-6/+1
|
* Fix decode_font when size % 4 != 0 or data contains illegal bytesOleg Oshmyan2017-02-141-22/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When given a byte c, decode_chars expects that 0 <= c - 33 <= 63, i. e. that only the six lowest bits of c - 33 are possibly set. With this assumption, it shifts and adds together multiple c - 33 values. When c > 96, c - 33 has high nonzero bits, which interferes with other shifted terms. c < 33 is even worse: c - 33 is negative (if unsigned char fits in int), and left-shifting negative numbers has undefined behavior. Even before the shift, on common platforms with a two's complement representation of negative integers (or if unsigned char does not fit in int and is promoted to unsigned int), c - 33 has high nonzero bits, which again interfere with other shifted terms. To make matters worse, even perfectly valid encoded data is affected when size % 4 != 0, as decode_font calls decode_chars with '\0', which leads decode_chars to shift and add -33, causing undefined behavior and/or incorrect output. Take our cue from VSFilter and bit-mask c - 33 to keep only the six relevant bits. To ensure that we get the same bits as VSFilter when c < 33 and to avoid the undefined behavior of left-shifting negative numbers, convert the number to unsigned before masking and shifting. While we are at it, rewrite decode_chars entirely to get rid of any GPL code from mkvtoolnix. Related mkvtoolnix bug: https://github.com/mbunkus/mkvtoolnix/issues/1003 Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=516. Also allocate exactly the right amount of memory for the font, because why not.
* ass_lazy_track_init: handle negative PlayResX/PlayResYOleg Oshmyan2017-02-141-6/+6
| | | | Like VSFilter, treat negative values the same as missing values.
* string2timecode: don't truncate milliseconds to intOleg Oshmyan2017-02-141-1/+1
| | | | | | | | | Commit 8c8741fe2000d4b4d89a53f894363a42288cec3e attempted to fix this expression and make it use the full range of long long, but it missed the millisecond term. This fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=522. The entire timestamp can still overflow long long though.
* Reuse numpad2align in parse_tagOleg Oshmyan2017-02-144-31/+27
|
* Fix parsing of unusual Alignment values in ASS style definitionsOleg Oshmyan2017-02-141-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Handle large and negative values except INT32_MIN like VSFilter. This avoids both overflow and inconsistent internal state. This fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=523. VSFilter handles INT32_MIN like a mix of \an1, \an2 and \an3: * Vertical alignment is bottom. * Lines within the event are center-aligned. * Without \pos or \move, the center of the event is aligned with the right edge of the screen minus MarginR. * With \pos or \move, the left edge of the event is aligned with the position point. * Without \org, the rotation origin is aligned with the horizontal center of the event. * (With \org, the rotation origin is as specified.) If we wanted to emulate this in libass, the cleanest way would be to introduce a new horizontal alignment constant for this purpose that would be used only for ASS style definitions with Alignment INT32_MIN. This commit makes no attempt to do this and instead arbitrarily picks \an2 for style definitions with Alignment -INT_MAX-1, which equals INT32_MIN if int is int32_t. The fact that int is platform-dependent is one of the reasons for this. We could change Alignment to be int32_t instead of int for perfect VSFilter compatibility, but the same applies to many other fields that currently use platform-dependent types.
* Don't treat :;<=>? as hexadecimal digits in color headersOleg Oshmyan2017-02-141-1/+1
| | | | Oops.
* Explicitly handle FcPatternGetString(FC_POSTSCRIPT_NAME) mismatchOleg Oshmyan2017-02-111-3/+4
| | | | | | | This does not affect functionality in any way, but it hopefully makes the logic easier to follow. Resolves CID 175691.
* Travis CI: remove HarfBuzz and re-remove Fontconfig from OS X buildsOleg Oshmyan2017-02-071-1/+1
| | | | | | | | | | | Installing HarfBuzz through Homebrew seems to be consistently slow whether we use the bottles and disable the Fontconfig cache or build it from source and drop Fontconfig and other dependencies entirely. To speed up OS X builds, disable both HarfBuzz and Fontconfig. We build with HarfBuzz and Fontconfig on Linux, and we should not have any platform-dependent code that depends on them, so this should not reduce our code coverage.
* Travis CI: re-enable Fontconfig on OS X but force no cache builtOleg Oshmyan2017-02-061-1/+1
| | | | | | | | | | | | | Building HarfBuzz from source works to avoid Fontconfig, but it is still fairly slow. To further speed up the build, try to use only the prebuilt bottle packages (which inevitably brings in Fontconfig as a dependency) but hack the Fontconfig formula to avoid building the font cache. Adding Fontconfig is not the goal of this commit, as we already have it on Linux and our Fontconfig-related code "should" work equally well on other platforms. But since we can now afford it, explicitly ask Homebrew to install Fontconfig even if the dependency that brings it in disappears from Homebrew in the future, and enjoy the improved code coverage.
* Travis CI: build with HarfBuzzOleg Oshmyan2017-02-051-1/+1
| | | | | | | | | | | | On OS X, disable some unnecessary HarfBuzz dependencies. This triggers a source build of HarfBuzz, but it should be fast and avoids bringing in Fontconfig through a dependency chain, which we want to avoid as it wastes a lot of time building its cache when installed. The dependency that brings in Fontconfig is gobject-introspection, but we don't need icu4c either, so disable that to save a little more time that would be spent installing icu4c. We could also disable glib, but the fribidi formula also has it as a dependency and brings it in anyway.
* Travis CI: run Coverity Scan on every master buildOleg Oshmyan2017-02-051-1/+1
| | | | | | We never remember to push to the coverity_scan branch, so currently Coverity Scan never runs. Our master builds are not very frequent, so we should be able to afford running Coverity Scan on every build.
* Travis CI: build using both GCC and ClangOleg Oshmyan2017-02-051-0/+9
| | | | | On OS X, `gcc` is just an alias for Clang, so exclude it to avoid wasting resources doing the exact same build job twice.
* Travis CI: remove libtool reinstall hack on OS XOleg Oshmyan2017-02-051-1/+1
| | | | | | | | | | | The problem was fixed in Homebrew in libtool 2.4.6_1: https://github.com/Homebrew/homebrew-core/commit/712f737a7f64f0fd905357c3765cdce0821a4af2 Since https://blog.travis-ci.com/2016-10-04-osx-73-default-image-live/, this libtool comes preinstalled on Travis CI, thus the hack is no longer needed. Homebrew bug report possibly relevant to the original problem: https://github.com/Homebrew/legacy-homebrew/issues/43874
* Travis CI: explicitly install FreeType on LinuxOleg Oshmyan2017-02-051-1/+1
| | | | | | | Do this for consistency with the other library dependencies. For reference, currently, both FreeType and Fontconfig are preinstalled and don't need to be explicitly mentioned.
* Travis CI: don't require Fontconfig binariesOleg Oshmyan2017-02-051-1/+1
| | | | | | | | | | Only the library is needed. In fact, `apt-get install fontconfig` didn't even install the library at all. Luckily, the package we actually want is preinstalled on Travis CI. We could continue to rely on this fact and completely remove Fontconfig from the install list, but it's clearer and possibly more future-proof to explicitly list it there.
* Travis CI: disable Fontconfig on OS XOleg Oshmyan2017-02-051-1/+1
| | | | | | Homebrew generates the Fontconfig cache when installing Fontconfig, which delays the build by several minutes. Disable the Fontconfig font provider on OS X to avoid this.
* Reduce precision of border width in outline cache keysOleg Oshmyan