Richard Wordingham | 1 Feb 02:39 2015

Dotted Circles in Tai Tham

I've been having some problems with spurious dotted circles in various
versions of HarfBuzz, and I thought I would share before proposing a
complete solution to Behdad.  I've been looking at 3 versions of
HarfBuzz:

'LibreOffice 4.3.4', i.e. whatever (clearly old) version of HarfBuzz is
in that version of LibreOffice.  I know its old, because
its normalisation orders U+1A60 SAKOT before the tone
marks.  I have lookups in place to ameliorate that problem.

'HarfBuzz 0.9.38+', i.e. the latest sources at some time today.

'New ISC', i.e. HarfBuzz 0.9.38+ plus changes to Indic Syllable
Category (ISC) as I suggested on the Unicode list on 17 May 2014 (post
'Indic Syllable Categories'
http://www.unicode.org/mail-arch/unicode-ml/y2014-m05/0038.html). These
categories are defined in HarfBuzz by file
hb-ot-shape-complex-indic-table.cc.  I was about to formally submit my
suggestions to the Unicode Technical Committee, but then I discovered
that the changes would adversely affect HarfBuzz.

The first problem arose with U+1A7B MAI SAM.  While there
is no problem with its uses to indicate word (or phrase) repetition by
marking the last akshara and to indicate the merger of two 1-consonant
vowelless consonant stacks, a dotted circle occurs in the example
example /thanon/ <U+1A33 HIGH THA, U+1A60 SAKOT, U+1A36 NA, U+1A7B MAI
SAM, U+1A6B SIGN O, U+1A41 RA>.  The problem is that MAI SAM has an ISC
of 'other', so U+25CC in inserted before SIGN O.  Making MAI SAM a
'dependent vowel' as I had suggested fixed this problem.

(Continue reading)

Diederick Huijbers | 29 Jan 13:41 2015
Picon

Testing ligatures, graphemes etc..

Hi, 

I've been working on a textfield with Freetype/Harfbuzz/ICU/OpenGL and
it's in a state where I can start testing it with a bit more interesting strings/fonts.

Does someone knows a couple of good test strings and fonts that I can use to
test my textfield? Important is that my x_advance and caret calculation are 
correct so I'm looking for strings with ligatures, glyphs that are created from multiple
codepoints etc..

Thanks!

_______________________________________________
HarfBuzz mailing list
HarfBuzz <at> lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz
Behdad Esfahbod | 28 Jan 21:42 2015

harfbuzz: Branch 'master' - 3 commits

 src/hb-coretext.cc |   37 +++++++++++++++++++++++++++++--------
 src/hb-ft.cc       |    8 ++++++++
 src/hb-ot-shape.cc |    2 +-
 3 files changed, 38 insertions(+), 9 deletions(-)

New commits:
commit 7888a6b07a9922cedd3e0d235959058e0011357b
Author: Behdad Esfahbod <behdad <at> behdad.org>
Date:   Wed Jan 28 12:40:40 2015 -0800

    [ft] Handle negative scales with vertical writing

diff --git a/src/hb-ft.cc b/src/hb-ft.cc
index f57f566..322f93a 100644
--- a/src/hb-ft.cc
+++ b/src/hb-ft.cc
 <at>  <at>  -118,6 +118,9  <at>  <at>  hb_ft_get_glyph_v_advance (hb_font_t *font HB_UNUSED,
   if (unlikely (FT_Get_Advance (ft_face, glyph, load_flags, &v)))
     return 0;

+  if (font->y_scale < 0)
+    v = -v;
+
   /* Note: FreeType's vertical metrics grows downward while other FreeType coordinates
    * have a Y growing upward.  Hence the extra negation. */
   return (-v + (1<<9)) >> 10;
 <at>  <at>  -154,6 +157,11  <at>  <at>  hb_ft_get_glyph_v_origin (hb_font_t *font HB_UNUSED,
   *x = ft_face->glyph->metrics.horiBearingX -   ft_face->glyph->metrics.vertBearingX;
   *y = ft_face->glyph->metrics.horiBearingY - (-ft_face->glyph->metrics.vertBearingY);

+  if (font->x_scale < 0)
+    *x = -*x;
+  if (font->y_scale < 0)
+    *y = -*y;
+
   return true;
 }

commit 982d94eaa2a377616f22f39427e5ed9f1ce43263
Author: Behdad Esfahbod <behdad <at> behdad.org>
Date:   Wed Jan 28 10:51:33 2015 -0800

    [coretext] Don't generate notdef glyph for default-ignorables

    As discovered on Chrome Mac:
    https://code.google.com/p/chromium/issues/detail?id=452326

diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 4a1e14c..4a45175 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
 <at>  <at>  -897,6 +897,8  <at>  <at>  retry:
 		   * for this one. */
 		  continue;
 	      }
+	      if (buffer->unicode->is_default_ignorable (ch))
+	        continue;

 	      info->codepoint = notdef;
 	      info->cluster = log_clusters[j];
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index a0b503a..07adb04 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
 <at>  <at>  -676,7 +676,7  <at>  <at>  hb_ot_hide_default_ignorables (hb_ot_shape_context_t *c)
 	pos[i].y_advance = 0;
       }
       else
