Simon Cozens | 4 Sep 01:02 2015

Kerning, glyph width, and x advance

So I'm using Harfbuzz to shape stuff and put it out to PDF. When you
output a string in PDF, you are expected to kern it manually, or else
each glyph will be placed one after the other with no kerning:

 No kerning: Td (VAVAVOOM) Tj
    Kerning: Td[(V) 153 (A) 122 (V) ... ]TJ

The numeric values in the TJ array are the distances to go back after
the glyph is painted. In other words, this is the unkerned X advance
minus the kerned X advance.

I had assumed that the unkerned glyph advance was the width of the
character, but that's not the case:

$ hb-shape --features='-kern' --show-extents
/Library/Fonts/SuperClarendon.ttc 'VAV'
[V=0+900<38,761,824,-761>|A=1+900<38,761,824,-761>|V=2+900<38,761,824,-761>]

(This is not an OT/FT difference.)

If I want to support OpenType kerning, and I need to compute the
distance-to-go-back, do I really have to shape everything twice and then
compare the x advances, or is there a smarter way to do it?
_______________________________________________
HarfBuzz mailing list
HarfBuzz <at> lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz
Behdad Esfahbod | 3 Sep 13:23 2015

harfbuzz: Branch 'master'

 src/hb-blob.cc             |   24 +++++++++---------
 src/hb-buffer-serialize.cc |   10 +++----
 src/hb-buffer.cc           |   58 ++++++++++++++++++++++-----------------------
 src/hb-buffer.h            |    9 ++++++
 src/hb-common.cc           |   24 +++++++++---------
 src/hb-common.h            |    3 ++
 src/hb-coretext.cc         |    3 ++
 src/hb-font.h              |   18 ++++++-------
 src/hb-ft.cc               |    6 ++--
 src/hb-graphite2.cc        |    6 ++++
 src/hb-ot-layout.cc        |    2 -
 src/hb-ot-tag.cc           |    2 -
 src/hb-set.h               |    3 ++
 src/hb-shape.cc            |    2 -
 src/hb-unicode.cc          |   18 ++++++-------
 src/hb-unicode.h           |   10 +++----
 16 files changed, 111 insertions(+), 87 deletions(-)

New commits:
commit b8811429b6810c4f13be087b593a862c17d9d987
Author: Behdad Esfahbod <behdad <at> behdad.org>
Date:   Thu Sep 3 15:53:22 2015 +0430

    Fix Since tags

    Fixes https://github.com/behdad/harfbuzz/issues/103

diff --git a/src/hb-blob.cc b/src/hb-blob.cc
index 8759a25..a6870dc 100644
--- a/src/hb-blob.cc
(Continue reading)

Jonathan Kew | 3 Sep 13:06 2015
Picon

hb_unicode_eastasian_width

Hi Behdad,

Just wondering about hb_unicode_eastasian_width, and the underlying 
support for it in the unicode_funcs.... AFAICS this is not currently 
used in any way. (Or am I forgetting something important?)

Do you have plans for this at all, or is it truly redundant?

Thx,  JK
_______________________________________________
HarfBuzz mailing list
HarfBuzz <at> lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz
Behdad Esfahbod | 3 Sep 12:26 2015

harfbuzz: Branch 'master'

 src/hb-face.cc |   22 ++++++++--------
 src/hb-font.cc |   76 ++++++++++++++++++++++++++++-----------------------------
 2 files changed, 49 insertions(+), 49 deletions(-)

New commits:
commit 5d74ff02ab01df67808b416af8bb9cefb06f841e
Author: Behdad Esfahbod <behdad <at> behdad.org>
Date:   Thu Sep 3 14:55:59 2015 +0430

    Fix Since: version tags on font and face APIs

    A while back we marked every API as version:1.0.  We should fix them all
    to reflect real version they were introduced.  This is a start.

    Patch from Nikolay Sivov.

