Mercurial > hg > icedtea6-hg
changeset 3146:0e26048bb9e3
OJ39: Handle fonts with the non-canonical processing flag set
2014-07-28 Andrew John Hughes <gnu.andrew@redhat.com>
OJ39: Handle fonts with the non-canonical
processing flag set
* Makefile.am:
(ICEDTEA_PATCHES): Add new patch.
* NEWS: Updated.
* patches/openjdk/oj639-handle_fonts_with_no_canon_flag_set.patch:
Sync LETypes.h and LayoutEngine.cpp with 7 versions
in order to support fonts with the no canonical
processing flag.
author | Andrew John Hughes <gnu.andrew@redhat.com> |
---|---|
date | Tue, 29 Jul 2014 01:20:12 +0100 |
parents | 755d4509b7d6 |
children | faaea522af93 |
files | ChangeLog Makefile.am NEWS patches/openjdk/oj639-handle_fonts_with_no_canon_flag_set.patch |
diffstat | 4 files changed, 362 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Jul 24 05:03:40 2014 +0100 +++ b/ChangeLog Tue Jul 29 01:20:12 2014 +0100 @@ -1,3 +1,15 @@ +2014-07-28 Andrew John Hughes <gnu.andrew@redhat.com> + + OJ39: Handle fonts with the non-canonical + processing flag set + * Makefile.am: + (ICEDTEA_PATCHES): Add new patch. + * NEWS: Updated. + * patches/openjdk/oj639-handle_fonts_with_no_canon_flag_set.patch: + Sync LETypes.h and LayoutEngine.cpp with 7 versions + in order to support fonts with the no canonical + processing flag. + 2014-07-23 Andrew John Hughes <gnu.andrew@redhat.com> * NEWS: Add 1.13.4 release notes.
--- a/Makefile.am Thu Jul 24 05:03:40 2014 +0100 +++ b/Makefile.am Tue Jul 29 01:20:12 2014 +0100 @@ -620,7 +620,8 @@ patches/openjdk/6904962-getvisualbounds_affected_by_white_space.patch \ patches/openjdk/6611637-npe_in_glyphlayout.patch \ patches/openjdk/6727719-performance_of_textlayout_getbounds.patch \ - patches/openjdk/6745225-memory_leak_in_attributed_string.patch + patches/openjdk/6745225-memory_leak_in_attributed_string.patch \ + patches/openjdk/oj639-handle_fonts_with_no_canon_flag_set.patch if WITH_RHINO ICEDTEA_PATCHES += \
--- a/NEWS Thu Jul 24 05:03:40 2014 +0100 +++ b/NEWS Tue Jul 29 01:20:12 2014 +0100 @@ -22,6 +22,7 @@ - S7151089: PS NUMA: NUMA allocator should not attempt to free pages when using SHM large pages - S8013057: Detect mmap() commit failures in Linux and Solaris os::commit_memory() impls and call vm_exit_out_of_memory() - S8026887: Make issues due to failed large pages allocations easier to debug + - OJ39: Handle fonts with the non-canonical processing flag set New in release 1.13.4 (2014-07-15):
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/oj639-handle_fonts_with_no_canon_flag_set.patch Tue Jul 29 01:20:12 2014 +0100 @@ -0,0 +1,347 @@ +diff -r 1492971e2155 src/share/native/sun/font/layout/LETypes.h +--- openjdk/jdk/src/share/native/sun/font/layout/LETypes.h Wed Mar 20 13:39:56 2013 -0700 ++++ openjdk/jdk/src/share/native/sun/font/layout/LETypes.h Tue Jul 29 00:40:14 2014 +0100 +@@ -25,7 +25,7 @@ + + /* + * +- * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved ++ * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved + * + */ + +@@ -107,7 +107,7 @@ + */ + typedef int8_t le_int8; + #endif +- ++ + #ifndef HAVE_LE_UINT8 + /** + * A type used for unsigned, 8-bit integers. +@@ -231,38 +231,6 @@ + #define LE_CLIENT_SHIFT 24 + + +-#ifndef LE_ASSERT_BAD_FONT +-#define LE_ASSERT_BAD_FONT 0 +-#endif +- +-#if LE_ASSERT_BAD_FONT +-#include <stdio.h> +-#define LE_DEBUG_BAD_FONT(x) fprintf(stderr,"%s:%d: BAD FONT: %s\n", __FILE__, __LINE__, (x)); +-#else +-#define LE_DEBUG_BAD_FONT(x) +-#endif +- +-/** +- * Max value representable by a uintptr +- */ +- +-#ifndef UINT32_MAX +-#define LE_UINT32_MAX 0xFFFFFFFFU +-#else +-#define LE_UINT32_MAX UINT32_MAX +-#endif +- +-#ifndef UINTPTR_MAX +-#define LE_UINTPTR_MAX LE_UINT32_MAX +-#else +-#define LE_UINTPTR_MAX UINTPTR_MAX +-#endif +- +-/** +- * Range check for overflow +- */ +-#define LE_RANGE_CHECK(type, count, ptrfn) (( (LE_UINTPTR_MAX / sizeof(type)) < count ) ? NULL : (ptrfn)) +- + /** + * A convenience macro to get the Glyph ID part of an LEGlyphID. + * +@@ -312,20 +280,6 @@ + */ + #define LE_SET_CLIENT(gid, client) ((gid & ~LE_CLIENT_MASK) | ((client << LE_CLIENT_SHIFT) & LE_CLIENT_MASK)) + +-/** +- * \def LE_TRACE +- * @internal +- */ +-#ifndef LE_TRACE +-# define LE_TRACE 0 +-#endif +- +-#if LE_TRACE +-# include <stdio.h> +-# define _LETRACE printf("\n%s:%d: LE: ", __FILE__, __LINE__),printf +-#else +-# define _LETRACE 0&& +-#endif + + /** + * Used to represent 16-bit Unicode code points. +@@ -379,7 +333,54 @@ + typedef struct LEPoint LEPoint; + #endif + ++/** ++ * \def LE_TRACE ++ * @internal ++ */ ++#ifndef LE_TRACE ++# define LE_TRACE 0 ++#endif + ++#if LE_TRACE ++# include <stdio.h> ++# define _LETRACE printf("\n%s:%d: LE: ", __FILE__, __LINE__),printf ++#else ++# define _LETRACE 0&& ++#endif ++ ++#ifndef U_HIDE_INTERNAL_API ++ ++#ifndef LE_ASSERT_BAD_FONT ++#define LE_ASSERT_BAD_FONT 0 ++#endif ++ ++#if LE_ASSERT_BAD_FONT ++#include <stdio.h> ++#define LE_DEBUG_BAD_FONT(x) fprintf(stderr,"%s:%d: BAD FONT: %s\n", __FILE__, __LINE__, (x)); ++#else ++#define LE_DEBUG_BAD_FONT(x) ++#endif ++ ++/** ++ * Max value representable by a uintptr ++ */ ++ ++#ifndef UINT32_MAX ++#define LE_UINT32_MAX 0xFFFFFFFFU ++#else ++#define LE_UINT32_MAX UINT32_MAX ++#endif ++ ++#ifndef UINTPTR_MAX ++#define LE_UINTPTR_MAX LE_UINT32_MAX ++#else ++#define LE_UINTPTR_MAX UINTPTR_MAX ++#endif ++ ++/** ++ * Range check for overflow ++ */ ++#define LE_RANGE_CHECK(type, count, ptrfn) (( (LE_UINTPTR_MAX / sizeof(type)) < count ) ? NULL : (ptrfn)) + /** + * A convenience macro to get the length of an array. + * +@@ -401,7 +402,7 @@ + * + * @internal + */ +-#define LE_NEW_ARRAY(type, count) (type *) uprv_malloc((count) * sizeof(type)) ++#define LE_NEW_ARRAY(type, count) (type *) LE_RANGE_CHECK(type,count,uprv_malloc((count) * sizeof(type))) + + /** + * Re-allocate an array of basic types. This is used to isolate the rest of +@@ -418,7 +419,52 @@ + * @internal + */ + #define LE_DELETE_ARRAY(array) uprv_free((void *) (array)) +-#endif ++#else ++/* !LE_USE_CMEMORY - Not using ICU memory - use C std lib versions */ ++ ++#include <stdlib.h> ++#include <string.h> ++ ++/** ++ * A convenience macro to get the length of an array. ++ * ++ * @internal ++ */ ++#define LE_ARRAY_SIZE(array) (sizeof array / sizeof array[0]) ++ ++/** ++ * A convenience macro for copying an array. ++ * ++ * @internal ++ */ ++#define LE_ARRAY_COPY(dst, src, count) memcpy((void *) (dst), (void *) (src), (count) * sizeof (src)[0]) ++ ++/** ++ * Allocate an array of basic types. This is used to isolate the rest of ++ * the LayoutEngine code from cmemory.h. ++ * ++ * @internal ++ */ ++#define LE_NEW_ARRAY(type, count) LE_RANGE_CHECK(type,count,(type *) malloc((count) * sizeof(type))) ++ ++/** ++ * Re-allocate an array of basic types. This is used to isolate the rest of ++ * the LayoutEngine code from cmemory.h. ++ * ++ * @internal ++ */ ++#define LE_GROW_ARRAY(array, newSize) realloc((void *) (array), (newSize) * sizeof (array)[0]) ++ ++ /** ++ * Free an array of basic types. This is used to isolate the rest of ++ * the LayoutEngine code from cmemory.h. ++ * ++ * @internal ++ */ ++#define LE_DELETE_ARRAY(array) free((void *) (array)) ++ ++#endif /* LE_USE_CMEMORY */ ++#endif /* U_HIDE_INTERNAL_API */ + + /** + * A macro to construct the four-letter tags used to +@@ -581,7 +627,7 @@ + LE_RAND_FEATURE_TAG = 0x72616E64UL, /**< 'rand' */ + LE_RLIG_FEATURE_TAG = 0x726C6967UL, /**< 'rlig' */ + LE_RPHF_FEATURE_TAG = 0x72706866UL, /**< 'rphf' */ +- LE_RKRF_FEATURE_TAG = 0x726B7266UL, /**< 'rkrf' */ ++ LE_RKRF_FEATURE_TAG = 0x726B7266UL, /**< 'rkrf' */ + LE_RTBD_FEATURE_TAG = 0x72746264UL, /**< 'rtbd' */ + LE_RTLA_FEATURE_TAG = 0x72746C61UL, /**< 'rtla' */ + LE_RUBY_FEATURE_TAG = 0x72756279UL, /**< 'ruby' */ +@@ -633,6 +679,77 @@ + }; + + /** ++ * @internal ++ */ ++enum LEFeatureENUMs { ++ LE_Kerning_FEATURE_ENUM = 0, /**< Requests Kerning. Formerly LayoutEngine::kTypoFlagKern */ ++ LE_Ligatures_FEATURE_ENUM = 1, /**< Requests Ligatures. Formerly LayoutEngine::kTypoFlagLiga */ ++ LE_NoCanon_FEATURE_ENUM = 2, /**< Requests No Canonical Processing */ ++ LE_CLIG_FEATURE_ENUM, /**< Feature specific enum */ ++ LE_DLIG_FEATURE_ENUM, /**< Feature specific enum */ ++ LE_HLIG_FEATURE_ENUM, /**< Feature specific enum */ ++ LE_LIGA_FEATURE_ENUM, /**< Feature specific enum */ ++ LE_RLIG_FEATURE_ENUM, /**< Feature specific enum */ ++ LE_SMCP_FEATURE_ENUM, /**< Feature specific enum */ ++ LE_FRAC_FEATURE_ENUM, /**< Feature specific enum */ ++ LE_AFRC_FEATURE_ENUM, /**< Feature specific enum */ ++ LE_ZERO_FEATURE_ENUM, /**< Feature specific enum */ ++ LE_SWSH_FEATURE_ENUM, /**< Feature specific enum */ ++ LE_CSWH_FEATURE_ENUM, /**< Feature specific enum */ ++ LE_SALT_FEATURE_ENUM, /**< Feature specific enum */ ++ LE_NALT_FEATURE_ENUM, /**< Feature specific enum */ ++ LE_RUBY_FEATURE_ENUM, /**< Feature specific enum */ ++ LE_SS01_FEATURE_ENUM, /**< Feature specific enum */ ++ LE_SS02_FEATURE_ENUM, /**< Feature specific enum */ ++ LE_SS03_FEATURE_ENUM, /**< Feature specific enum */ ++ LE_SS04_FEATURE_ENUM, /**< Feature specific enum */ ++ LE_SS05_FEATURE_ENUM, /**< Feature specific enum */ ++ LE_SS06_FEATURE_ENUM, /**< Feature specific enum */ ++ LE_SS07_FEATURE_ENUM, /**< Feature specific enum */ ++ ++ LE_CHAR_FILTER_FEATURE_ENUM = 31, /**< Apply CharSubstitutionFilter */ ++ LE_FEATURE_ENUM_MAX = LE_CHAR_FILTER_FEATURE_ENUM ++}; ++ ++ ++/** ++ * Flags for typographic features. ++ * @internal ++ * @{ ++ */ ++#define LE_Kerning_FEATURE_FLAG (1 << LE_Kerning_FEATURE_ENUM) ++#define LE_Ligatures_FEATURE_FLAG (1 << LE_Ligatures_FEATURE_ENUM) ++#define LE_NoCanon_FEATURE_FLAG (1 << LE_NoCanon_FEATURE_ENUM) ++#define LE_CLIG_FEATURE_FLAG (1 << LE_CLIG_FEATURE_ENUM) ++#define LE_DLIG_FEATURE_FLAG (1 << LE_DLIG_FEATURE_ENUM) ++#define LE_HLIG_FEATURE_FLAG (1 << LE_HLIG_FEATURE_ENUM) ++#define LE_LIGA_FEATURE_FLAG (1 << LE_LIGA_FEATURE_ENUM) ++#define LE_RLIG_FEATURE_FLAG (1 << LE_RLIG_FEATURE_ENUM) ++#define LE_SMCP_FEATURE_FLAG (1 << LE_SMCP_FEATURE_ENUM) ++#define LE_FRAC_FEATURE_FLAG (1 << LE_FRAC_FEATURE_ENUM) ++#define LE_AFRC_FEATURE_FLAG (1 << LE_AFRC_FEATURE_ENUM) ++#define LE_ZERO_FEATURE_FLAG (1 << LE_ZERO_FEATURE_ENUM) ++#define LE_SWSH_FEATURE_FLAG (1 << LE_SWSH_FEATURE_ENUM) ++#define LE_CSWH_FEATURE_FLAG (1 << LE_CSWH_FEATURE_ENUM) ++#define LE_SALT_FEATURE_FLAG (1 << LE_SALT_FEATURE_ENUM) ++#define LE_NALT_FEATURE_FLAG (1 << LE_NALT_FEATURE_ENUM) ++#define LE_RUBY_FEATURE_FLAG (1 << LE_RUBY_FEATURE_ENUM) ++#define LE_SS01_FEATURE_FLAG (1 << LE_SS01_FEATURE_ENUM) ++#define LE_SS02_FEATURE_FLAG (1 << LE_SS02_FEATURE_ENUM) ++#define LE_SS03_FEATURE_FLAG (1 << LE_SS03_FEATURE_ENUM) ++#define LE_SS04_FEATURE_FLAG (1 << LE_SS04_FEATURE_ENUM) ++#define LE_SS05_FEATURE_FLAG (1 << LE_SS05_FEATURE_ENUM) ++#define LE_SS06_FEATURE_FLAG (1 << LE_SS06_FEATURE_ENUM) ++#define LE_SS07_FEATURE_FLAG (1 << LE_SS07_FEATURE_ENUM) ++ ++#define LE_CHAR_FILTER_FEATURE_FLAG (1 << LE_CHAR_FILTER_FEATURE_ENUM) ++/** ++ * @} ++ */ ++ ++#define LE_DEFAULT_FEATURE_FLAG (LE_Kerning_FEATURE_FLAG | LE_Ligatures_FEATURE_FLAG) /**< default features */ ++ ++/** + * Error codes returned by the LayoutEngine. + * + * @stable ICU 2.4 +@@ -674,30 +791,6 @@ + #define LE_SUCCESS(code) (U_SUCCESS((UErrorCode)code)) + #endif + +-enum LEFeatureENUMs { +- LE_Kerning_FEATURE_ENUM = 0, +- LE_Ligatures_FEATURE_ENUM = 1, +- LE_CHAR_FILTER_FEATURE_ENUM = 31, +-}; +- +- +-/** +- * Flags for typographic features. +- * @internal +- * @{ +- */ +-#define LE_Kerning_FEATURE_FLAG (1 << LE_Kerning_FEATURE_ENUM) +-#define LE_Ligatures_FEATURE_FLAG (1 << LE_Ligatures_FEATURE_ENUM) +- +-#define LE_CHAR_FILTER_FEATURE_ENUM 31 +- +-#define LE_CHAR_FILTER_FEATURE_FLAG (1 << LE_CHAR_FILTER_FEATURE_ENUM) +-/** +- * @} +- */ +- +-#define LE_DEFAULT_FEATURE_FLAG (LE_Kerning_FEATURE_FLAG | LE_Ligatures_FEATURE_FLAG) /**< default features */ +- + /** + * A convenience macro to test for the failure of a LayoutEngine call. + * +@@ -709,5 +802,3 @@ + + U_NAMESPACE_END + #endif +- +- +diff -r 1492971e2155 src/share/native/sun/font/layout/LayoutEngine.cpp +--- openjdk/jdk/src/share/native/sun/font/layout/LayoutEngine.cpp Wed Mar 20 13:39:56 2013 -0700 ++++ openjdk/jdk/src/share/native/sun/font/layout/LayoutEngine.cpp Tue Jul 29 00:40:14 2014 +0100 +@@ -32,8 +32,8 @@ + + #include "LETypes.h" + #include "LEScripts.h" ++#include "LELanguages.h" + #include "LESwaps.h" +-#include "LELanguages.h" + + #include "LayoutEngine.h" + #include "ArabicLayoutEngine.h" +@@ -252,6 +252,10 @@ + return 0; + } + ++ if ((fTypoFlags & LE_NoCanon_FEATURE_FLAG) == 0) { // no canonical processing ++ return count; ++ } ++ + LEReferenceTo<GlyphSubstitutionTableHeader> canonGSUBTable(LETableReference::kStaticData, + (GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable, + CanonShaping::glyphSubstitutionTableLen);