Skip to content

Commit

Permalink
[WIN32] changed: updated libass to v0.10.0. Some nice new features
Browse files Browse the repository at this point in the history
(Bidirectional layout and Arabic shaping) and some bugs fix.
  • Loading branch information
Sébastien Brochet committed Oct 4, 2011
1 parent 400215c commit f8d7684
Show file tree
Hide file tree
Showing 28 changed files with 2,236 additions and 1,213 deletions.
23 changes: 19 additions & 4 deletions lib/libass/Changelog
@@ -1,7 +1,22 @@
libass (0.9.13)
* Fix critical problem with the outline preprocessor, fixes crash with
FreeType 2.4.6
* Various small bugfixes, merged from master
libass (0.10.0)
* Bidirectional layout and Arabic shaping via FriBidi (GC #13)
* OpenType shaping via HarfBuzz-ng (GC #13)
* Add API for shaper configuration
* Add support for `Language' Script Info property, this can be used for
hinting the text language
* Vertical layout improvements
* Use `vert' and `vkna' OpenType features for vertical glyph variants
* Position rotated glyphs onto baseline
* Parse font encoding property for base text direction hinting
* Refactor cache system
* Use generic outlines in place of FreeType glyphs
* Direct outline bitmap rendering
* Fix whitespace trimming (GC #35)
* Do not render border if there's no shadow or glyph (GC #29)
* Adjust spacing after a italic to non-italic style change (GC #37)
* Fix fade timing
* Fix x positioning with borders (GC #27)
* Build system tweaks

libass (0.9.12)
* Switch to permissive (ISC) license
Expand Down
39 changes: 32 additions & 7 deletions lib/libass/configure.ac
@@ -1,4 +1,4 @@
AC_INIT(libass, 0.9.13)
AC_INIT(libass, 0.10.0)
AM_INIT_AUTOMAKE
AC_CONFIG_MACRO_DIR([m4])
# Disable C++/Fortran checks
Expand Down Expand Up @@ -40,13 +40,21 @@ AC_ARG_ENABLE([enca], AS_HELP_STRING([--disable-enca],
[disable enca (charset autodetect) support @<:@default=check@:>@]))
AC_ARG_ENABLE([fontconfig], AS_HELP_STRING([--disable-fontconfig],
[disable fontconfig support @<:@default=enabled@:>@]))
AC_ARG_ENABLE([harfbuzz], AS_HELP_STRING([--disable-harfbuzz],
[disable HarfBuzz support @<:@default=check@:>@]))

PKG_CHECK_MODULES([FREETYPE], freetype2 >= 9.10.3, [
CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
LIBS="$LIBS $FREETYPE_LIBS"
AC_DEFINE(CONFIG_FREETYPE, 1, [found freetype2 via pkg-config])
])

PKG_CHECK_MODULES([FRIBIDI], fribidi >= 0.19.0, [
CFLAGS="$CFLAGS $FRIBIDI_CFLAGS"
LIBS="$LIBS $FRIBIDI_LIBS"
AC_DEFINE(CONFIG_FRIBIDI, 1, [found fribidi via pkg-config])
])

if test x$enable_fontconfig != xno; then
PKG_CHECK_MODULES([FONTCONFIG], fontconfig >= 2.4.2, [
CFLAGS="$CFLAGS $FONTCONFIG_CFLAGS"
Expand All @@ -56,6 +64,15 @@ PKG_CHECK_MODULES([FONTCONFIG], fontconfig >= 2.4.2, [
])
fi

if test x$enable_harfbuzz != xno; then
PKG_CHECK_MODULES([HARFBUZZ], harfbuzz >= 0.7.0, [
CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
LIBS="$LIBS $HARFBUZZ_LIBS"
AC_DEFINE(CONFIG_HARFBUZZ, 1, [found harfbuzz-ng via pkg-config])
harfbuzz=true
], [harfbuzz=false])
fi

if test x$enable_enca != xno; then
PKG_CHECK_MODULES([ENCA], enca, [
CFLAGS="$CFLAGS $ENCA_CFLAGS"
Expand All @@ -69,22 +86,30 @@ libpng=false
if test x$enable_test = xyes; then
PKG_CHECK_MODULES([LIBPNG], libpng >= 1.2.0, [
CFLAGS="$CFLAGS $LIBPNG_CFLAGS"
LIBS="$LIBS $LIBPNG_LIBS"
AC_DEFINE(CONFIG_LIBPNG, 1, [found libpng via pkg-config])
libpng=true])
fi

AM_CONDITIONAL([HAVE_LIBPNG], [test x$libpng = xtrue])

# Add dependent libraries to pkg-config for static linking
PKG_REQUIRES="freetype2 >= 9.6.3"
# add libraries/packages to pkg-config for static linking
pkg_libs="-lm"
pkg_requires="freetype2 >= 9.6.3"
pkg_requires="fribidi >= 0.19.0, ${pkg_requires}"
if test x$enca = xtrue; then
PKG_REQUIRES="enca, ${PKG_REQUIRES}"
pkg_requires="enca, ${pkg_requires}"
fi
if test x$fontconfig = xtrue; then
PKG_REQUIRES="fontconfig >= 2.2.0, ${PKG_REQUIRES}"
pkg_requires="fontconfig >= 2.2.0, ${pkg_requires}"
fi
if test x$harfbuzz = xtrue; then
pkg_requires="harfbuzz >= 0.7.0, ${pkg_requires}"
fi
AC_SUBST([PKG_REQUIRES])

AC_SUBST([PKG_LIBS_DEFAULT], [$(test x$enable_shared = xno && echo ${pkg_libs})])
AC_SUBST([PKG_REQUIRES_DEFAULT], [$(test x$enable_shared = xno && echo ${pkg_requires})])
AC_SUBST([PKG_LIBS_PRIVATE], [$(test x$enable_shared = xno || echo ${pkg_libs})])
AC_SUBST([PKG_REQUIRES_PRIVATE], [$(test x$enable_shared = xno || echo ${pkg_requires})])

# Setup output beautifier.
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Expand Down
7 changes: 4 additions & 3 deletions lib/libass/libass.pc.in
Expand Up @@ -6,7 +6,8 @@ includedir=@includedir@
Name: libass
Description: LibASS is an SSA/ASS subtitles rendering library
Version: @PACKAGE_VERSION@
Requires.private: @PKG_REQUIRES@
Libs: -L${libdir} -lass
Libs.private: -lm
Requires: @PKG_REQUIRES_DEFAULT@
Requires.private: @PKG_REQUIRES_PRIVATE@
Libs: -L${libdir} -lass @PKG_LIBS_DEFAULT@
Libs.private: @PKG_LIBS_PRIVATE@
Cflags: -I${includedir}
3 changes: 2 additions & 1 deletion lib/libass/libass/Makefile.am
Expand Up @@ -10,7 +10,8 @@ libass_la_SOURCES = ass.c ass_cache.c ass_font.c ass_fontconfig.c ass_render.c \
ass_cache.h ass_fontconfig.h ass_font.h ass.h \
ass_library.h ass_types.h ass_utils.h ass_drawing.c \
ass_drawing.h ass_cache_template.h ass_render.h \
ass_parse.c ass_parse.h ass_render_api.c ass_strtod.c
ass_parse.c ass_parse.h ass_render_api.c ass_shaper.c \
ass_shaper.h ass_strtod.c
libass_la_LDFLAGS = -version-info $(LIBASS_LT_CURRENT):$(LIBASS_LT_REVISION):$(LIBASS_LT_AGE)
libass_la_LDFLAGS += -export-symbols $(srcdir)/libass.sym

Expand Down
42 changes: 42 additions & 0 deletions lib/libass/libass/ass.c
Expand Up @@ -30,6 +30,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <inttypes.h>
#include <ctype.h>

#ifdef CONFIG_ICONV
#include <iconv.h>
Expand All @@ -42,6 +43,7 @@
#ifdef _WIN32
#pragma comment(lib, "libiconv.lib")
#pragma comment(lib, "freetype246MT.lib")
#pragma comment(lib, "libfribidi.lib")
#endif

#define ass_atof(STR) (ass_strtod((STR),NULL))
Expand Down Expand Up @@ -76,6 +78,7 @@ void ass_free_track(ASS_Track *track)
}
free(track->style_format);
free(track->event_format);
free(track->Language);
if (track->styles) {
for (i = 0; i < track->n_styles; ++i)
ass_free_style(track, i);
Expand Down Expand Up @@ -602,6 +605,12 @@ static int process_info_line(ASS_Track *track, char *str)
track->ScaledBorderAndShadow = parse_bool(str + 22);
} else if (!strncmp(str, "Kerning:", 8)) {
track->Kerning = parse_bool(str + 8);
} else if (!strncmp(str, "Language:", 9)) {
char *p = str + 9;
while (*p && isspace(*p)) p++;
track->Language = malloc(3);
strncpy(track->Language, p, 2);
track->Language[2] = 0;
}
return 0;
}
Expand Down Expand Up @@ -1276,3 +1285,36 @@ ASS_Track *ass_new_track(ASS_Library *library)
track->parser_priv = calloc(1, sizeof(ASS_ParserPriv));
return track;
}

/**
* \brief Prepare track for rendering
*/
void ass_lazy_track_init(ASS_Library *lib, ASS_Track *track)
{
if (track->PlayResX && track->PlayResY)
return;
if (!track->PlayResX && !track->PlayResY) {
ass_msg(lib, MSGL_WARN,
"Neither PlayResX nor PlayResY defined. Assuming 384x288");
track->PlayResX = 384;
track->PlayResY = 288;
} else {
if (!track->PlayResY && track->PlayResX == 1280) {
track->PlayResY = 1024;
ass_msg(lib, MSGL_WARN,
"PlayResY undefined, setting to %d", track->PlayResY);
} else if (!track->PlayResY) {
track->PlayResY = track->PlayResX * 3 / 4;
ass_msg(lib, MSGL_WARN,
"PlayResY undefined, setting to %d", track->PlayResY);
} else if (!track->PlayResX && track->PlayResY == 1024) {
track->PlayResX = 1280;
ass_msg(lib, MSGL_WARN,
"PlayResX undefined, setting to %d", track->PlayResX);
} else if (!track->PlayResX) {
track->PlayResX = track->PlayResY * 4 / 3;
ass_msg(lib, MSGL_WARN,
"PlayResX undefined, setting to %d", track->PlayResX);
}
}
}
22 changes: 21 additions & 1 deletion lib/libass/libass/ass.h
Expand Up @@ -23,7 +23,7 @@
#include <stdarg.h>
#include "ass_types.h"

#define LIBASS_VERSION 0x00913000
#define LIBASS_VERSION 0x01000000

/*
* A linked list of images produced by an ass renderer.
Expand Down Expand Up @@ -60,6 +60,19 @@ typedef enum {
ASS_HINTING_NATIVE
} ASS_Hinting;

/**
* \brief Text shaping levels.
*
* SIMPLE is a fast, font-agnostic shaper that can do only substitutions.
* COMPLEX is a slower shaper using OpenType for substitutions and positioning.
*
* libass uses the best shaper available by default.
*/
typedef enum {
ASS_SHAPING_SIMPLE = 0,
ASS_SHAPING_COMPLEX
} ASS_ShapingLevel;

/**
* \brief Initialize the library.
* \return library handle or NULL if failed
Expand Down Expand Up @@ -146,6 +159,13 @@ void ass_renderer_done(ASS_Renderer *priv);
*/
void ass_set_frame_size(ASS_Renderer *priv, int w, int h);

/**
* \brief Set shaping level. This is merely a hint, the renderer will use
* whatever is available if the request cannot be fulfilled.
* \param level shaping level
*/
void ass_set_shaper(ASS_Renderer *priv, ASS_ShapingLevel level);

/**
* \brief Set frame margins. These values may be negative if pan-and-scan
* is used.
Expand Down

0 comments on commit f8d7684

Please sign in to comment.