diff --git a/src/hb-face.cc b/src/hb-face.cc
index 96ea1da..7aa89fc 100644
--- a/src/hb-face.cc
+++ b/src/hb-face.cc
 <at>  <at>  -77,7 +77,7  <at>  <at>  const hb_face_t _hb_face_nil = {
  *
  * Return value: (transfer full)
  *
- * Since: 1.0
+ * Since: 0.9.2
  **/
 hb_face_t *
 hb_face_create_for_tables (hb_reference_table_func_t  reference_table_func,
 <at>  <at>  -157,7 +157,7  <at>  <at>  _hb_face_for_data_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void
(Continue reading)

Nikolay Sivov | 3 Sep 10:43 2015
Picon

[PATCH] Fix 'since' doc header entries for font/face API

Some of those were introduced in 0.6.0, but I used 0.9.2 for consistency.
From 8a1dad8d6d9ea005a67cf6a3e0113ad56f5dc731 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov <at> codeweavers.com>
Date: Thu, 3 Sep 2015 11:39:48 +0300
Subject: [PATCH] Fix 'since' doc header entries for font/face API

---
 src/hb-face.cc | 22 ++++++++---------
 src/hb-font.cc | 76 +++++++++++++++++++++++++++++-----------------------------
 2 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/src/hb-face.cc b/src/hb-face.cc
index 96ea1da..7aa89fc 100644
--- a/src/hb-face.cc
+++ b/src/hb-face.cc
 <at>  <at>  -77,7 +77,7  <at>  <at>  const hb_face_t _hb_face_nil = {
  *
  * Return value: (transfer full)
  *
- * Since: 1.0
+ * Since: 0.9.2
  **/
 hb_face_t *
 hb_face_create_for_tables (hb_reference_table_func_t  reference_table_func,
 <at>  <at>  -157,7 +157,7  <at>  <at>  _hb_face_for_data_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void
  *
  * Return value: (transfer full):
  *
(Continue reading)

Behdad Esfahbod | 2 Sep 10:12 2015

Default hb_font_t scale

Right now default scale is 0,0 when a new font is created.  Should I change
that to upem,upem?  That sounds like a more useful default.

Specifically, this pattern is becoming more common:

parent_font = hb_font_create (face);
hb_ot_font_set_funcs (parent_font);

font = hb_font_create_sub_font (parent_font);
hb_font_set_funcs(font, custom_funcs...);

hb_font_set_scale(font, ...);

This way custom funcs can provide only a few (say, hinted h_advance) function
and everything else comes from parent_font.  For size-related things (like
glyph_extents()) that do come from parent_font, they are scaled properly to
match the scale of the new font, but that will only work if the scale of
parent_font is NOT zero, otherwise the extents will be converted to a scale of
zero (ie, they all become zero), then go through a division by zero!

Changing the default scale addresses that, and plus, make "shape at font
units" the default behavior.

Objections?

Cheers,
--

-- 
behdad
http://behdad.org/
_______________________________________________
(Continue reading)

Behdad Esfahbod | 1 Sep 18:04 2015

harfbuzz: Changes to 'refs/tags/1.0.3'

Tag '1.0.3' created by Behdad Esfahbod <behdad <at> behdad.org> at 2015-09-01 17:03 -0700

1.0.3
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEABECAAYFAlXlzGwACgkQn+4E5dNTERUQqQCglA93RxRVWF8OpZmW6eq4DSMp
rTgAn19Yc4oj6NgXs8uRdK9aKL2xELze
=7EyI
-----END PGP SIGNATURE-----

Changes since 1.0.2-33:
---
 0 files changed
---
_______________________________________________
HarfBuzz mailing list
HarfBuzz <at> lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz
Behdad Esfahbod | 1 Sep 18:04 2015

harfbuzz: Branch 'master'

 NEWS         |   11 +++++++++++
 configure.ac |    2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 7f5405397406a24c5a001b5ef43dcf4d6926415e
Author: Behdad Esfahbod <behdad <at> behdad.org>
Date:   Tue Sep 1 17:03:50 2015 +0100

    1.0.3

diff --git a/NEWS b/NEWS
index 67bef7f..1656488 100644
--- a/NEWS
+++ b/NEWS
 <at>  <at>  -1,3 +1,14  <at>  <at> 
+Overview of changes leading to 1.0.3
+Tuesday, September 1, 2015
+====================================
+
+- Start of user documentation, from Simon Cozens!
+- Implement glyph_extents() for TrueType fonts in hb-ot-font.
+- Improve GPOS cursive attachments with conflicting lookups.
+- More fixes for cluster-level = 1.
+- Uniscribe positioning fix.
+
+
 Overview of changes leading to 1.0.2
 Wednesday, August 19, 2015
 ====================================
(Continue reading)

Behdad Esfahbod | 1 Sep 17:34 2015

harfbuzz: Branch 'master' - 5 commits

 src/hb-ot-shape-complex-hangul.cc |    2 +-
 src/hb-ot-shape-complex-indic.cc  |   21 ++++++++++++++++-----
 src/hb-ot-shape-complex-thai.cc   |    2 +-
 src/hb-ot-shape-complex-use.cc    |    4 ++--
 src/hb-ot-shape.cc                |    5 +++--
 5 files changed, 23 insertions(+), 11 deletions(-)

New commits:
commit 5828c45d7a816ccd0a7f10a665ea3cf8cfd63b05
Author: Behdad Esfahbod <behdad <at> behdad.org>
Date:   Tue Sep 1 16:26:35 2015 +0100

    [indic] Add comments to merge_clusters calls

diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 8b55484..00526f3 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
 <at>  <at>  -1025,7 +1025,11  <at>  <at>  initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
      * around like crazy.  In old-spec mode, we move halants around, so in
      * that case merge all clusters after base.  Otherwise, check the sort
      * order and merge as needed.
-     * For pre-base stuff, we handle cluster issues in final reordering. */
+     * For pre-base stuff, we handle cluster issues in final reordering.
+     *
+     * We could use buffer->sort() for this, if there was no special
+     * reordering of pre-base stuff happening later...
+     */
     if (indic_plan->is_old_spec || end - base > 127)
       buffer->merge_clusters (base, end);
(Continue reading)

Behdad Esfahbod | 1 Sep 17:15 2015

harfbuzz: Branch 'master'

 src/hb-ot-shape-complex-myanmar.cc |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit c403d6320074455a5e8e48902c0ac4ee9685e33d
Author: Behdad Esfahbod <behdad <at> behdad.org>
Date:   Tue Sep 1 16:15:25 2015 +0100

    [myanmar] Use buffer->sort() to sort cluster

    This can possibly produce more granular clusters.

diff --git a/src/hb-ot-shape-complex-myanmar.cc b/src/hb-ot-shape-complex-myanmar.cc
index 9afcbf8..30a53c7 100644
--- a/src/hb-ot-shape-complex-myanmar.cc
+++ b/src/hb-ot-shape-complex-myanmar.cc
 <at>  <at>  -391,9 +391,8  <at>  <at>  initial_reordering_consonant_syllable (hb_buffer_t *buffer,
     }
   }

-  buffer->merge_clusters (start, end);
   /* Sit tight, rock 'n roll! */
-  hb_stable_sort (info + start, end - start, compare_myanmar_order);
+  buffer->sort (start, end, compare_myanmar_order);
 }

 static void
_______________________________________________
HarfBuzz mailing list
HarfBuzz <at> lists.freedesktop.org
(Continue reading)

Behdad Esfahbod | 1 Sep 17:14 2015

harfbuzz: Branch 'master' - 5 commits

 src/hb-buffer-private.hh                                                |    2 
 src/hb-buffer.cc                                                        |   25 ++++
 src/hb-ot-shape-complex-arabic-fallback.hh                              |    6 -
 src/hb-ot-shape-complex-indic.cc                                        |    2 
 src/hb-ot-shape-complex-myanmar.cc                                      |    2 
 src/hb-ot-shape-normalize.cc                                            |    6 -
 src/hb-private.hh                                                       |   54 ++++------
 test/Makefile.am                                                        |    4 
 test/api/Makefile.am                                                    |    4 
 test/shaping/Makefile.am                                                |    4 
 test/shaping/fonts/sha1sum/43ef465752be9af900745f72fe29cb853a1401a5.ttf |binary
 test/shaping/fonts/sha1sum/MANIFEST                                     |    1 
 test/shaping/tests/cluster.tests                                        |    1 
 13 files changed, 69 insertions(+), 42 deletions(-)

New commits:
commit e995d33c10a4bd9404699d01bddb2b69d811e9ed
Author: Behdad Esfahbod <behdad <at> behdad.org>
Date:   Tue Sep 1 16:13:32 2015 +0100

    [OT] Merge clusters when reordering marks for normalization

    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=541608
    and cluster test.

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index 9aa5e7d..7fed738 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
 <at>  <at>  -201,6 +201,8  <at>  <at>  struct hb_buffer_t {
(Continue reading)


Gmane