]> granicus.if.org Git - libass/log
libass
10 years agoUpdate changelog 0.10.2 0.10.2
Grigori Goronzy [Mon, 14 Oct 2013 09:32:06 +0000 (11:32 +0200)]
Update changelog

10 years agoUpdate version info
Grigori Goronzy [Mon, 14 Oct 2013 09:31:35 +0000 (11:31 +0200)]
Update version info

10 years agoDon't rely on events being sorted in ass_step_sub()
wm4 [Mon, 7 Oct 2013 11:59:08 +0000 (13:59 +0200)]
Don't rely on events being sorted in ass_step_sub()

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.

10 years agoass_shaper: changing scale_x/y starts a new glyph run
wm4 [Wed, 25 Sep 2013 21:28:38 +0000 (23:28 +0200)]
ass_shaper: changing scale_x/y starts a new glyph run

Since font_size is usually normalized to 256, scale_x/y has to be used
for this purpose.

10 years agoCosmetics: remove repetition
wm4 [Wed, 25 Sep 2013 18:00:14 +0000 (20:00 +0200)]
Cosmetics: remove repetition

10 years agoFix Hinting again
wm4 [Wed, 25 Sep 2013 17:23:52 +0000 (19:23 +0200)]
Fix Hinting again

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.

10 years agoSkip both newline and carriage return.
Reimar Döffinger [Tue, 24 Sep 2013 20:28:15 +0000 (22:28 +0200)]
Skip both newline and carriage return.

'\r' characters weren't skipped correctly.

SKIP_SYMBOL from original patch renamed to IS_SKIP_SYMBOL.

Signed-off-by: wm4 <wm4@nowhere>
10 years agoRestore hinting
wm4 [Tue, 24 Sep 2013 20:28:35 +0000 (22:28 +0200)]
Restore hinting

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.

10 years agoenca: fix memory leak
wangkun [Tue, 6 Aug 2013 03:28:47 +0000 (11:28 +0800)]
enca: fix memory leak

10 years agoFix fribidi include path
wm4 [Wed, 17 Jul 2013 16:32:26 +0000 (18:32 +0200)]
Fix fribidi include path

The old include statement works only by coincidence, and will actually
break the build on certain setups.

10 years agoDocument insane (xy-)vsfilter color semantics
wm4 [Fri, 28 Jun 2013 16:28:18 +0000 (18:28 +0200)]
Document insane (xy-)vsfilter color semantics

10 years agoFix OS/2 usWinDescent/usWinAscent for quirky fonts
Grigori Goronzy [Fri, 5 Jul 2013 23:14:39 +0000 (01:14 +0200)]
Fix OS/2 usWinDescent/usWinAscent for quirky fonts

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.

10 years agoDon't mutate input buffer for ass_read_memory()
wm4 [Sat, 22 Jun 2013 17:36:42 +0000 (19:36 +0200)]
Don't mutate input buffer for ass_read_memory()

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.

10 years agoRemove unused variables
wm4 [Sat, 22 Jun 2013 17:28:35 +0000 (19:28 +0200)]
Remove unused variables

10 years agoAllow different ASS_Library for ASS_Track and ASS_Renderer
wm4 [Sat, 22 Jun 2013 17:22:53 +0000 (19:22 +0200)]
Allow different ASS_Library for ASS_Track and ASS_Renderer

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.

10 years agoParse style names like VSFilter does
Oleg Oshmyan [Sat, 15 Jun 2013 21:24:45 +0000 (22:24 +0100)]
Parse style names like VSFilter does

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.

10 years agoFix \r style lookup
Oleg Oshmyan [Sat, 15 Jun 2013 21:02:54 +0000 (22:02 +0100)]
Fix \r style lookup

Make \rSTYLENAME with an invalid STYLENAME fall back to
line style rather than to Default. This fixes issue #104.

10 years agoFix blur scaling
wm4 [Tue, 18 Jun 2013 00:14:14 +0000 (02:14 +0200)]
Fix blur scaling

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.

10 years agoImprove font mismatch message
wm4 [Mon, 17 Jun 2013 21:52:49 +0000 (23:52 +0200)]
Improve font mismatch message

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.

10 years agoAllow building as DLL on Windows
wm4 [Tue, 11 Jun 2013 11:55:07 +0000 (13:55 +0200)]
Allow building as DLL on Windows

Patch by jon_y on IRC.

