| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
| |
Edit by Oleg Oshmyan <chortos@inbox.lv>:
Move the final ass_shaper_shape returns inside the switch.
Add a default case in ass_shaper_shape to proactively placate
static analysers that might decide the switch is not exhaustive
and we therefore don't return a value. We know it is actually
exhaustive as we validate the shaper selection in ass_set_shaper.
|
| |
|
| |
|
|
|
|
| |
That triggers undefined behavior.
|
| |
|
|
|
|
|
|
|
| |
Previously, drawings would get shape_run_id = 0 from calloc.
Most of the time, this separated them from text shape runs,
but drawings immediately following the very first shape run
would get appended to it. Make sure this cannot happen.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A libass-chosen shaping run boundary can coincide with a bidi embedding level
boundary such that the differences in shaper_run_id and emblevel cancel out.
For example:
English עבריתEnglish again (with parentheses)
(with no space after the Hebrew)
has ass_shaper_find_runs split runs after the Hebrew, adding 1 to shape_run_id,
while the RTL embed also ends in the same place, removing 1 from emblevel.
As a result, two shape runs that should be separate merge together.
In this example, this leads to HarfBuzz thinking that "English again (with
parentheses)" is still right-to-left, so it flips the parenthesis glyphs.
To avoid this, don't attempt to add these numbers together. Just require
explicitly that both numbers stay constant, rather than their sum.
|
| |
|
|
|
|
|
|
|
|
|
| |
This removes duplicated code (and a not-fully-correct comment).
This also ensures shaping has breaks whenever the rest
of the pipeline breaks runs (e. g. for bitmap combining).
In particular, this adds missing breaks on karaoke changes,
which the old code didn't actually honor despite the comment.
|
|
|
|
|
|
|
|
|
| |
U+FFFC can not only come from drawings but also be actually contained
in the source text. In that case, handle it like any other character.
This doesn't distinguish source-text U+FFFC from drawings
whose strdup failed. But the whole rest of the pipeline
treats those drawings as plain U+FFFC characters, too.
|
|
|
|
|
|
|
|
| |
* Bidirectional isolates
* Arabic letter mark
* Invisible plus
* Variation selectors
* Mongolian control characters
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bracket matching is incompatible with VSFilter (even on modern
Windows), so disable it by default. But as it's generally
a good thing (and 100% more compliant with current Unicode),
keep it available as an ASS_Feature.
It can be toggled individually or enabled as part of the
catch-all ASS_FEATURE_INCOMPATIBLE_EXTENSIONS feature.
If libass is compiled against FriBidi older than 1.0,
bracket matching is impossible. Signal this at runtime
by failing to recognize the ASS_FEATURE_BIDI_BRACKETS
feature. This way, clients who want to use bracket matching
can set the feature without any compile-time checks for
FriBidi and can be freely linked against libass that is itself
compiled against any version of FriBidi; and yet they can
detect at runtime whether the feature is actually enabled.
Fixes https://github.com/libass/libass/issues/374.
|
| |
|
|
|
|
|
|
| |
The only prealloc value actually used is 0, which is not useful
and invokes implementation-defined (and potentially obsolescent
as per C11 DR400) behavior.
|
| |
|
|
|
|
| |
This allows making use of the updated UBA in Unicode 6.3 and up.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
| |
Update the variable that tracks the allocated size. This potentially
improves performance and avoid some side effects, which lead to
undefined behavior in some cases.
Fixes fuzzer test case id:000051,sig:11,sync:fuzzer3,src:004221.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Advantages over the old algorithm consist of the following.
* There are no glitches due to full cache clearing.
Items are arranged into linked list ordered by time of last use.
Only the oldest items get deleted at the clearing event.
* Each item now keeps track of number of references.
Referenced cache values are immune to clearing.
* Reduced amount of total cache memory for the same performance.
* Reduced number of memory allocations per cache item.
|
|
|
|
|
|
|
|
| |
VSFilter uses LTR base direction even if Arabic or Hebrew font
encodings are used, so do the same. This resolves some reordering
issues.
Fixes #224.
|
|
|
|
|
|
|
|
|
| |
As before, this does not add any build system support:
a config.h file and a project must still be manually created
(or the compiler can be run manually instead of using a project).
Signed-off-by: Grigori Goronzy <greg@kinoho.net>
Signed-off-by: Oleg Oshmyan <chortos@inbox.lv>
|
|
|
|
|
| |
MSGL_V is usually for far noisier messages, such as those printed per
subtitle event.
|
|
|
|
|
|
|
| |
Implement a simple font sorter (FontSelector) and an interface to deal
with multiple font sources (FontProvider). Unfinished business,
but works for the most part. Currently the only implemented FontProvider
uses fontconfig.
|
|
|
|
|
| |
HarfBuzz has been able to disable fallback kerning since commit
038c98f6. Add some more useful docstrings instead.
|
|
|
|
|
|
|
|
| |
Don't crash if running out of memory when allocating per-glyph data
during shaping. Also some fixes to initialization.
The caller of ass_fontconfig.c/match_fullname() actually handles a NULL
return value correctly.
|
|
|
|
|
|
| |
It is unlikely, but FriBidi might not process a string correctly,
and we should handle that. Tested by making it fail always. This
should also fix some compiler warnings.
|
|
|
|
| |
Fixes issue #68.
|
|
|
|
| |
These were missing in several places. Fixes #50.
|
|
|
|
|
|
|
| |
start/end of feature tags is unsigned, so use the proper constant
to signal to HarfBuzz that these features are global. This allows
HarfBuzz to cache shape plans, and that can considerably speed up
shaping, especially if many small runs need to be shaped.
|
|
|
|
|
|
| |
Rewrite the core of the harfbuzz shaping function. Gets rid of the
MAX_RUNS limit of runs per line and reuses a single hb_buffer_t,
which should be more efficient.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The code was confusing glyph index and Unicode codepoint.
256df617 attempted a fix but merely moved the wrong code.
Fixes Google Code issue #94.
Vertical ligatures are possibly still broken, but
horizontal ligatures and non-ligatures are correct now.
|
| |
|
|
|
|
|
| |
Since font_size is usually normalized to 256, scale_x/y has to be used
for this purpose.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
The old include statement works only by coincidence, and will actually
break the build on certain setups.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
The code was confusing glyph index and unicode codepoint index.
Fixes issue 94.
|
|
|
|
|
| |
This complements commit 7af780, which didn't correctly apply the hack
to the advance/position as calculated by the shaper.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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!
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
|
|
| |
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
|
| |
|
| |
|
|
|
|
|
| |
Make sure to use vertical advance under the right conditions -
vertical font selected, requested glyph is non-latin.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Shaping works well now, they aren't needed anymore.
|
|
|
|
|
|
| |
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' 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.
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
This leads to fewer shaping runs, but has many unwanted side effects.
|
| |
|
| |
|
|
|
|
|
| |
Make sure to set the font size for every run, as needed, to get metrics
(advance/offset) for the right size.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Make the "Kerning" track property toggle the OpenTyp |