Commit 4cb1c583 authored by jshin@chromium.org's avatar jshin@chromium.org

Fix the alignment issue with Arabic when a font has kerning or cursive gsub

Patch by behdad@chromium.org.



Will add a webkit layout test for Arabic alignment as soon as we find
a font that can be included in Webkit LayoutTests.

BUG=105685
TEST= http://www.bbcarabic.com should be rendered the same way as is done by Firefox on Linux. Paragraphs should be right justified and should not overlap with photos or other elements next to them.  See the screenshots attached in the bug report.
TBR=bashik

Review URL: https://chromiumcodereview.appspot.com/10382212

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138001 0039d316-1c4b-4281-b951-d872f2087c98
parent 7f6f1953
...@@ -18,3 +18,5 @@ changes against upstream; you must also apply any changes that you make to ...@@ -18,3 +18,5 @@ changes against upstream; you must also apply any changes that you make to
the checked-in copy of the source.) the checked-in copy of the source.)
Added support for building on Android. Added support for building on Android.
The patch for Arabic alignment bug was added (bug 105685).
...@@ -133,3 +133,26 @@ index 847ac52..6f9a55b 100644 ...@@ -133,3 +133,26 @@ index 847ac52..6f9a55b 100644
static const HB_OpenTypeFeature tibetan_features[] = { static const HB_OpenTypeFeature tibetan_features[] = {
{ HB_MAKE_TAG('c', 'c', 'm', 'p'), CcmpProperty }, { HB_MAKE_TAG('c', 'c', 'm', 'p'), CcmpProperty },
diff --git a/src/harfbuzz-shaper.cpp b/src/harfbuzz-shaper.cpp
index ce4d4ac..6b4d6d2 100644
--- a/src/harfbuzz-shaper.cpp
+++ b/src/harfbuzz-shaper.cpp
@@ -1263,16 +1263,13 @@ HB_Bool HB_OpenTypePosition(HB_ShaperItem *item, int availableGlyphs, HB_Bool do
// (int)(positions[i].x_pos >> 6), (int)(positions[i].y_pos >> 6),
// positions[i].back, positions[i].new_advance);
- HB_Fixed adjustment = (item->item.bidiLevel % 2) ? -positions[i].x_advance : positions[i].x_advance;
+ HB_Fixed adjustment = positions[i].x_advance;
if (!(face->current_flags & HB_ShaperFlag_UseDesignMetrics))
adjustment = HB_FIXED_ROUND(adjustment);
- if (positions[i].new_advance) {
- advances[i] = adjustment;
- } else {
+ if (positions[i].new_advance == 0)
advances[i] += adjustment;
- }
int back = 0;
HB_FixedPoint *offsets = item->offsets;
...@@ -1282,16 +1282,13 @@ HB_Bool HB_OpenTypePosition(HB_ShaperItem *item, int availableGlyphs, HB_Bool do ...@@ -1282,16 +1282,13 @@ HB_Bool HB_OpenTypePosition(HB_ShaperItem *item, int availableGlyphs, HB_Bool do
// (int)(positions[i].x_pos >> 6), (int)(positions[i].y_pos >> 6), // (int)(positions[i].x_pos >> 6), (int)(positions[i].y_pos >> 6),
// positions[i].back, positions[i].new_advance); // positions[i].back, positions[i].new_advance);
HB_Fixed adjustment = (item->item.bidiLevel % 2) ? -positions[i].x_advance : positions[i].x_advance; HB_Fixed adjustment = positions[i].x_advance;
if (!(face->current_flags & HB_ShaperFlag_UseDesignMetrics)) if (!(face->current_flags & HB_ShaperFlag_UseDesignMetrics))
adjustment = HB_FIXED_ROUND(adjustment); adjustment = HB_FIXED_ROUND(adjustment);
if (positions[i].new_advance) { if (positions[i].new_advance == 0)
advances[i] = adjustment;
} else {
advances[i] += adjustment; advances[i] += adjustment;
}
int back = 0; int back = 0;
HB_FixedPoint *offsets = item->offsets; HB_FixedPoint *offsets = item->offsets;
...@@ -1354,4 +1351,3 @@ HB_Bool HB_ShapeItem(HB_ShaperItem *shaper_item) ...@@ -1354,4 +1351,3 @@ HB_Bool HB_ShapeItem(HB_ShaperItem *shaper_item)
shaper_item->glyphIndicesPresent = false; shaper_item->glyphIndicesPresent = false;
return result; return result;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment