summaryrefslogtreecommitdiffstats
path: root/third_party
diff options
context:
space:
mode:
authormichaelbai@chromium.org <michaelbai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-14 06:58:26 +0000
committermichaelbai@chromium.org <michaelbai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-14 06:58:26 +0000
commit1a2fc6e11cbbf59450c9e10b67e16a53e82de319 (patch)
treec92d3b749f543a612b8f4daab66dc21d31abb95e /third_party
parent8b8e65e8b99bd83726a0703a149cf6123a41798c (diff)
downloadchromium_src-1a2fc6e11cbbf59450c9e10b67e16a53e82de319.zip
chromium_src-1a2fc6e11cbbf59450c9e10b67e16a53e82de319.tar.gz
chromium_src-1a2fc6e11cbbf59450c9e10b67e16a53e82de319.tar.bz2
Fix the warnings when compiling harfbuzz with clang in Android, the warnings were:
third_party/harfbuzz/contrib/harfbuzz-freetype.c:26:57: error: incompatible pointer types passing 'size_t *' (aka 'unsigned int *') to parameter of type 'ssize_t *' (aka 'long *') [-Werror,-Wincompatible-pointer-types] const uint32_t cp = utf16_to_code_point(chars, len, &i); ^~ third_party/harfbuzz/contrib/harfbuzz-unicode.h:22:74: note: passing argument to parameter 'iter' here uint32_t utf16_to_code_point(const uint16_t *chars, size_t len, ssize_t *iter); ^ third_party/harfbuzz/contrib/harfbuzz-freetype.c:58:57: error: incompatible pointer types passing 'size_t *' (aka 'unsigned int *') to parameter of type 'ssize_t *' (aka 'long *') [-Werror,-Wincompatible-pointer-types] const uint32_t cp = utf16_to_code_point(chars, len, &i); ^~ third_party/harfbuzz/contrib/harfbuzz-unicode.h:22:74: note: passing argument to parameter 'iter' here uint32_t utf16_to_code_point(const uint16_t *chars, size_t len, ssize_t *iter); BUG=143931 Review URL: https://chromiumcodereview.appspot.com/10928152 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156760 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r--third_party/harfbuzz/README.chromium2
-rw-r--r--third_party/harfbuzz/chromium.patch48
-rw-r--r--third_party/harfbuzz/contrib/harfbuzz-freetype.c5
3 files changed, 41 insertions, 14 deletions
diff --git a/third_party/harfbuzz/README.chromium b/third_party/harfbuzz/README.chromium
index bbdb425..8edc36e 100644
--- a/third_party/harfbuzz/README.chromium
+++ b/third_party/harfbuzz/README.chromium
@@ -21,3 +21,5 @@ the checked-in copy of the source.)
Added support for building on Android.
The patch for Arabic alignment bug was added (bug 105685).
+
+Added patch for compiling with clang ARM for Android.
diff --git a/third_party/harfbuzz/chromium.patch b/third_party/harfbuzz/chromium.patch
index 91f99fc..371c6e6 100644
--- a/third_party/harfbuzz/chromium.patch
+++ b/third_party/harfbuzz/chromium.patch
@@ -29,19 +29,19 @@ index 51f839a..af40bf8 100644
@@ -1107,6 +1107,7 @@ HB_Bool HB_ArabicShape(HB_ShaperItem *item)
assert(item->item.script == HB_Script_Arabic || item->item.script == HB_Script_Syriac
|| item->item.script == HB_Script_Nko);
-
+
+ item->shaperFlags |= HB_ShaperFlag_ForceMarksToZeroWidth;
#ifndef NO_OPENTYPE
-
+
if (HB_SelectScript(item, item->item.script == HB_Script_Arabic ? arabic_features : syriac_features)) {
diff --git a/src/harfbuzz-shaper.cpp b/src/harfbuzz-shaper.cpp
index 7fd04a9..66f0ea6 100644
--- a/src/harfbuzz-shaper.cpp
+++ b/src/harfbuzz-shaper.cpp
@@ -430,8 +430,6 @@ void HB_HeuristicSetGlyphAttributes(HB_ShaperItem *item)
-
+
// ### zeroWidth and justification are missing here!!!!!
-
+
- assert(item->num_glyphs <= length);
-
// qDebug("QScriptEngine::heuristicSetGlyphAttributes, num_glyphs=%d", item->num_glyphs);
@@ -52,13 +52,13 @@ index 7fd04a9..66f0ea6 100644
++glyph_pos;
}
- assert(glyph_pos == item->num_glyphs);
-
+
// first char in a run is never (treated as) a mark
int cStart = 0;
@@ -1151,10 +1148,12 @@ HB_Bool HB_OpenTypeShape(HB_ShaperItem *item, const hb_uint32 *properties)
return false;
face->tmpLogClusters = tmpLogClusters;
-
+
+ const int itemLength = item->item.length;
+ assert(itemLength > 0);
for (int i = 0; i < face->length; ++i) {
@@ -67,12 +67,12 @@ index 7fd04a9..66f0ea6 100644
- face->tmpLogClusters[i] = item->log_clusters[i];
+ face->tmpLogClusters[i] = i < itemLength ? item->log_clusters[i] : item->log_clusters[itemLength - 1];
}
-
+
#ifdef OT_DEBUG
@@ -1190,6 +1189,24 @@ HB_Bool HB_OpenTypeShape(HB_ShaperItem *item, const hb_uint32 *properties)
return true;
}
-
+
+/* See comments near the definition of HB_ShaperFlag_ForceMarksToZeroWidth for a description
+ of why this function exists. */
+void HB_FixupZeroWidth(HB_ShaperItem *item)
@@ -95,14 +95,14 @@ index 7fd04a9..66f0ea6 100644
{
HB_Face face = item->face;
@@ -1204,6 +1221,8 @@ HB_Bool HB_OpenTypePosition(HB_ShaperItem *item, int availableGlyphs, HB_Bool do
-
+
if (!face->glyphs_substituted && !glyphs_positioned) {
HB_GetGlyphAdvances(item);
+ if (item->face->current_flags & HB_ShaperFlag_ForceMarksToZeroWidth)
+ HB_FixupZeroWidth(item);
return true; // nothing to do for us
}
-
+
diff --git a/src/harfbuzz-shaper.h b/src/harfbuzz-shaper.h
index ab5c07a..72c9aa3 100644
--- a/src/harfbuzz-shaper.h
@@ -118,5 +118,29 @@ index ab5c07a..72c9aa3 100644
+ flag causes us to zero out the advances for mark glyphs. */
+ HB_ShaperFlag_ForceMarksToZeroWidth = 1 << 2
} HB_ShaperFlag;
-
- /*
+
+ /*
+
+diff --git a/third_party/harfbuzz/contrib/harfbuzz-freetype.c b/third_party/harfbuzz
+index a2962df..f6a1e1a 100644
+--- a/third_party/harfbuzz/contrib/harfbuzz-freetype.c
++++ b/third_party/harfbuzz/contrib/harfbuzz-freetype.c
+@@ -21,7 +21,8 @@ hb_freetype_string_to_glyphs(HB_Font font,
+ if (len > *numGlyphs)
+ return 0;
+
+- size_t i = 0, j = 0;
++ ssize_t i = 0;
++ hb_uint32 j = 0;
+ while (i < len) {
+ const uint32_t cp = utf16_to_code_point(chars, len, &i);
+ glyphs[j++] = FT_Get_Char_Index(face, cp);
+@@ -53,7 +54,7 @@ static HB_Bool
+ hb_freetype_can_render(HB_Font font, const HB_UChar16 *chars, hb_uint32 len) {
+ FT_Face face = (FT_Face)font->userData;
+
+- size_t i = 0;
++ ssize_t i = 0;
+ while (i < len) {
+ const uint32_t cp = utf16_to_code_point(chars, len, &i);
+ if (FT_Get_Char_Index(face, cp) == 0)
diff --git a/third_party/harfbuzz/contrib/harfbuzz-freetype.c b/third_party/harfbuzz/contrib/harfbuzz-freetype.c
index a2962df..f6a1e1a 100644
--- a/third_party/harfbuzz/contrib/harfbuzz-freetype.c
+++ b/third_party/harfbuzz/contrib/harfbuzz-freetype.c
@@ -21,7 +21,8 @@ hb_freetype_string_to_glyphs(HB_Font font,
if (len > *numGlyphs)
return 0;
- size_t i = 0, j = 0;
+ ssize_t i = 0;
+ hb_uint32 j = 0;
while (i < len) {
const uint32_t cp = utf16_to_code_point(chars, len, &i);
glyphs[j++] = FT_Get_Char_Index(face, cp);
@@ -53,7 +54,7 @@ static HB_Bool
hb_freetype_can_render(HB_Font font, const HB_UChar16 *chars, hb_uint32 len) {
FT_Face face = (FT_Face)font->userData;
- size_t i = 0;
+ ssize_t i = 0;
while (i < len) {
const uint32_t cp = utf16_to_code_point(chars, len, &i);
if (FT_Get_Char_Index(face, cp) == 0)