bug 969814 - build freetype with support for color bitmap (png) glyphs within opentype fonts. r=ted,jrmuizel

This commit is contained in:
Jonathan Kew 2014-03-04 05:37:40 +00:00
parent 111bb9f2cc
commit da8b708514
3 changed files with 23 additions and 12 deletions

View File

@ -952,7 +952,7 @@ MOZ_JPEG_CFLAGS=
MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
MOZ_BZ2_CFLAGS=
MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
MOZ_PNG_CFLAGS=
MOZ_PNG_CFLAGS="-I$_objdir/dist/include" # needed for freetype compilation
MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
@ -8927,8 +8927,10 @@ if test "$MOZ_TREE_FREETYPE"; then
export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
export LIBPNG_CFLAGS="$MOZ_PNG_CFLAGS"
export LIBPNG_LDFLAGS="$MOZ_PNG_LIBS"
export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --without-png"
ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
if ! test -e modules; then
mkdir modules

View File

@ -66,19 +66,25 @@
#define PNG_READ_SCALE_16_TO_8_SUPPORTED
#define PNG_READ_TRANSFORMS_SUPPORTED
/* necessary for boot animation code */
/* necessary for freetype color bitmap support (Android & B2G)
and boot animation code (Gonk) */
#if defined(ANDROID) || defined(FT_CONFIG_OPTION_USE_PNG)
#define PNG_READ_PACK_SUPPORTED
#define PNG_READ_FILLER_SUPPORTED
#define PNG_READ_STRIP_16_TO_8_SUPPORTED
#define PNG_READ_USER_TRANSFORM_SUPPORTED
#define PNG_SEQUENTIAL_READ_SUPPORTED
#endif
/* necessary for boot animation code (Gonk) */
#ifdef MOZ_WIDGET_GONK
#define PNG_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
#define PNG_EASY_ACCESS_SUPPORTED
#define PNG_READ_BGR_SUPPORTED
#define PNG_READ_FILLER_SUPPORTED
#define PNG_READ_GRAY_TO_RGB_SUPPORTED
#define PNG_READ_STRIP_16_TO_8_SUPPORTED
#define PNG_READ_STRIP_ALPHA_SUPPORTED
#define PNG_READ_USER_TRANSFORM_SUPPORTED
#define PNG_SEQUENTIAL_READ_SUPPORTED
#endif
#define PNG_WRITE_SUPPORTED
@ -109,11 +115,8 @@
#define PNG_SETJMP_SUPPORTED
#define PNG_STDIO_SUPPORTED
#define PNG_TEXT_SUPPORTED
#ifdef PR_LOGGING
#define PNG_ERROR_TEXT_SUPPORTED
#define PNG_WARNINGS_SUPPORTED
#endif
/* Mangle names of exported libpng functions so different libpng versions
can coexist. It is recommended that if you do this, you give your
@ -644,9 +647,11 @@
#define png_realloc_array MOZ_PNG_realloc_array
#define png_zstream_error MOZ_PNG_zstream_error
/* needed by FreeType's PNG support */
#define png_error MOZ_PNG_error
#if defined(PR_LOGGING) && defined(PNG_WARNINGS_SUPPORTED)
#define png_warning MOZ_PNG_warning
#define png_error MOZ_PNG_error
#define png_chunk_error MOZ_PNG_chunk_err
#define png_fixed_error MOZ_PNG_fixed_err
#define png_formatted_warning MOZ_PNG_formatted_warning
@ -656,4 +661,8 @@
#define png_warning_parameter_unsigned MOZ_PNG_warn_param_unsigned
#endif
#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
#define png_set_packing MOZ_PNG_set_packing
#endif
#endif /* MOZPNGCONF_H */

View File

@ -267,7 +267,7 @@ RawReader(png_structp png_ptr, png_bytep data, png_size_t length)
{
RawReadState *state = (RawReadState *)png_get_io_ptr(png_ptr);
if (length > (state->length - state->offset))
png_err(png_ptr);
png_error(png_ptr, "PNG read overrun");
memcpy(data, state->start + state->offset, length);
state->offset += length;