11 years agofontconfig: remove default "lang" setting from patterns
Uoti Urpala [Mon, 6 May 2013 14:35:17 +0000 (17:35 +0300)]
fontconfig: remove default "lang" setting from patterns

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.

11 years agoClip tag arguments are not optional
wm4 [Fri, 12 Apr 2013 16:34:30 +0000 (18:34 +0200)]
Clip tag arguments are not optional

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.

11 years agoBump LIBASS_VERSION
wm4 [Fri, 12 Apr 2013 16:10:22 +0000 (18:10 +0200)]
Bump LIBASS_VERSION

The ABI was broken and a new API function were introduced.

11 years agoIgnore junk in nested \t tags
wm4 [Fri, 22 Mar 2013 09:04:57 +0000 (10:04 +0100)]
Ignore junk in nested \t tags

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.)

11 years agoAdd ass_set_pixel_aspect(), deprecate ass_set_aspect_ratio()
wm4 [Wed, 20 Mar 2013 00:09:12 +0000 (01:09 +0100)]
Add ass_set_pixel_aspect(), deprecate ass_set_aspect_ratio()

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.

11 years agoDon't overwrite user-defined aspect ratio settings
wm4 [Mon, 18 Mar 2013 23:15:17 +0000 (00:15 +0100)]
Don't overwrite user-defined aspect ratio settings

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.

11 years agoFix crazy VSFilter behavior for \move tag
wm4 [Wed, 20 Mar 2013 01:10:32 +0000 (02:10 +0100)]
Fix crazy VSFilter behavior for \move tag

Fixes issue 90 (both cases).

11 years agoAdd type field to ASS_Image struct
wm4 [Wed, 20 Mar 2013 00:19:13 +0000 (01:19 +0100)]
Add type field to ASS_Image struct

Patch by chrisburel, posted on Google code issue 31.

11 years agoshaper: proper script/language handling
Grigori Goronzy [Mon, 4 Mar 2013 19:24:35 +0000 (20:24 +0100)]
shaper: proper script/language handling

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.

11 years agoshaper: correctly handle @font advance
Grigori Goronzy [Sun, 3 Mar 2013 22:45:26 +0000 (23:45 +0100)]
shaper: correctly handle @font advance

The code was confusing glyph index and unicode codepoint index.

Fixes issue 94.

11 years agoSupport reading the YCbCr Matrix header
Oleg Oshmyan [Fri, 1 Feb 2013 23:35:02 +0000 (23:35 +0000)]
Support reading the YCbCr Matrix header

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.

11 years agoAdd ass_set_storage_size and fix related scaling issues
Oleg Oshmyan [Wed, 22 Aug 2012 21:59:46 +0000 (00:59 +0300)]
Add ass_set_storage_size and fix related scaling issues

\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.)

11 years agoMake closing ')' optional for some ASS tags
wm4 [Thu, 10 Jan 2013 23:27:55 +0000 (00:27 +0100)]
Make closing ')' optional for some ASS tags

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.

11 years agoScale border size with user font size coefficient
wm4 [Thu, 10 Jan 2013 23:58:42 +0000 (00:58 +0100)]
Scale border size with user font size coefficient

11 years agoAdd Blur field to ASS_Style
wm4 [Thu, 10 Jan 2013 23:47:32 +0000 (00:47 +0100)]
Add Blur field to ASS_Style

Useful when applications specify the style manually for non-ASS
subtitles.

11 years agoFix fallback event formats
Grigori Goronzy [Wed, 9 Jan 2013 22:30:19 +0000 (23:30 +0100)]
Fix fallback event formats

Fixes issue 83.

11 years agoParse angle in styles as double number
Grigori Goronzy [Mon, 7 Jan 2013 19:16:25 +0000 (20:16 +0100)]
Parse angle in styles as double number

Similar to VSFilter. Thanks to Iroha for reporting this issue.

Note: this breaks the ABI!

11 years agoUse glyph properties instead of renderer state in draw_opaque_box
Oleg Oshmyan [Sun, 16 Dec 2012 21:54:57 +0000 (23:54 +0200)]
Use glyph properties instead of renderer state in draw_opaque_box

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.

11 years agoProperly render opaque box shadows even when there is no border
Oleg Oshmyan [Sun, 16 Dec 2012 17:02:32 +0000 (19:02 +0200)]
Properly render opaque box shadows even when there is no border

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).

11 years agoApply blur to both glyph and border when using opaque box borders
Oleg Oshmyan [Sun, 16 Dec 2012 16:08:23 +0000 (18:08 +0200)]
Apply blur to both glyph and border when using opaque box borders

