diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-19 00:31:55 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-19 00:31:55 +0000 |
commit | fd367aa0ef3e542ad63e6bb46d0c997b46e27a74 (patch) | |
tree | d29adf96d39fd39aed03a5d444dda6c1df63c272 /third_party/harfbuzz | |
parent | 0f5c815c4ce3a1b970ae4b9a47f4a5001e5ec50c (diff) | |
download | chromium_src-fd367aa0ef3e542ad63e6bb46d0c997b46e27a74.zip chromium_src-fd367aa0ef3e542ad63e6bb46d0c997b46e27a74.tar.gz chromium_src-fd367aa0ef3e542ad63e6bb46d0c997b46e27a74.tar.bz2 |
linux: sync with upstream harfbuzz
Upstream changes are:
fix a few compiler warnings and make the code more exception safe.
correctly support decomposed forms of two or three part matras
fix shaping of assamese ra
fix bug with Malayalam Samvruthokaram.
add N'Ko support to the arabic shaper
Post substitutions should apply to the whole indic syllable
Review URL: http://codereview.chromium.org/408013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32448 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/harfbuzz')
-rw-r--r-- | third_party/harfbuzz/README.google | 2 | ||||
-rw-r--r-- | third_party/harfbuzz/chromium.patch | 93 | ||||
-rw-r--r-- | third_party/harfbuzz/src/harfbuzz-arabic.c | 60 | ||||
-rw-r--r-- | third_party/harfbuzz/src/harfbuzz-impl.c | 4 | ||||
-rw-r--r-- | third_party/harfbuzz/src/harfbuzz-indic.cpp | 137 | ||||
-rw-r--r-- | third_party/harfbuzz/src/harfbuzz-shaper.cpp | 36 | ||||
-rw-r--r-- | third_party/harfbuzz/src/harfbuzz-shaper.h | 2 | ||||
-rw-r--r-- | third_party/harfbuzz/src/harfbuzz-stream.c | 2 |
8 files changed, 192 insertions, 144 deletions
diff --git a/third_party/harfbuzz/README.google b/third_party/harfbuzz/README.google index 0fd8980..74eeb2e 100644 --- a/third_party/harfbuzz/README.google +++ b/third_party/harfbuzz/README.google @@ -2,7 +2,7 @@ Harfbuzz http://freedesktop.org/wiki/Software/HarfBuzz -This code was taken from 4db7e36f46b735f8801d393b356f9c8ed41c409c +This code was taken from b0d396aa88b3cdf8cea896bfeeba197656e1cdb1 (git://anongit.freedesktop.org/harfbuzz) The patch in chromium.patch was applied on top of this; I will talk with diff --git a/third_party/harfbuzz/chromium.patch b/third_party/harfbuzz/chromium.patch index 8e0c827..0f20dfd1 100644 --- a/third_party/harfbuzz/chromium.patch +++ b/third_party/harfbuzz/chromium.patch @@ -1,55 +1,23 @@ -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 +diff --git a/contrib/harfbuzz-unicode.c b/contrib/harfbuzz-unicode.c +index 51dd4ea..cb7a85b 100644 +--- a/contrib/harfbuzz-unicode.c ++++ b/contrib/harfbuzz-unicode.c +@@ -171,7 +171,10 @@ hb_utf16_script_run_prev(unsigned *num_code_points, HB_ScriptItem *output, + current_script = script; + continue; + } else if (script == HB_Script_Inherited) { +- current_script = script; ++ // Just assume that whatever follows this combining character is within ++ // the same script. This is incorrect if you had language1 + combining ++ // char + language 2, but that is rare and this code is suspicious ++ // anyway. + continue; + } else { + *iter = prev_iter; +diff --git a/src/harfbuzz-shaper.cpp b/src/harfbuzz-shaper.cpp +index f3ec8e1..2b0dfde 100644 +--- a/src/harfbuzz-shaper.cpp ++++ b/src/harfbuzz-shaper.cpp @@ -433,7 +433,7 @@ void HB_HeuristicSetGlyphAttributes(HB_ShaperItem *item) // ### zeroWidth and justification are missing here!!!!! @@ -67,24 +35,3 @@ index 36b9282..3628c88 100644 // first char in a run is never (treated as) a mark int cStart = 0; -diff --git a/third_party/harfbuzz/src/harfbuzz-hebrew.c b/third_party/harfbuzz/src/harfbuzz-hebrew.c -index 533a063..2bda386 100644 ---- a/third_party/harfbuzz/src/harfbuzz-hebrew.c -+++ b/third_party/harfbuzz/src/harfbuzz-hebrew.c -@@ -56,6 +56,8 @@ 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)) { - -@@ -64,7 +66,6 @@ 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-arabic.c b/third_party/harfbuzz/src/harfbuzz-arabic.c index 4d85c19..3837087 100644 --- a/third_party/harfbuzz/src/harfbuzz-arabic.c +++ b/third_party/harfbuzz/src/harfbuzz-arabic.c @@ -489,6 +489,56 @@ static void getArabicProperties(const unsigned short *chars, int len, HB_ArabicP */ } +static Joining getNkoJoining(unsigned short uc) +{ + if (uc < 0x7ca) + return JNone; + if (uc <= 0x7ea) + return JDual; + if (uc <= 0x7f3) + return JTransparent; + if (uc <= 0x7f9) + return JNone; + if (uc == 0x7fa) + return JCausing; + return JNone; +} + +static void getNkoProperties(const unsigned short *chars, int len, HB_ArabicProperties *properties) +{ + int lastPos = 0; + int i = 0; + + Joining j = getNkoJoining(chars[0]); + ArabicShape shape = joining_table[XIsolated][j].form2; + properties[0].justification = HB_NoJustification; + + for (i = 1; i < len; ++i) { + properties[i].justification = (HB_GetUnicodeCharCategory(chars[i]) == HB_Separator_Space) ? + ArabicSpace : ArabicNone; + + j = getNkoJoining(chars[i]); + + if (j == JTransparent) { + properties[i].shape = XIsolated; + continue; + } + + properties[lastPos].shape = joining_table[shape][j].form1; + shape = joining_table[shape][j].form2; + + + lastPos = i; + } + properties[lastPos].shape = joining_table[shape][JNone].form1; + + + /* + for (int i = 0; i < len; ++i) + qDebug("nko properties(%d): uc=%x shape=%d, justification=%d", i, chars[i], properties[i].shape, properties[i].justification); + */ +} + /* // The unicode to unicode shaping codec. // does only presentation forms B at the moment, but that should be enough for @@ -1012,7 +1062,10 @@ static HB_Bool arabicSyriacOpenTypeShape(HB_ShaperItem *item, HB_Bool *ot_ok) if (f + l + item->item.pos < item->stringLength) { ++l; } - getArabicProperties(uc+f, l, props); + if (item->item.script == HB_Script_Nko) + getNkoProperties(uc+f, l, props); + else + getArabicProperties(uc+f, l, props); for (i = 0; i < (int)item->num_glyphs; i++) { apply[i] = 0; @@ -1051,7 +1104,8 @@ HB_Bool HB_ArabicShape(HB_ShaperItem *item) HB_Bool haveGlyphs; HB_STACKARRAY(HB_UChar16, shapedChars, item->item.length); - assert(item->item.script == HB_Script_Arabic || item->item.script == HB_Script_Syriac); + assert(item->item.script == HB_Script_Arabic || item->item.script == HB_Script_Syriac + || item->item.script == HB_Script_Nko); #ifndef NO_OPENTYPE @@ -1065,7 +1119,7 @@ HB_Bool HB_ArabicShape(HB_ShaperItem *item) } #endif - if (item->item.script == HB_Script_Syriac) + if (item->item.script != HB_Script_Arabic) return HB_BasicShape(item); shapedString(item->string, item->stringLength, item->item.pos, item->item.length, shapedChars, &slen, diff --git a/third_party/harfbuzz/src/harfbuzz-impl.c b/third_party/harfbuzz/src/harfbuzz-impl.c index 9056a55..ddbf36b 100644 --- a/third_party/harfbuzz/src/harfbuzz-impl.c +++ b/third_party/harfbuzz/src/harfbuzz-impl.c @@ -33,7 +33,7 @@ HB_INTERNAL HB_Pointer _hb_alloc(size_t size, HB_Error *perror ) { - HB_Error error = 0; + HB_Error error = (HB_Error)0; HB_Pointer block = NULL; if ( size > 0 ) @@ -54,7 +54,7 @@ _hb_realloc(HB_Pointer block, HB_Error *perror ) { HB_Pointer block2 = NULL; - HB_Error error = 0; + HB_Error error = (HB_Error)0; block2 = realloc( block, new_size ); if ( block2 == NULL && new_size != 0 ) diff --git a/third_party/harfbuzz/src/harfbuzz-indic.cpp b/third_party/harfbuzz/src/harfbuzz-indic.cpp index 7104d2a..3c9df93 100644 --- a/third_party/harfbuzz/src/harfbuzz-indic.cpp +++ b/third_party/harfbuzz/src/harfbuzz-indic.cpp @@ -419,7 +419,7 @@ static const unsigned char indicForms[0xe00-0x900] = { Matra, Halant, Invalid, Invalid, Invalid, Invalid, Invalid, Invalid, - Invalid, Invalid, Invalid, LengthMark, + Invalid, Invalid, Invalid, Matra, Invalid, Invalid, Invalid, Invalid, Invalid, Invalid, Invalid, Invalid, @@ -566,7 +566,7 @@ static const unsigned char indicPosition[0xe00-0x900] = { None, None, None, None, None, None, None, None, - None, None, None, None, + Below, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, @@ -1050,62 +1050,59 @@ static const IndicOrdering * const indic_order[] = { // vowel matras that have to be split into two parts. static const unsigned short split_matras[] = { - // matra, split1, split2 + // matra, split1, split2, split3 // bengalis - 0x9cb, 0x9c7, 0x9be, - 0x9cc, 0x9c7, 0x9d7, + 0x9cb, 0x9c7, 0x9be, 0x0, + 0x9cc, 0x9c7, 0x9d7, 0x0, // oriya - 0xb48, 0xb47, 0xb56, - 0xb4b, 0xb47, 0xb3e, - 0xb4c, 0xb47, 0xb57, + 0xb48, 0xb47, 0xb56, 0x0, + 0xb4b, 0xb47, 0xb3e, 0x0, + 0xb4c, 0xb47, 0xb57, 0x0, // tamil - 0xbca, 0xbc6, 0xbbe, - 0xbcb, 0xbc7, 0xbbe, - 0xbcc, 0xbc6, 0xbd7, + 0xbca, 0xbc6, 0xbbe, 0x0, + 0xbcb, 0xbc7, 0xbbe, 0x0, + 0xbcc, 0xbc6, 0xbd7, 0x0, // telugu - 0xc48, 0xc46, 0xc56, + 0xc48, 0xc46, 0xc56, 0x0, // kannada - 0xcc0, 0xcbf, 0xcd5, - 0xcc7, 0xcc6, 0xcd5, - 0xcc8, 0xcc6, 0xcd6, - 0xcca, 0xcc6, 0xcc2, - 0xccb, 0xcca, 0xcd5, + 0xcc0, 0xcbf, 0xcd5, 0x0, + 0xcc7, 0xcc6, 0xcd5, 0x0, + 0xcc8, 0xcc6, 0xcd6, 0x0, + 0xcca, 0xcc6, 0xcc2, 0x0, + 0xccb, 0xcc6, 0xcc2, 0xcd5, // malayalam - 0xd4a, 0xd46, 0xd3e, - 0xd4b, 0xd47, 0xd3e, - 0xd4c, 0xd46, 0xd57, + 0xd4a, 0xd46, 0xd3e, 0x0, + 0xd4b, 0xd47, 0xd3e, 0x0, + 0xd4c, 0xd46, 0xd57, 0x0, // sinhala - 0xdda, 0xdd9, 0xdca, - 0xddc, 0xdd9, 0xdcf, - 0xddd, 0xddc, 0xdca, - 0xdde, 0xdd9, 0xddf, + 0xdda, 0xdd9, 0xdca, 0x0, + 0xddc, 0xdd9, 0xdcf, 0x0, + 0xddd, 0xdd9, 0xdcf, 0xdca, + 0xdde, 0xdd9, 0xddf, 0x0, 0xffff }; -static inline void splitMatra(unsigned short *reordered, int matra, int &len, int &base) +static inline void splitMatra(unsigned short *reordered, int matra, int &len) { unsigned short matra_uc = reordered[matra]; //qDebug("matra=%d, reordered[matra]=%x", matra, reordered[matra]); const unsigned short *split = split_matras; while (split[0] < matra_uc) - split += 3; + split += 4; assert(*split == matra_uc); ++split; - if (indic_position(*split) == Pre) { - reordered[matra] = split[1]; - memmove(reordered + 1, reordered, len*sizeof(unsigned short)); - reordered[0] = split[0]; - base++; - } else { - memmove(reordered + matra + 1, reordered + matra, (len-matra)*sizeof(unsigned short)); - reordered[matra] = split[0]; - reordered[matra+1] = split[1]; - } - len++; + int added_chars = split[2] == 0x0 ? 1 : 2; + + memmove(reordered + matra + added_chars, reordered + matra, (len-matra)*sizeof(unsigned short)); + reordered[matra] = split[0]; + reordered[matra+1] = split[1]; + if(added_chars == 2) + reordered[matra+2] = split[2]; + len += added_chars; } #ifndef NO_OPENTYPE @@ -1130,12 +1127,23 @@ static const HB_OpenTypeFeature indic_features[] = { // #define INDIC_DEBUG #ifdef INDIC_DEBUG -#define IDEBUG qDebug +#define IDEBUG hb_debug +#include <stdarg.h> + +static void hb_debug(const char *msg, ...) +{ + va_list ap; + va_start(ap, msg); // use variable arg list + vfprintf(stderr, msg, ap); + va_end(ap); + fprintf(stderr, "\n"); +} + #else #define IDEBUG if(0) printf #endif -#ifdef INDIC_DEBUG +#if 0 //def INDIC_DEBUG static QString propertiesToString(int properties) { QString res; @@ -1244,7 +1252,9 @@ static bool indic_shape_syllable(HB_Bool openType, HB_ShaperItem *item, bool inv // farther than 3 consonants from the end of the syllable. // #### replace the HasReph property by testing if the feature exists in the font! if (form(*uc) == Consonant || (script == HB_Script_Bengali && form(*uc) == IndependentVowel)) { - beginsWithRa = (properties & HasReph) && ((len > 2) && *uc == ra && *(uc+1) == halant); + if ((properties & HasReph) && (len > 2) && + (*uc == ra || *uc == 0x9f0) && *(uc+1) == halant) + beginsWithRa = true; if (beginsWithRa && form(*(uc+2)) == Control) beginsWithRa = false; @@ -1386,12 +1396,12 @@ static bool indic_shape_syllable(HB_Bool openType, HB_ShaperItem *item, bool inv // to be at the beginning of the syllable, so we just move // them there now. if (matra_position == Split) { - splitMatra(uc, matra, len, base); + splitMatra(uc, matra, len); // Handle three-part matras (0xccb in Kannada) matra_position = indic_position(uc[matra]); - if (matra_position == Split) - splitMatra(uc, matra, len, base); - } else if (matra_position == Pre) { + } + + if (matra_position == Pre) { unsigned short m = uc[matra]; while (matra--) uc[matra+1] = uc[matra]; @@ -1541,6 +1551,7 @@ static bool indic_shape_syllable(HB_Bool openType, HB_ShaperItem *item, bool inv | PreSubstProperty | BelowSubstProperty | AboveSubstProperty + | PostSubstProperty | HalantProperty | PositioningProperties); @@ -1598,22 +1609,15 @@ static bool indic_shape_syllable(HB_Bool openType, HB_ShaperItem *item, bool inv // pres always applies // blws always applies // abvs always applies - - // psts - // ### this looks slightly different from before, but I believe it's correct - if (reordered[len-1] != halant || base != len-2) - properties[base] &= ~PostSubstProperty; - for (i = base+1; i < len; ++i) - properties[i] &= ~PostSubstProperty; - + // psts always applies // halant always applies #ifdef INDIC_DEBUG - { - IDEBUG("OT properties:"); - for (int i = 0; i < len; ++i) - qDebug(" i: %s", ::propertiesToString(properties[i]).toLatin1().data()); - } +// { +// IDEBUG("OT properties:"); +// for (int i = 0; i < len; ++i) +// qDebug(" i: %s", ::propertiesToString(properties[i]).toLatin1().data()); +// } #endif // initialize @@ -1731,6 +1735,15 @@ static int indic_nextSyllableBoundary(HB_Script script, const HB_UChar16 *s, int if (script == HB_Script_Bengali && pos == 1 && (uc[0] == 0x0985 || uc[0] == 0x098f)) break; + // Sinhala uses the Halant as a component of certain matras. Allow these, but keep the state on Matra. + if (script == HB_Script_Sinhala && state == Matra) { + ++pos; + continue; + } + if (script == HB_Script_Malayalam && state == Matra && uc[pos-1] == 0x0d41) { + ++pos; + continue; + } goto finish; case Nukta: if (state == Consonant) @@ -1741,12 +1754,16 @@ static int indic_nextSyllableBoundary(HB_Script script, const HB_UChar16 *s, int break; // fall through case VowelMark: - if (state == Matra || state == IndependentVowel) + if (state == Matra || state == LengthMark || state == IndependentVowel) break; // fall through case Matra: if (state == Consonant || state == Nukta) break; + if (state == Matra) { + // ### needs proper testing for correct two/three part matras + break; + } // ### not sure if this is correct. If it is, does it apply only to Bengali or should // it work for all Indic languages? // the combination Independent_A + Vowel Sign AA is allowed. @@ -1762,6 +1779,10 @@ static int indic_nextSyllableBoundary(HB_Script script, const HB_UChar16 *s, int goto finish; case LengthMark: + if (state == Matra) { + // ### needs proper testing for correct two/three part matras + break; + } case IndependentVowel: case Invalid: case Other: diff --git a/third_party/harfbuzz/src/harfbuzz-shaper.cpp b/third_party/harfbuzz/src/harfbuzz-shaper.cpp index 3628c88..2b0dfde 100644 --- a/third_party/harfbuzz/src/harfbuzz-shaper.cpp +++ b/third_party/harfbuzz/src/harfbuzz-shaper.cpp @@ -636,7 +636,9 @@ const HB_ScriptEngine HB_ScriptEngines[] = { // Runic { HB_BasicShape, 0 }, // Khmer - { HB_KhmerShape, HB_KhmerAttributes } + { HB_KhmerShape, HB_KhmerAttributes }, + // N'Ko + { HB_ArabicShape, 0} }; void HB_GetCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength, @@ -876,7 +878,9 @@ static const OTScripts ot_scripts [] = { // Runic { HB_MAKE_TAG('r', 'u', 'n', 'r'), 0 }, // Khmer - { HB_MAKE_TAG('k', 'h', 'm', 'r'), 1 } + { HB_MAKE_TAG('k', 'h', 'm', 'r'), 1 }, + // N'Ko + { HB_MAKE_TAG('n', 'k', 'o', ' '), 1 } }; enum { NumOTScripts = sizeof(ot_scripts)/sizeof(OTScripts) }; @@ -934,7 +938,13 @@ static HB_Stream getTableStream(void *font, HB_GetFontTableFunc tableFunc, HB_Ta if (error) return 0; stream = (HB_Stream)malloc(sizeof(HB_StreamRec)); + if (!stream) + return 0; stream->base = (HB_Byte*)malloc(length); + if (!stream->base) { + free(stream); + return 0; + } error = tableFunc(font, tag, stream->base, &length); if (error) { _hb_close_stream(stream); @@ -949,6 +959,8 @@ static HB_Stream getTableStream(void *font, HB_GetFontTableFunc tableFunc, HB_Ta HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc) { HB_Face face = (HB_Face )malloc(sizeof(HB_FaceRec)); + if (!face) + return 0; face->isSymbolFont = false; face->gdef = 0; @@ -960,6 +972,7 @@ HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc) face->tmpAttributes = 0; face->tmpLogClusters = 0; face->glyphs_substituted = false; + face->buffer = 0; HB_Error error; HB_Stream stream; @@ -995,7 +1008,10 @@ HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc) for (unsigned int i = 0; i < HB_ScriptCount; ++i) face->supported_scripts[i] = checkScript(face, i); - hb_buffer_new(&face->buffer); + if (hb_buffer_new(&face->buffer) != HB_Err_Ok) { + HB_FreeFace(face); + return 0; + } return face; } @@ -1115,6 +1131,8 @@ HB_Bool HB_SelectScript(HB_ShaperItem *shaper_item, const HB_OpenTypeFeature *fe HB_Bool HB_OpenTypeShape(HB_ShaperItem *item, const hb_uint32 *properties) { + HB_GlyphAttributes *tmpAttributes; + unsigned int *tmpLogClusters; HB_Face face = item->face; @@ -1122,8 +1140,16 @@ HB_Bool HB_OpenTypeShape(HB_ShaperItem *item, const hb_uint32 *properties) hb_buffer_clear(face->buffer); - face->tmpAttributes = (HB_GlyphAttributes *) realloc(face->tmpAttributes, face->length*sizeof(HB_GlyphAttributes)); - face->tmpLogClusters = (unsigned int *) realloc(face->tmpLogClusters, face->length*sizeof(unsigned int)); + tmpAttributes = (HB_GlyphAttributes *) realloc(face->tmpAttributes, face->length*sizeof(HB_GlyphAttributes)); + if (!tmpAttributes) + return false; + face->tmpAttributes = tmpAttributes; + + tmpLogClusters = (unsigned int *) realloc(face->tmpLogClusters, face->length*sizeof(unsigned int)); + if (!tmpLogClusters) + return false; + face->tmpLogClusters = tmpLogClusters; + for (int i = 0; i < face->length; ++i) { hb_buffer_add_glyph(face->buffer, item->glyphs[i], properties ? properties[i] : 0, i); face->tmpAttributes[i] = item->attributes[i]; diff --git a/third_party/harfbuzz/src/harfbuzz-shaper.h b/third_party/harfbuzz/src/harfbuzz-shaper.h index d2357f4..f7c7714 100644 --- a/third_party/harfbuzz/src/harfbuzz-shaper.h +++ b/third_party/harfbuzz/src/harfbuzz-shaper.h @@ -62,6 +62,7 @@ typedef enum { HB_Script_Ogham, HB_Script_Runic, HB_Script_Khmer, + HB_Script_Nko, HB_Script_Inherited, HB_ScriptCount = HB_Script_Inherited /* @@ -102,7 +103,6 @@ typedef enum { HB_Script_Cuneiform = Common, HB_Script_Phoenician = Common, HB_Script_PhagsPa = Common, - HB_Script_Nko = Common */ } HB_Script; diff --git a/third_party/harfbuzz/src/harfbuzz-stream.c b/third_party/harfbuzz/src/harfbuzz-stream.c index 3dcee82..2d9638f 100644 --- a/third_party/harfbuzz/src/harfbuzz-stream.c +++ b/third_party/harfbuzz/src/harfbuzz-stream.c @@ -70,7 +70,7 @@ HB_INTERNAL HB_Error _hb_stream_seek( HB_Stream stream, HB_UInt pos ) { - HB_Error error = 0; + HB_Error error = (HB_Error)0; stream->pos = pos; if (pos > stream->size) |