Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: third_party/harfbuzz/src/harfbuzz-shaper.cpp

Issue 543067: linux: hack around arabic advances in harfbuzz (Closed)
Patch Set: with comments Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/harfbuzz/src/harfbuzz-shaper.cpp
diff --git a/third_party/harfbuzz/src/harfbuzz-shaper.cpp b/third_party/harfbuzz/src/harfbuzz-shaper.cpp
index 2b0dfde78c1608cc90c1dc386e8f2bcf77cff0e3..23ab5ed1705ea6fd081b9187adf5390428eab738 100644
--- a/third_party/harfbuzz/src/harfbuzz-shaper.cpp
+++ b/third_party/harfbuzz/src/harfbuzz-shaper.cpp
@@ -1189,6 +1189,24 @@ HB_Bool HB_OpenTypeShape(HB_ShaperItem *item, const hb_uint32 *properties)
return true;
}
+/* See comments near the definition of HB_ShaperFlag_ArabicHack for a description
+ of why this function exists. */
+void HB_FixupArabicZeroWidth(HB_ShaperItem *item)
+{
+ HB_UShort property;
+
+ if (!item->face->gdef)
+ return;
+
+ for (unsigned int i = 0; i < item->num_glyphs; ++i) {
+ /* If the glyph is a mark, force its advance to zero. */
+ if (HB_GDEF_Get_Glyph_Property (item->face->gdef, item->glyphs[i], &property) == HB_Err_Ok &&
+ property == HB_GDEF_MARK) {
+ item->advances[i] = 0;
+ }
+ }
+}
+
HB_Bool HB_OpenTypePosition(HB_ShaperItem *item, int availableGlyphs, HB_Bool doLogClusters)
{
HB_Face face = item->face;
@@ -1203,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_ArabicHack)
+ HB_FixupArabicZeroWidth(item);
return true; // nothing to do for us
}
« third_party/harfbuzz/src/harfbuzz-arabic.c ('K') | « third_party/harfbuzz/src/harfbuzz-shaper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698