bug 969814 - build freetype with support for color bitmap (png) glyphs within opentype fonts. r=ted,jrmuizel
authorJonathan Kew <jkew@mozilla.com>
Tue, 04 Mar 2014 05:37:40 +0000
changeset 189894 6e8140ae496122019efa2139b2000d23cf1c3d6e
parent 189893 bfb989c28ffbca08b62118d1e28527adc5a1792c
child 189895 b0d1c4456b730aeb3276d0ff089da541f69ec994
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted, jrmuizel
bugs969814
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 969814 - build freetype with support for color bitmap (png) glyphs within opentype fonts. r=ted,jrmuizel
configure.in
media/libpng/mozpngconf.h
widget/gonk/libdisplay/BootAnimation.cpp
--- a/configure.in
+++ b/configure.in
@@ -947,17 +947,17 @@ IMPORT_LIB_SUFFIX=
 TARGET_MD_ARCH=unix
 DIRENT_INO=d_ino
 MOZ_USER_DIR=".mozilla"
 
 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)'
 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
 XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/bin)'
 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS)'
 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
@@ -8922,18 +8922,20 @@ fi
 
 # Run freetype configure script
 
 if test "$MOZ_TREE_FREETYPE"; then
    export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
    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
    fi
 
    AC_OUTPUT_SUBDIRS(modules/freetype2)
 fi
 
--- a/media/libpng/mozpngconf.h
+++ b/media/libpng/mozpngconf.h
@@ -61,29 +61,35 @@
 #define PNG_READ_COMPRESSED_TEXT_SUPPORTED
 #define PNG_READ_EXPAND_SUPPORTED
 #define PNG_READ_GAMMA_SUPPORTED
 #define PNG_READ_GRAY_TO_RGB_SUPPORTED
 #define PNG_READ_INTERLACING_SUPPORTED
 #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
 #define PNG_WRITE_APNG_SUPPORTED
 #define PNG_WRITE_tRNS_SUPPORTED
 #define PNG_WRITE_16BIT_SUPPORTED
 #define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
 #define PNG_WRITE_FLUSH_SUPPORTED
@@ -104,21 +110,18 @@
 #define PNG_16BIT_SUPPORTED
 #define PNG_CHECK_cHRM_SUPPORTED
 #define PNG_FLOATING_ARITHMETIC_SUPPORTED
 #define PNG_FLOATING_POINT_SUPPORTED
 #define PNG_POINTER_INDEXING_SUPPORTED
 #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
    library a different name such as "mozlibpng" instead of "libpng". */
 
 /* The following has been present since libpng-0.88, has never changed, and
    is unaffected by conditional compilation macros.  It will not be mangled
    and it is the only choice for use in configure scripts for detecting the
@@ -639,21 +642,27 @@
 #define png_icc_check_length                      MOZ_PNG_icc_check_length
 #define png_icc_check_tag_table                   MOZ_PNG_icc_check_tags
 #define png_icc_set_sRGB                          MOZ_PNG_icc_set_sRGB
 #define png_malloc_array                          MOZ_PNG_malloc_array
 #define png_malloc_base                           MOZ_PNG_malloc_base
 #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
 #define png_chunk_warning               MOZ_PNG_chunk_warn
 #define png_warning_parameter           MOZ_PNG_warn_param
 #define png_warning_parameter_signed    MOZ_PNG_warn_param_signed
 #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 */
--- a/widget/gonk/libdisplay/BootAnimation.cpp
+++ b/widget/gonk/libdisplay/BootAnimation.cpp
@@ -262,17 +262,17 @@ struct RawReadState {
     uint32_t length;
 };
 
 static void
 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;
 }
 
 static void
 TransformTo565(png_structp png_ptr, png_row_infop row_info, png_bytep data)
 {