11 years agoFix fix_freetype_stroker
Oleg Oshmyan [Thu, 22 Nov 2012 02:19:17 +0000 (02:19 +0000)]
Fix fix_freetype_stroker

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.

11 years agoFix leaks when error occurs.
Xidorn Quan [Sun, 2 Dec 2012 07:42:31 +0000 (15:42 +0800)]
Fix leaks when error occurs.

11 years agoFix a wrong condition.
Xidorn Quan [Wed, 21 Nov 2012 12:26:17 +0000 (20:26 +0800)]
Fix a wrong condition.

11 years agoRemoves an useless warning message.
Xidorn Quan [Wed, 21 Nov 2012 12:24:24 +0000 (20:24 +0800)]
Removes an useless warning message.

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.

11 years agoFix generation of libass.pc 0.10.1
Grigori Goronzy [Tue, 16 Oct 2012 17:59:59 +0000 (19:59 +0200)]
Fix generation of libass.pc

11 years agoBump minimum Harfbuzz version to 0.9.5
Grigori Goronzy [Tue, 16 Oct 2012 17:57:37 +0000 (19:57 +0200)]
Bump minimum Harfbuzz version to 0.9.5

11 years agoshaper: add hack to workaround grid-fitting
Grigori Goronzy [Tue, 16 Oct 2012 17:55:55 +0000 (19:55 +0200)]
shaper: add hack to workaround grid-fitting

This complements commit 7af780, which didn't correctly apply the hack
to the advance/position as calculated by the shaper.

11 years agoUpdate changelog
Grigori Goronzy [Mon, 15 Oct 2012 15:46:37 +0000 (17:46 +0200)]
Update changelog

11 years agoRevert "shaper: add UCDN support"
Grigori Goronzy [Mon, 15 Oct 2012 14:45:23 +0000 (16:45 +0200)]
Revert "shaper: add UCDN support"

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.

11 years agoshaper: improve skipping of zero-width characters
Grigori Goronzy [Mon, 1 Oct 2012 18:39:02 +0000 (20:39 +0200)]
shaper: improve skipping of zero-width characters

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.

11 years agodrawing: scale pbo according to drawing scale
Grigori Goronzy [Mon, 1 Oct 2012 18:08:12 +0000 (20:08 +0200)]
drawing: scale pbo according to drawing scale

Fixes issue #68.

11 years agoFix change detection in a rare case
Grigori Goronzy [Mon, 1 Oct 2012 17:33:36 +0000 (19:33 +0200)]
Fix change detection in a rare case

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).

11 years agoshaper: add UCDN support
Grigori Goronzy [Mon, 1 Oct 2012 15:37:00 +0000 (17:37 +0200)]
shaper: add UCDN support

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!

11 years agoUpdate changelog
Grigori Goronzy [Mon, 1 Oct 2012 15:10:29 +0000 (17:10 +0200)]
Update changelog

11 years agoshaper: allow font encoding -1 for neutral base direction
Grigori Goronzy [Mon, 1 Oct 2012 15:05:18 +0000 (17:05 +0200)]
shaper: allow font encoding -1 for neutral base direction

11 years agoshaper: always use LTR base direction by default
Grigori Goronzy [Mon, 1 Oct 2012 13:53:32 +0000 (15:53 +0200)]
shaper: always use LTR base direction by default

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).

11 years agoFix change detection when cache is cleared
wm4 [Sat, 29 Sep 2012 22:45:59 +0000 (00:45 +0200)]
Fix change detection when cache is cleared

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.

11 years agoAdd ass_set_line_position() API function for subtitle position
wm4 [Sat, 29 Sep 2012 20:24:01 +0000 (22:24 +0200)]
Add ass_set_line_position() API function for subtitle position

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.

11 years agoFix \fay when used with multiline subs
wm4 [Sat, 29 Sep 2012 20:12:17 +0000 (22:12 +0200)]
Fix \fay when used with multiline subs

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.

11 years agoFix issues with shearing in combination with scaling
wm4 [Sat, 29 Sep 2012 19:45:59 +0000 (21:45 +0200)]
Fix issues with shearing in combination with scaling

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).

11 years agoTerminate drawings immediately on a \p0 tag
wm4 [Sat, 29 Sep 2012 19:31:23 +0000 (21:31 +0200)]
Terminate drawings immediately on a \p0 tag

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.

