| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Patch by chrisburel, posted on Google code issue 31.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
\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.)
|
| |
|
|
|
|
|
| |
Useful when applications specify the style manually for non-ASS
subtitles.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
This complements commit 7af780, which didn't correctly apply the hack
to the advance/position as calculated by the shaper.
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Make sure to update the border appropriately in the second pass, after
parsing.
|
|
|
|
|
| |
This allows to reset to a certain style, instead of the default style
for the current line. For some reason, this was completely missing.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
They are going to be reintroduced later.
|
|
|
|
|
| |
This is a bit hacky, but I'm planning to rewrite positioning in a
much cleaner way. Addresses GC issue #27.
|
|
|
|
| |
This was introduced by the new cache code.
|
|
|
|
|
| |
Adjust the renderer initialization messages and get rid of a rather
useless message, FreeType headers version.
|
|
|
|
|
|
| |
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".
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
This is similar to the earlier change, but for bitmaps.
|
|
|
|
|
| |
Make sure to always load and process outlines the same way, no matter if
cached or not.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Make sure to set the font size for every run, as needed, to get metrics
(advance/offset) for the right size.
|
|
|
|
|
|
|
|
|
|
| |
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 OpenType feature "kern".
The old TrueType kerning code won't come back.
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Handle advance of clusters correctly, fix drawings, calculate run
direction correctly, fix y offset sign.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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!
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
Split up the combined event parsing and layout loop into two passes.
State information needed for layout are duplicated in GlyphInfo
structures.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
Use the alpha channel, not the red channel. Fixes commit f92830.
Original patch by lachs0r.
|
|
|
|
|
|
| |
Cache ascender/descender so they don't have to be queried every frame
for every glyph. This also makes it possible to more uniformly handle
drawings and glyphs.
|
| |
|
|
|
|
|
|
| |
Similarly to the glyph cache, subclass the bitmap cache to allow both
outline bitmaps and clipping mask bitmaps to coexist in the same cache
in a much cleaner way.
|
|
|
|
|
|
|
|
| |
The bitmap hash key duplicated a lot of information the glyph hash
key already saves. The subclassing introduced recently complicates
this even more. Modify the hash key to utilize a pointer to the glyph
hash value instead, which is faster and more flexible. Make sure to
always empty the bitmap cache when the glyph cache is emptied.
|
|
|
|
|
|
|
|
|
| |
Glyphs and drawings have wildly different hash keys. Subclass the hash
keys of glyphs and drawings in a new, unified outline cache. This also
fixes some issues with drawings in the glyph cache. Now, the textual
description of the drawing is included in the key (the hash value isn't
really good enough, especially not fnv32) and the baseline offset is
saved as well.
|
|
|
|
|
| |
Add stride support to the basic bitmap type used for low-level
rasterization.
|
|
|
|
|
|
|
| |
This finally gets rid of the nasty hack that manipulated a glyph
we somehow got from FreeType. Simplifies drawing handling a bit and
decouples drawing code from all font handling and related (fontconfig,
etc.) code.
|
|
|
|
|
|
|
|
|
| |
This introduces functions to use and copy pointered outline objects
easily and uses these instead of glyphs everywhere.
Previously the glyph cache was abused for caching vector clipping masks,
but this isn't possible anymore (nor desirable), thus vector clipping
cache has been disabled for the moment.
|
|
|
|
|
| |
This covers rasterization, filtering and blending for one
render item.
|
| |
|
| |