summaryrefslogtreecommitdiff
path: root/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-01-12 02:51:24 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-01-12 02:51:24 +0000
commitf4b76f9ebfdadf174da0ada9d6d48c71e40bf47d (patch)
tree05a56603ca545d76c472e88e29f6965a633a74e6 /Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc
parent898a1072f4da7265e034b9c0d5282f76e724a3ba (diff)
harfbuzz 1.1.3
git-svn-id: svn://tug.org/texlive/trunk@39361 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc')
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc41
1 files changed, 22 insertions, 19 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc
index 50754771409..4da8990558a 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc
@@ -223,7 +223,6 @@ collect_features_arabic (hb_ot_shape_planner_t *plan)
map->add_gsub_pause (arabic_fallback_shape);
map->add_global_bool_feature (HB_TAG('c','a','l','t'));
- map->add_gsub_pause (NULL);
/* The spec includes 'cswh'. Earlier versions of Windows
* used to enable this by default, but testing suggests
@@ -233,6 +232,7 @@ collect_features_arabic (hb_ot_shape_planner_t *plan)
* Note that IranNastaliq uses this feature extensively
* to fixup broken glyph sequences. Oh well...
* Test case: U+0643,U+0640,U+0631. */
+ //map->add_gsub_pause (NULL);
//map->add_global_bool_feature (HB_TAG('c','s','w','h'));
map->add_global_bool_feature (HB_TAG('m','s','e','t'));
}
@@ -463,10 +463,6 @@ apply_stch (const hb_ot_shape_plan_t *plan,
* Second pass applies the stretch, copying things to the end of buffer.
*/
- /* 30 = 2048 / 70.
- * https://www.microsoft.com/typography/cursivescriptguidelines.mspx */
- hb_position_t overlap = font->x_scale / 30;
- DEBUG_MSG (ARABIC, NULL, "overlap for stretching is %d", overlap);
int sign = font->x_scale < 0 ? -1 : +1;
unsigned int extra_glyphs_needed = 0; // Set during MEASURE, used during CUT
typedef enum { MEASURE, CUT } step_t;
@@ -504,18 +500,15 @@ apply_stch (const hb_ot_shape_plan_t *plan,
hb_in_range<unsigned> (info[i - 1].arabic_shaping_action(), STCH_FIXED, STCH_REPEATING))
{
i--;
- hb_glyph_extents_t extents;
- if (!font->get_glyph_extents (info[i].codepoint, &extents))
- extents.width = 0;
- extents.width -= overlap;
+ hb_position_t width = font->get_glyph_h_advance (info[i].codepoint);
if (info[i].arabic_shaping_action() == STCH_FIXED)
{
- w_fixed += extents.width;
+ w_fixed += width;
n_fixed++;
}
else
{
- w_repeating += extents.width;
+ w_repeating += width;
n_repeating++;
}
}
@@ -540,9 +533,20 @@ apply_stch (const hb_ot_shape_plan_t *plan,
/* Number of additional times to repeat each repeating tile. */
int n_copies = 0;
- hb_position_t w_remaining = w_total - w_fixed - overlap;
+ hb_position_t w_remaining = w_total - w_fixed;
if (sign * w_remaining > sign * w_repeating && sign * w_repeating > 0)
- n_copies = (sign * w_remaining + sign * w_repeating / 4) / (sign * w_repeating) - 1;
+ n_copies = (sign * w_remaining) / (sign * w_repeating) - 1;
+
+ /* See if we can improve the fit by adding an extra repeat and squeezing them together a bit. */
+ hb_position_t extra_repeat_overlap = 0;
+ hb_position_t shortfall = sign * w_remaining - sign * w_repeating * (n_copies + 1);
+ if (shortfall > 0)
+ {
+ ++n_copies;
+ hb_position_t excess = (n_copies + 1) * sign * w_repeating - sign * w_remaining;
+ if (excess > 0)
+ extra_repeat_overlap = excess / (n_copies * n_repeating);
+ }
if (step == MEASURE)
{
@@ -551,13 +555,10 @@ apply_stch (const hb_ot_shape_plan_t *plan,
}
else
{
- hb_position_t x_offset = -overlap;
+ hb_position_t x_offset = 0;
for (unsigned int k = end; k > start; k--)
{
- hb_glyph_extents_t extents;
- if (!font->get_glyph_extents (info[k - 1].codepoint, &extents))
- extents.width = 0;
- extents.width -= overlap;
+ hb_position_t width = font->get_glyph_h_advance (info[k - 1].codepoint);
unsigned int repeat = 1;
if (info[k - 1].arabic_shaping_action() == STCH_REPEATING)
@@ -567,7 +568,9 @@ apply_stch (const hb_ot_shape_plan_t *plan,
repeat, info[k - 1].codepoint, j);
for (unsigned int n = 0; n < repeat; n++)
{
- x_offset -= extents.width;
+ x_offset -= width;
+ if (n > 0)
+ x_offset += extra_repeat_overlap;
pos[k - 1].x_offset = x_offset;
/* Append copy. */
--j;