11 years agoFix resetting border style with \rSTYLE
wm4 [Sat, 29 Sep 2012 19:27:55 +0000 (21:27 +0200)]
Fix resetting border style with \rSTYLE

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.

12 years agoshaper: fix control character filtering
Grigori Goronzy [Fri, 18 May 2012 23:01:30 +0000 (01:01 +0200)]
shaper: fix control character filtering

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

12 years agoRefactor and fix border generation
Grigori Goronzy [Sat, 21 Apr 2012 01:52:54 +0000 (03:52 +0200)]
Refactor and fix border generation

Make sure to update the border appropriately in the second pass, after
parsing.

12 years agoSupport \rSTYLENAME syntax
Grigori Goronzy [Sun, 11 Mar 2012 05:04:59 +0000 (06:04 +0100)]
Support \rSTYLENAME syntax

This allows to reset to a certain style, instead of the default style
for the current line. For some reason, this was completely missing.

12 years agoLetter spacing is a per-cluster property
Grigori Goronzy [Sun, 2 Oct 2011 22:41:53 +0000 (00:41 +0200)]
Letter spacing is a per-cluster property

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.

12 years agoBump version to 0.10.0 0.10.0
Grigori Goronzy [Sun, 25 Sep 2011 15:56:18 +0000 (17:56 +0200)]
Bump version to 0.10.0

12 years agoRemove unused code for bitmap runs
Grigori Goronzy [Sun, 25 Sep 2011 15:55:50 +0000 (17:55 +0200)]
Remove unused code for bitmap runs

They are going to be reintroduced later.

12 years agoUpdate changelog
Grigori Goronzy [Sun, 25 Sep 2011 15:52:17 +0000 (17:52 +0200)]
Update changelog

12 years agoautoconf: lowercase variables
Grigori Goronzy [Sun, 25 Sep 2011 01:19:39 +0000 (03:19 +0200)]
autoconf: lowercase variables

Use lowercase variable names to avoid bogus "possibly undefined macro"
errors.

12 years agotest: separate linker flags
Grigori Goronzy [Sun, 25 Sep 2011 01:18:29 +0000 (03:18 +0200)]
test: separate linker flags

Use separate linker flags for the test program to avoid unnecessarily
linking the libass library against libpng.

12 years agopkg-config: tailor libass.pc for static-only builds
Grigori Goronzy [Sun, 25 Sep 2011 00:18:20 +0000 (02:18 +0200)]
pkg-config: tailor libass.pc for static-only builds

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.

12 years agoharfbuzz: adjust to API change
Grigori Goronzy [Fri, 23 Sep 2011 23:17:16 +0000 (01:17 +0200)]
harfbuzz: adjust to API change

12 years agoFix x coordinates with PAR correction and left border
Grigori Goronzy [Mon, 29 Aug 2011 18:58:14 +0000 (20:58 +0200)]
Fix x coordinates with PAR correction and left border

This is a bit hacky, but I'm planning to rewrite positioning in a
much cleaner way. Addresses GC issue #27.

12 years agoharfbuzz: adjust to hb_buffer_t API change
Grigori Goronzy [Mon, 29 Aug 2011 18:22:37 +0000 (20:22 +0200)]
harfbuzz: adjust to hb_buffer_t API change

12 years agoAdd changelog for 0.10.0
Grigori Goronzy [Mon, 29 Aug 2011 17:26:32 +0000 (19:26 +0200)]
Add changelog for 0.10.0

12 years agoFix off-by-one error in \fad, \fade
Grigori Goronzy [Mon, 29 Aug 2011 17:15:31 +0000 (19:15 +0200)]
Fix off-by-one error in \fad, \fade

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.

12 years agoFix drawing leak on cache hit
Grigori Goronzy [Mon, 29 Aug 2011 10:06:29 +0000 (12:06 +0200)]
Fix drawing leak on cache hit

This was introduced by the new cache code.

12 years agovertical: improve glyph positioning
Grigori Goronzy [Thu, 25 Aug 2011 01:48:18 +0000 (03:48 +0200)]
vertical: improve glyph positioning

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

12 years agoharfbuzz: fix vertical advance
Grigori Goronzy [Thu, 25 Aug 2011 01:45:54 +0000 (03:45 +0200)]
harfbuzz: fix vertical advance

Make sure to use vertical advance under the right conditions -
vertical font selected, requested glyph is non-latin.

12 years agoNicer initialization messages
Grigori Goronzy [Sun, 21 Aug 2011 22:38:34 +0000 (00:38 +0200)]
Nicer initialization messages

