diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-20 18:55:48 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-20 18:55:48 +0000 |
commit | 09c1548dfc4628f86898818dbb7c032b278c91d5 (patch) | |
tree | 26354c7306108c692ee4d06a3e9c5c34dabbd834 /third_party/harfbuzz | |
parent | e32e1792b61a0183fc48d4ee1cc79b7d8e89f0af (diff) | |
download | chromium_src-09c1548dfc4628f86898818dbb7c032b278c91d5.zip chromium_src-09c1548dfc4628f86898818dbb7c032b278c91d5.tar.gz chromium_src-09c1548dfc4628f86898818dbb7c032b278c91d5.tar.bz2 |
linux: merge newer upstream harfbuzz
This merges includes the following changes. The changes by Adam Langley were
previously in our tree while they were being upstreamed, but since that's now
happened I've removed the changes mentioned in README.google.
Adam Langley (3):
Add contrib/ and initial file set
Add fuzz testing tool.
Make HB_ShaperItem a typedef to a named struct.
Behdad Esfahbod (4):
Fix typo in unused code
Bug 23973 memory leak in _HB_OPEN_Load_EmptyClassDefinition
Bug 23976 memory leak in Free_BaseArray
Bug 24540 arabicSyriacOpenTypeShape causes read past end of string in getArabicProperties
Graham Asher (1):
Improved comments for HB_ShaperItem fields.
BUG=20621
(But it doesn't look like this fixes it, though -- the getArabicProperties
change mentioned in the diff was already available locally)
Review URL: http://codereview.chromium.org/295025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29544 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/harfbuzz')
-rw-r--r-- | third_party/harfbuzz/README.google | 46 | ||||
-rw-r--r-- | third_party/harfbuzz/chromium.patch | 69 | ||||
-rw-r--r-- | third_party/harfbuzz/src/harfbuzz-arabic.c | 2 | ||||
-rw-r--r-- | third_party/harfbuzz/src/harfbuzz-gpos.c | 8 | ||||
-rw-r--r-- | third_party/harfbuzz/src/harfbuzz-hebrew.c | 3 | ||||
-rw-r--r-- | third_party/harfbuzz/src/harfbuzz-open.c | 2 | ||||
-rw-r--r-- | third_party/harfbuzz/src/harfbuzz-shape.h | 2 | ||||
-rw-r--r-- | third_party/harfbuzz/src/harfbuzz-shaper.h | 35 |
8 files changed, 101 insertions, 66 deletions
diff --git a/third_party/harfbuzz/README.google b/third_party/harfbuzz/README.google index b958bde..0fd8980 100644 --- a/third_party/harfbuzz/README.google +++ b/third_party/harfbuzz/README.google @@ -2,48 +2,8 @@ Harfbuzz http://freedesktop.org/wiki/Software/HarfBuzz -This code was taken from cb83c38045a7dd098f8edd4530d328e999a7bbaf +This code was taken from 4db7e36f46b735f8801d393b356f9c8ed41c409c (git://anongit.freedesktop.org/harfbuzz) -The contrib/ directory was written by us and is in the process of getting upstreamed. Additionally, these patches were applied: - - -diff --git a/src/harfbuzz-shaper.h b/src/harfbuzz-shaper.h -index e8f5513..1577b59 100644 ---- a/src/harfbuzz-shaper.h -+++ b/src/harfbuzz-shaper.h -@@ -242,7 +242,9 @@ typedef struct HB_Font_ { - void *userData; - } HB_FontRec; - --typedef struct { -+typedef struct HB_ShaperItem_ HB_ShaperItem; -+ -+struct HB_ShaperItem_ { - const HB_UChar16 *string; - hb_uint32 stringLength; - HB_ScriptItem item; -@@ -262,7 +264,7 @@ typedef struct { - - /* internal */ - HB_Bool kerning_applied; /* out: kerning applied by shaper */ --} HB_ShaperItem; -+}; - - HB_Bool HB_ShapeItem(HB_ShaperItem *item); - - -http://bugs.freedesktop.org/show_bug.cgi?id=24540: -diff --git a/third_party/harfbuzz/src/harfbuzz-arabic.c b/third_party/harfbuzz/src/harfbuzz-arabic.c -index 0609232..de3c1f4 100644 ---- a/third_party/harfbuzz/src/harfbuzz-arabic.c -+++ b/third_party/harfbuzz/src/harfbuzz-arabic.c -@@ -1009,7 +1009,7 @@ static HB_Bool arabicSyriacOpenTypeShape(HB_ShaperItem *item, HB_Bool *ot_ok) - ++l; - ++properties; - } -- if (f + l < item->stringLength) { -+ if (f + l + item->item.pos < item->stringLength) { - ++l; - } - getArabicProperties(uc+f, l, props); +The patch in chromium.patch was applied on top of this; I will talk with +upstream about it. diff --git a/third_party/harfbuzz/chromium.patch b/third_party/harfbuzz/chromium.patch new file mode 100644 index 0000000..3e26566 --- /dev/null +++ b/third_party/harfbuzz/chromium.patch @@ -0,0 +1,69 @@ +diff --git a/third_party/harfbuzz/contrib/harfbuzz-unicode.c b/third_party/harfbuzz/contrib/harfbuzz-unicode.c +index 9b3c43e..51dd4ea 100644 +--- a/third_party/harfbuzz/contrib/harfbuzz-unicode.c ++++ b/third_party/harfbuzz/contrib/harfbuzz-unicode.c +@@ -6,8 +6,9 @@ + #include <harfbuzz-shaper.h> + #include "harfbuzz-unicode.h" + +-#include "tables/script-properties.h" + #include "tables/grapheme-break-properties.h" ++#include "tables/mirroring-properties.h" ++#include "tables/script-properties.h" + + uint32_t + utf16_to_code_point(const uint16_t *chars, size_t len, ssize_t *iter) { +@@ -234,10 +235,30 @@ HB_GetGraphemeAndLineBreakClass(HB_UChar32 ch, HB_GraphemeClass *gclass, HB_Line + *breakclass = HB_GetLineBreakClass(ch); + } + ++static int ++mirroring_property_cmp(const void *vkey, const void *vcandidate) { ++ const uint32_t key = (uint32_t) (intptr_t) vkey; ++ const struct mirroring_property *candidate = vcandidate; ++ ++ if (key < candidate->a) { ++ return -1; ++ } else if (key > candidate->a) { ++ return 1; ++ } else { ++ return 0; ++ } ++} ++ + HB_UChar16 + HB_GetMirroredChar(HB_UChar16 ch) { +- abort(); +- return 0; ++ const void *mprop = bsearch((void *) (intptr_t) ch, mirroring_properties, ++ mirroring_properties_count, ++ sizeof(struct mirroring_property), ++ mirroring_property_cmp); ++ if (!mprop) ++ return ch; ++ ++ return ((const struct mirroring_property *) mprop)->b; + } + + void * +diff --git a/third_party/harfbuzz/src/harfbuzz-shaper.cpp b/third_party/harfbuzz/src/harfbuzz-shaper.cpp +index 36b9282..3628c88 100644 +--- a/third_party/harfbuzz/src/harfbuzz-shaper.cpp ++++ b/third_party/harfbuzz/src/harfbuzz-shaper.cpp +@@ -433,7 +433,7 @@ void HB_HeuristicSetGlyphAttributes(HB_ShaperItem *item) + + // ### zeroWidth and justification are missing here!!!!! + +- assert(item->num_glyphs <= length); ++ assert(length <= item->num_glyphs); + + // qDebug("QScriptEngine::heuristicSetGlyphAttributes, num_glyphs=%d", item->num_glyphs); + HB_GlyphAttributes *attributes = item->attributes; +@@ -451,7 +451,6 @@ void HB_HeuristicSetGlyphAttributes(HB_ShaperItem *item) + } + ++glyph_pos; + } +- assert(glyph_pos == item->num_glyphs); + + // first char in a run is never (treated as) a mark + int cStart = 0; diff --git a/third_party/harfbuzz/src/harfbuzz-arabic.c b/third_party/harfbuzz/src/harfbuzz-arabic.c index de3c1f4..4d85c19 100644 --- a/third_party/harfbuzz/src/harfbuzz-arabic.c +++ b/third_party/harfbuzz/src/harfbuzz-arabic.c @@ -1086,3 +1086,5 @@ HB_Bool HB_ArabicShape(HB_ShaperItem *item) HB_HeuristicPosition(item); return TRUE; } + + diff --git a/third_party/harfbuzz/src/harfbuzz-gpos.c b/third_party/harfbuzz/src/harfbuzz-gpos.c index 1ac3779..356dc01 100644 --- a/third_party/harfbuzz/src/harfbuzz-gpos.c +++ b/third_party/harfbuzz/src/harfbuzz-gpos.c @@ -2059,15 +2059,17 @@ static void Free_BaseArray( HB_BaseArray* ba, HB_BaseRecord *br; HB_Anchor *bans; - HB_UNUSED(num_classes); - if ( ba->BaseRecord ) { br = ba->BaseRecord; if ( ba->BaseCount ) { + HB_UShort i, count; + count = num_classes * ba->BaseCount; bans = br[0].BaseAnchor; + for (i = 0; i < count; i++) + Free_Anchor (&bans[i]); FREE( bans ); } @@ -2723,7 +2725,7 @@ static HB_Error Load_Mark2Array( HB_Mark2Array* m2a, { HB_Error error; - HB_UShort k, m, n, count; + HB_UShort m, n, count; HB_UInt cur_offset, new_offset, base_offset; HB_Mark2Record *m2r; diff --git a/third_party/harfbuzz/src/harfbuzz-hebrew.c b/third_party/harfbuzz/src/harfbuzz-hebrew.c index 2bda386..533a063 100644 --- a/third_party/harfbuzz/src/harfbuzz-hebrew.c +++ b/third_party/harfbuzz/src/harfbuzz-hebrew.c @@ -56,8 +56,6 @@ HB_Bool HB_HebrewShape(HB_ShaperItem *shaper_item) assert(shaper_item->item.script == HB_Script_Hebrew); - HB_HeuristicSetGlyphAttributes(shaper_item); - #ifndef NO_OPENTYPE if (HB_SelectScript(shaper_item, hebrew_features)) { @@ -66,6 +64,7 @@ HB_Bool HB_HebrewShape(HB_ShaperItem *shaper_item) return FALSE; + HB_HeuristicSetGlyphAttributes(shaper_item); HB_OpenTypeShape(shaper_item, /*properties*/0); return HB_OpenTypePosition(shaper_item, availableGlyphs, /*doLogClusters*/TRUE); } diff --git a/third_party/harfbuzz/src/harfbuzz-open.c b/third_party/harfbuzz/src/harfbuzz-open.c index cde5465..0fe1e4d 100644 --- a/third_party/harfbuzz/src/harfbuzz-open.c +++ b/third_party/harfbuzz/src/harfbuzz-open.c @@ -1114,6 +1114,8 @@ _HB_OPEN_Load_EmptyClassDefinition( HB_ClassDefinition* cd ) if ( ALLOC_ARRAY( cd->cd.cd1.ClassValueArray, 1, HB_UShort ) ) return error; + cd->loaded = TRUE; + return HB_Err_Ok; } diff --git a/third_party/harfbuzz/src/harfbuzz-shape.h b/third_party/harfbuzz/src/harfbuzz-shape.h index 4f714a3..e4b5f9a 100644 --- a/third_party/harfbuzz/src/harfbuzz-shape.h +++ b/third_party/harfbuzz/src/harfbuzz-shape.h @@ -161,7 +161,7 @@ typedef enum { /* * Buffer for output */ -typedef struct _HB_GlyphBufer HB_GlyphBuffer; +typedef struct _HB_GlyphBuffer HB_GlyphBuffer; struct _HB_GlyphBuffer { int glyph_item_size; int total_glyphs; diff --git a/third_party/harfbuzz/src/harfbuzz-shaper.h b/third_party/harfbuzz/src/harfbuzz-shaper.h index 1577b59..d2357f4 100644 --- a/third_party/harfbuzz/src/harfbuzz-shaper.h +++ b/third_party/harfbuzz/src/harfbuzz-shaper.h @@ -245,25 +245,26 @@ typedef struct HB_Font_ { typedef struct HB_ShaperItem_ HB_ShaperItem; struct HB_ShaperItem_ { - const HB_UChar16 *string; - hb_uint32 stringLength; - HB_ScriptItem item; - HB_Font font; - HB_Face face; - int shaperFlags; /* HB_ShaperFlags */ - - HB_Bool glyphIndicesPresent; /* set to true if the glyph indicies are already setup in the glyphs array */ - hb_uint32 initialGlyphCount; - - hb_uint32 num_glyphs; /* in: available glyphs out: glyphs used/needed */ - HB_Glyph *glyphs; /* out parameter */ - HB_GlyphAttributes *attributes; /* out */ - HB_Fixed *advances; /* out */ - HB_FixedPoint *offsets; /* out */ - unsigned short *log_clusters; /* out */ + const HB_UChar16 *string; /* input: the Unicode UTF16 text to be shaped */ + hb_uint32 stringLength; /* input: the length of the input in 16-bit words */ + HB_ScriptItem item; /* input: the current run to be shaped: a run of text all in the same script that is a substring of <string> */ + HB_Font font; /* input: the font: scale, units and function pointers supplying glyph indices and metrics */ + HB_Face face; /* input: the shaper state; current script, access to the OpenType tables , etc. */ + int shaperFlags; /* input (unused) should be set to 0; intended to support flags defined in HB_ShaperFlag */ + HB_Bool glyphIndicesPresent; /* input: true if the <glyphs> array contains glyph indices ready to be shaped */ + hb_uint32 initialGlyphCount; /* input: if glyphIndicesPresent is true, the number of glyph indices in the <glyphs> array */ + + hb_uint32 num_glyphs; /* input: capacity of output arrays <glyphs>, <attributes>, <advances>, <offsets>, and <log_clusters>; */ + /* output: required capacity (may be larger than actual capacity) */ + + HB_Glyph *glyphs; /* output: <num_glyphs> indices of shaped glyphs */ + HB_GlyphAttributes *attributes; /* output: <num_glyphs> glyph attributes */ + HB_Fixed *advances; /* output: <num_glyphs> advances */ + HB_FixedPoint *offsets; /* output: <num_glyphs> offsets */ + unsigned short *log_clusters; /* output: for each output glyph, the index in the input of the start of its logical cluster */ /* internal */ - HB_Bool kerning_applied; /* out: kerning applied by shaper */ + HB_Bool kerning_applied; /* output: true if kerning was applied by the shaper */ }; HB_Bool HB_ShapeItem(HB_ShaperItem *item); |