-	continue; /* Delete it. */
+	continue; /* Delete it. XXX Merge clusters? */
     }
     if (j != i)
     {
commit 6917a045fd8d16952cad75fda8b291b11e1d3564
Author: Behdad Esfahbod <behdad <at> behdad.org>
Date:   Wed Jan 28 10:43:32 2015 -0800

    [coretext] Unbreak glyph positioning in presence of notdef runs

    As discovered on Chrome Mac:
    https://code.google.com/p/chromium/issues/detail?id=452326

    This was originally broken in:

    	commit 5a0eed3b50629be4826e4e9428f2c3255195395d
    	Author: Behdad Esfahbod <behdad <at> behdad.org>
    	Date:   Mon Aug 11 23:47:16 2014 -0400

    	    [coretext] Implement vertical shaping

diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 16e069d..4a1e14c 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
 <at>  <at>  -787,6 +787,7  <at>  <at>  retry:

     buffer->len = 0;
     uint32_t status_and = ~0, status_or = 0;
+    double advances_so_far = 0;

     const CFRange range_all = CFRangeMake (0, 0);

 <at>  <at>  -797,6 +798,10  <at>  <at>  retry:
       status_or  |= run_status;
       status_and &= run_status;
       DEBUG_MSG (CORETEXT, run, "CTRunStatus: %x", run_status);
+      double run_advance = CTRunGetTypographicBounds (run, range_all, NULL, NULL, NULL);
+      if (HB_DIRECTION_IS_VERTICAL (buffer->props.direction))
+	  run_advance = -run_advance;
+      DEBUG_MSG (CORETEXT, run, "Run advance: %g", run_advance);

       /* CoreText does automatic font fallback (AKA "cascading") for  characters
        * not supported by the requested font, and provides no way to turn it off,
 <at>  <at>  -905,6 +910,7  <at>  <at>  retry:
 	  }
 	  if (HB_DIRECTION_IS_BACKWARD (buffer->props.direction))
 	    buffer->reverse_range (old_len, buffer->len);
+	  advances_so_far += run_advance;
 	  continue;
 	}
       }
 <at>  <at>  -934,7 +940,7  <at>  <at>  retry:
   scratch_size = scratch_size_saved; \
   scratch = scratch_saved;

-      {
+      { /* Setup glyphs */
         SCRATCH_SAVE();
 	const CGGlyph* glyphs = USE_PTR ? CTRunGetGlyphsPtr (run) : NULL;
 	if (!glyphs) {
 <at>  <at>  -958,6 +964,11  <at>  <at>  retry:
 	SCRATCH_RESTORE();
       }
       {
+        /* Setup positions.
+	 * Note that CoreText does not return advances for glyphs.  As such,
+	 * for all but last glyph, we use the delta position to next glyph as
+	 * advance (in the advance direction only), and for last glyph we set
+	 * whatever is needed to make the whole run's advance add up. */
         SCRATCH_SAVE();
 	const CGPoint* positions = USE_PTR ? CTRunGetPositionsPtr (run) : NULL;
 	if (!positions) {
 <at>  <at>  -965,34 +976,42  <at>  <at>  retry:
 	  CTRunGetPositions (run, range_all, position_buf);
 	  positions = position_buf;
 	}
-	double run_advance = CTRunGetTypographicBounds (run, range_all, NULL, NULL, NULL);
-	DEBUG_MSG (CORETEXT, run, "Run advance: %g", run_advance);
 	hb_glyph_info_t *info = run_info;
 	CGFloat x_mult = font_data->x_mult, y_mult = font_data->y_mult;
 	if (HB_DIRECTION_IS_HORIZONTAL (buffer->props.direction))
 	{
+	  hb_position_t x_offset = (positions[0].x - advances_so_far) * x_mult;
 	  for (unsigned int j = 0; j < num_glyphs; j++)
 	  {
-	    double advance = (j + 1 < num_glyphs ? positions[j + 1].x : positions[0].x + run_advance) - positions[j].x;
+	    double advance;
+	    if (likely (j + 1 < num_glyphs))
+	      advance = positions[j + 1].x - positions[j].x;
+	    else /* last glyph */
+	      advance = run_advance - (positions[j].x - positions[0].x);
 	    info->mask = advance * x_mult;
-	    info->var1.u32 = positions[0].x * x_mult; /* Yes, zero. */
+	    info->var1.u32 = x_offset;
 	    info->var2.u32 = positions[j].y * y_mult;
 	    info++;
 	  }
 	}
 	else
 	{
-	  run_advance = -run_advance;
+	  hb_position_t y_offset = (positions[0].y - advances_so_far) * y_mult;
 	  for (unsigned int j = 0; j < num_glyphs; j++)
 	  {
-	    double advance = (j + 1 < num_glyphs ? positions[j + 1].y : positions[0].y + run_advance) - positions[j].y;
+	    double advance;
+	    if (likely (j + 1 < num_glyphs))
+	      advance = positions[j + 1].y - positions[j].y;
+	    else /* last glyph */
+	      advance = run_advance - (positions[j].y - positions[0].y);
 	    info->mask = advance * y_mult;
 	    info->var1.u32 = positions[j].x * x_mult;
-	    info->var2.u32 = positions[0].y * y_mult; /* Yes, zero. */
+	    info->var2.u32 = y_offset;
 	    info++;
 	  }
 	}
 	SCRATCH_RESTORE();
+	advances_so_far += run_advance;
       }
 #undef SCRATCH_RESTORE
 #undef SCRATCH_SAVE
_______________________________________________
HarfBuzz mailing list
HarfBuzz <at> lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz
Behdad Esfahbod | 28 Jan 17:13 2015

Away

Hi all,

I'm heading out to Africa today, I will have no or very limited access 
for the next three weeks.  I'll attend to all list traffic ASAP!  I 
don't think anything urgent is outstanding right now.

Cheers,
behdad
_______________________________________________
HarfBuzz mailing list
HarfBuzz <at> lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz
Behdad Esfahbod | 27 Jan 22:14 2015

Rendering of unsupported whitespace

I like to hear your opinions about this commit:

https://github.com/behdad/harfbuzz/commit/81ef4f407d9c7bd98cf62cef951dc538b13442eb

Cheers,
--

-- 
behdad
http://behdad.org/
_______________________________________________
HarfBuzz mailing list
HarfBuzz <at> lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz
Behdad Esfahbod | 27 Jan 21:26 2015

harfbuzz: Branch 'master'

 src/hb-ot-shape-normalize.cc |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 1eff4350239b0768e1042b52db9fb1c0d266f96a
Author: Behdad Esfahbod <behdad <at> behdad.org>
Date:   Tue Jan 27 12:26:04 2015 -0800

    Minor optimization

diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc
index 4287253..8cc64af 100644
--- a/src/hb-ot-shape-normalize.cc
+++ b/src/hb-ot-shape-normalize.cc
 <at>  <at>  -197,16 +197,17  <at>  <at>  static inline void
 decompose_current_character (const hb_ot_shape_normalize_context_t *c, bool shortest)
 {
   hb_buffer_t * const buffer = c->buffer;
+  hb_codepoint_t u = buffer->cur().codepoint;
   hb_codepoint_t glyph;

   /* Kind of a cute waterfall here... */
-  if (shortest && c->font->get_glyph (buffer->cur().codepoint, 0, &glyph))
+  if (shortest && c->font->get_glyph (u, 0, &glyph))
     next_char (buffer, glyph);
-  else if (decompose (c, shortest, buffer->cur().codepoint))
+  else if (decompose (c, shortest, u))
     skip_char (buffer);
-  else if (!shortest && c->font->get_glyph (buffer->cur().codepoint, 0, &glyph))
+  else if (!shortest && c->font->get_glyph (u, 0, &glyph))
     next_char (buffer, glyph);
-  else if (decompose_compatibility (c, buffer->cur().codepoint))
+  else if (decompose_compatibility (c, u))
     skip_char (buffer);
   else
     next_char (buffer, glyph); /* glyph is initialized in earlier branches. */
_______________________________________________
HarfBuzz mailing list
HarfBuzz <at> lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz
notifier | 27 Jan 19:13 2015

behdad/harfbuzz coverage increased (+1.54%) to 58.95% on master

behdad/harfbuzz coverage increased (+1.54%) to 58.95% for commit: Minor improvement to HB_SHAPER_DATA_DESTROY by behdad
_______________________________________________
HarfBuzz mailing list
HarfBuzz <at> lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz
Behdad Esfahbod | 27 Jan 19:07 2015

harfbuzz: Branch 'master'

 src/hb-common.cc |    1 +
 1 file changed, 1 insertion(+)

New commits:
commit 675956aca01fc4e005a338af43d1c1f4f938abd1
Author: Konstantin Ritt <ritt.ks <at> gmail.com>
Date:   Tue Jan 27 11:23:07 2015 +0400

    Do not leak hb_language_t on hb_language_item_t destruction

diff --git a/src/hb-common.cc b/src/hb-common.cc
index 8837cef..05a1f9c 100644
--- a/src/hb-common.cc
+++ b/src/hb-common.cc
 <at>  <at>  -265,6 +265,7  <at>  <at>  retry:
   *lang = key;

   if (!hb_atomic_ptr_cmpexch (&langs, first_lang, lang)) {
+    lang->finish ();
     free (lang);
     goto retry;
   }
_______________________________________________
HarfBuzz mailing list
HarfBuzz <at> lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz
Behdad Esfahbod | 27 Jan 19:03 2015

harfbuzz: Branch 'master'

 src/hb-shaper-private.hh |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit b306f9674a599da50754d24fa5aefcb6bba04420
Author: Konstantin Ritt <ritt.ks <at> gmail.com>
Date:   Tue Jan 27 20:08:41 2015 +0400

    Minor improvement to HB_SHAPER_DATA_DESTROY

diff --git a/src/hb-shaper-private.hh b/src/hb-shaper-private.hh
index 29c4493..d1d1146 100644
--- a/src/hb-shaper-private.hh
+++ b/src/hb-shaper-private.hh
 <at>  <at>  -79,10 +79,9  <at>  <at>  struct hb_shaper_data_t {
 	HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (HB_SHAPER_DATA_TYPE (shaper, object) *data)

 #define HB_SHAPER_DATA_DESTROY(shaper, object) \
-	if (object->shaper_data.shaper && \
-	    object->shaper_data.shaper != HB_SHAPER_DATA_INVALID && \
-	    object->shaper_data.shaper != HB_SHAPER_DATA_SUCCEEDED) \
-	  HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (HB_SHAPER_DATA (shaper, object));
+    if (HB_SHAPER_DATA_TYPE (shaper, object) *data = HB_SHAPER_DATA (shaper, object)) \
+      if (data != HB_SHAPER_DATA_INVALID && data != HB_SHAPER_DATA_SUCCEEDED) \
+        HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (data);

 #define HB_SHAPER_DATA_ENSURE_DECLARE(shaper, object) \
 static inline bool \
_______________________________________________
HarfBuzz mailing list
HarfBuzz <at> lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz
notifier | 27 Jan 18:21 2015

behdad/harfbuzz coverage increased (+1.54%) to 58.95% on master

behdad/harfbuzz coverage increased (+1.54%) to 58.95% for commit: Minor improvement to HB_SHAPER_DATA_DESTROY by KonstantinRitt
_______________________________________________
HarfBuzz mailing list
HarfBuzz <at> lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz
Behdad Esfahbod | 26 Jan 23:53 2015

Mark zeroing for East Asian scripts

Jonathan,

Trying with sequence of U+308F,3099,308F with NotoSansJP, looks like Uniscribe
doesn't zero the mark advance but we do.  The font has bad data for this mark,
but I want to fix the logic discrepancy.

So I'll probably add a new (null-ish) shaper for HIRAGANA, KATAKANA, and HAN,
and use HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE.

WDYT?  What to call that shaper?
--

-- 
behdad
http://behdad.org/
_______________________________________________
HarfBuzz mailing list
HarfBuzz <at> lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz

Gmane