Adjust the renderer initialization messages and get rid of a rather
useless message, FreeType headers version.

12 years agoopaque box: avoid unnecessary outline copy
Grigori Goronzy [Sun, 21 Aug 2011 22:21:50 +0000 (00:21 +0200)]
opaque box: avoid unnecessary outline copy

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".

12 years agoFix and simplify opaque box border
Grigori Goronzy [Sun, 21 Aug 2011 22:17:45 +0000 (00:17 +0200)]
Fix and simplify opaque box border

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.

12 years agoDeterministic bitmap loading
Grigori Goronzy [Mon, 15 Aug 2011 15:28:13 +0000 (17:28 +0200)]
Deterministic bitmap loading

This is similar to the earlier change, but for bitmaps.

12 years agoDeterministic outline glyph loading
Grigori Goronzy [Wed, 10 Aug 2011 06:57:02 +0000 (08:57 +0200)]
Deterministic outline glyph loading

Make sure to always load and process outlines the same way, no matter if
cached or not.

12 years agoAdd compile time switch for HarfBuzz support
Grigori Goronzy [Sun, 7 Aug 2011 23:09:24 +0000 (01:09 +0200)]
Add compile time switch for HarfBuzz support

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.

12 years agoRuntime shaper selection
Grigori Goronzy [Sun, 7 Aug 2011 22:22:32 +0000 (00:22 +0200)]
Runtime shaper selection

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.

12 years agoAdjust italic to non-italic style spacing
Grigori Goronzy [Sat, 6 Aug 2011 18:06:54 +0000 (20:06 +0200)]
Adjust italic to non-italic style spacing

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.

12 years agoRemove a bunch of debug printf calls
Grigori Goronzy [Thu, 4 Aug 2011 21:52:27 +0000 (23:52 +0200)]
Remove a bunch of debug printf calls

Shaping works well now, they aren't needed anymore.

12 years agoSupport language hint in the Script Info section
Grigori Goronzy [Mon, 1 Aug 2011 13:51:27 +0000 (15:51 +0200)]
Support language hint in the Script Info section

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.

12 years agoharfbuzz: cache glyph metrics
Grigori Goronzy [Fri, 29 Jul 2011 02:21:48 +0000 (04:21 +0200)]
harfbuzz: cache glyph metrics

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.

12 years agoFix crash in ass_set_style_overrides
Grigori Goronzy [Thu, 28 Jul 2011 21:58:12 +0000 (23:58 +0200)]
Fix crash in ass_set_style_overrides

Set pointer to the style overrides to NULL to make sure a freed buffer
will not be accessed anymore later. Reported by uau.

12 years agoAxe misleading comment, reordering works fine
Grigori Goronzy [Sun, 24 Jul 2011 22:17:18 +0000 (00:17 +0200)]
Axe misleading comment, reordering works fine

12 years agoDisable reordering of non-spacing marks
Grigori Goronzy [Sun, 24 Jul 2011 22:00:53 +0000 (00:00 +0200)]
Disable reordering of non-spacing marks

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.

12 years agoDon't extend face runs as much as possible
Grigori Goronzy [Thu, 21 Jul 2011 23:55:09 +0000 (01:55 +0200)]
Don't extend face runs as much as possible

This leads to fewer shaping runs, but has many unwanted side effects.

12 years agoUpdate HarfBuzz' font metrics
Grigori Goronzy [Thu, 21 Jul 2011 23:54:00 +0000 (01:54 +0200)]
Update HarfBuzz' font metrics

12 years agoHack: return a valid face index even if no glyph is found
Grigori Goronzy [Sun, 17 Jul 2011 16:38:31 +0000 (18:38 +0200)]
Hack: return a valid face index even if no glyph is found

Temporary fix for a crash when a font face doesn't actually contain
the glyph that fontconfig reports. Needs a real solution.

12 years agoFix crash with FreeType's updated stroker
Grigori Goronzy [Sun, 17 Jul 2011 15:43:55 +0000 (17:43 +0200)]
Fix crash with FreeType's updated stroker

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.

12 years agoFix line counting and breaking
Grigori Goronzy [Sun, 17 Jul 2011 11:53:29 +0000 (13:53 +0200)]
Fix line counting and breaking

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.

12 years agoSet requested font face correctly
Grigori Goronzy [Sat, 16 Jul 2011 01:13:26 +0000 (03:13 +0200)]
Set requested font face correctly