On Mon, Nov 26, 2012 at 02:03:15PM +0200, Behdad Esfahbod wrote:
> On 12-11-24 10:58 PM, Khaled Hosny wrote:
> > On Sat, Nov 24, 2012 at 01:05:26AM -0500, Behdad Esfahbod wrote:
> >> On 12-11-23 07:42 PM, Khaled Hosny wrote:
> >>
> >>> (Background: I’m almost done with porting XeTeX from ICU LayoutEngine to
> >>> HarfBuzz, one of the few things remaining is getting optical size. The
> >>> current code uses some internal LE API and I want to move away from this
> >>> as possible).
> >>
> >> Sure, I'll implement it in HarfBuzz for you!
> > 
> > Great!
> 
> Done.  Untested though.  Let me know if it works!

Thanks Behdad. It seems that looking for ‘size’ feature under default
script does not work, with the attached patch which makes it check all
GPOS features, things work fine.

Now what remains is handling fonts with broken ‘size’ feature that AFDKO
used to make prior 2006, but I’m yet to find documentation for it (Adobe
is said to have sent some explanation for a heuristic to handle broken
‘size’ features to OpenType mailing list somewhere in 2006, but I don’t
have access to list archives).

Regards,
 Khaled
>From 573ba7970546a7f73be69d721e5c49abffac2ec7 Mon Sep 17 00:00:00 2001
From: Khaled Hosny <[email protected]>
Date: Mon, 26 Nov 2012 19:58:11 +0200
Subject: [PATCH] [OTLayout] fix reading 'size' feature

Iterate over all GPOS features, not only those of default script and
language.
---
 src/hb-ot-layout.cc |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 2572c00..55f36b9 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -645,17 +645,13 @@ hb_ot_layout_position_get_size (hb_face_t *face,
 				uint16_t  *data /* OUT, 5 items */)
 {
   const OT::GPOS &gpos = _get_gpos (face);
-  unsigned int script_index;
-  gpos.find_script_index (HB_OT_TAG_DEFAULT_SCRIPT, &script_index);
-  const OT::LangSys &l = gpos.get_script (script_index).get_lang_sys (HB_OT_TAG_DEFAULT_LANGUAGE);
 
-  unsigned int num_features = l.get_feature_count ();
+  unsigned int num_features = gpos.get_feature_count ();
   for (unsigned int i = 0; i < num_features; i++) {
-    unsigned int f_index = l.get_feature_index (i);
 
-    if (HB_TAG ('s','i','z','e') == gpos.get_feature_tag (f_index))
+    if (HB_TAG ('s','i','z','e') == gpos.get_feature_tag (i))
     {
-      const OT::Feature &f = gpos.get_feature (f_index);
+      const OT::Feature &f = gpos.get_feature (i);
       const OT::FeatureParams &params = f.get_feature_params ();
 
       for (unsigned int i = 0; i < 5; i++)
-- 
1.7.9.5

_______________________________________________
HarfBuzz mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/harfbuzz

Reply via email to