Re: [HarfBuzz] Failure in hb_font_get_nominal_glyph

2019-07-25 Thread Eli Zaretskii
> From: Behdad Esfahbod 
> Date: Thu, 25 Jul 2019 12:08:43 -0400
> Cc: Khaled Hosny , harfbuzz@lists.freedesktop.org
> 
> Looks good to me. 

Thanks!
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz

Re: [HarfBuzz] Failure in hb_font_get_nominal_glyph

2019-07-25 Thread Behdad Esfahbod
Looks good to me.

On Thu, Jul 25, 2019, 11:57 AM Eli Zaretskii  wrote:

> > From: Behdad Esfahbod 
> > Date: Wed, 24 Jul 2019 15:21:15 -0400
> > Cc: Eli Zaretskii ,
> >   "harfbuzz@lists.freedesktop.org" 
> >
> > Ah, right.  Yes.  Before 2.0.0 you'd have to call hb_ot_font_set_funcs()
> explicitly...
> >
> > Thanks Khaled!
>
> Thanks.
>
> Just to be sure I understand: is the below the right fix?
>
> diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
> index aa6bebd..8fbbe7e 100644
> --- a/src/w32uniscribe.c
> +++ b/src/w32uniscribe.c
> @@ -32,6 +32,7 @@ #define _WIN32_WINNT 0x0600
>  #include 
>  #ifdef HAVE_HARFBUZZ
>  # include 
> +# include /* for hb_ot_font_set_funcs */
>  # if GNUC_PREREQ (4, 3, 0)
>  #  define bswap_32(v)  __builtin_bswap32(v)
>  # else
> @@ -1305,7 +1308,12 @@ w32hb_get_font (struct font *font, double *scale)
>hb_face_t *hb_face =
>  hb_face_create_for_tables (w32hb_get_font_table, font_handle, NULL);
>if (hb_face_get_glyph_count (hb_face) > 0)
> -hb_font = hb_font_create (hb_face);
> +{
> +  hb_font = hb_font_create (hb_face);
> +  /* This is needed for HarfBuzz before 2.0.0; it is the default
> +in later versions.  */
> +  hb_ot_font_set_funcs (hb_font);
> +}
>
>struct uniscribe_font_info *uniscribe_font =
>  (struct uniscribe_font_info *) font;
>
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz

Re: [HarfBuzz] Failure in hb_font_get_nominal_glyph

2019-07-25 Thread Eli Zaretskii
> From: Behdad Esfahbod 
> Date: Wed, 24 Jul 2019 15:21:15 -0400
> Cc: Eli Zaretskii , 
>   "harfbuzz@lists.freedesktop.org" 
> 
> Ah, right.  Yes.  Before 2.0.0 you'd have to call hb_ot_font_set_funcs() 
> explicitly...
> 
> Thanks Khaled!

Thanks.

Just to be sure I understand: is the below the right fix?

diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
index aa6bebd..8fbbe7e 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -32,6 +32,7 @@ #define _WIN32_WINNT 0x0600
 #include 
 #ifdef HAVE_HARFBUZZ
 # include 
+# include /* for hb_ot_font_set_funcs */
 # if GNUC_PREREQ (4, 3, 0)
 #  define bswap_32(v)  __builtin_bswap32(v)
 # else
@@ -1305,7 +1308,12 @@ w32hb_get_font (struct font *font, double *scale)
   hb_face_t *hb_face =
 hb_face_create_for_tables (w32hb_get_font_table, font_handle, NULL);
   if (hb_face_get_glyph_count (hb_face) > 0)
-hb_font = hb_font_create (hb_face);
+{
+  hb_font = hb_font_create (hb_face);
+  /* This is needed for HarfBuzz before 2.0.0; it is the default
+in later versions.  */
+  hb_ot_font_set_funcs (hb_font);
+}
 
   struct uniscribe_font_info *uniscribe_font =
 (struct uniscribe_font_info *) font;
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz

Re: [HarfBuzz] Failure in hb_font_get_nominal_glyph

2019-07-24 Thread Behdad Esfahbod
Ah, right.  Yes.  Before 2.0.0 you'd have to call hb_ot_font_set_funcs()
explicitly...

Thanks Khaled!

On Wed, Jul 24, 2019 at 3:20 PM Khaled Hosny 
wrote:

>
>
> > On Jul 24, 2019, at 9:13 PM, Eli Zaretskii  wrote:
> >
> >> From: Behdad Esfahbod 
> >> Date: Wed, 24 Jul 2019 15:11:03 -0400
> >> Cc: "harfbuzz@lists.freedesktop.org" 
> >>
> >> Nothing stands out to me.
> >
> > Thanks for taking a look.
> >
> > Could something like that be caused by an old version of Freetype
> > library used with HarfBuzz?  I believe when the OP upgraded his
> > HarfBuzz he also upgraded Freetype as its dependency.
>
>
> Emacs don’t seem to be using FreeType integration on your Windows code, so
> that seems unlikely.
>
> I think Emacs is missing a call to hb_ot_font_set_funcs() after creating
> the font. This is the default since only a few releases ago and Emacs code
> seems to assume it. This is not needed on Linux since the FreeType
> functions are used there.
>
> Regards,
> Khaled



-- 
behdad
http://behdad.org/
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz

Re: [HarfBuzz] Failure in hb_font_get_nominal_glyph

2019-07-24 Thread Behdad Esfahbod
On Wed, Jul 24, 2019 at 3:13 PM Eli Zaretskii  wrote:

> > From: Behdad Esfahbod 
> > Date: Wed, 24 Jul 2019 15:11:03 -0400
> > Cc: "harfbuzz@lists.freedesktop.org" 
> >
> > Nothing stands out to me.
>
> Thanks for taking a look.
>
> Could something like that be caused by an old version of Freetype
> library used with HarfBuzz?  I believe when the OP upgraded his
> HarfBuzz he also upgraded Freetype as its dependency.
>

Not really.  Two-year-old version of either library shouldn't have such
behavior, no.

-- 
behdad
http://behdad.org/
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz

Re: [HarfBuzz] Failure in hb_font_get_nominal_glyph

2019-07-24 Thread Khaled Hosny


> On Jul 24, 2019, at 9:13 PM, Eli Zaretskii  wrote:
> 
>> From: Behdad Esfahbod 
>> Date: Wed, 24 Jul 2019 15:11:03 -0400
>> Cc: "harfbuzz@lists.freedesktop.org" 
>> 
>> Nothing stands out to me.
> 
> Thanks for taking a look.
> 
> Could something like that be caused by an old version of Freetype
> library used with HarfBuzz?  I believe when the OP upgraded his
> HarfBuzz he also upgraded Freetype as its dependency.


Emacs don’t seem to be using FreeType integration on your Windows code, so that 
seems unlikely.

I think Emacs is missing a call to hb_ot_font_set_funcs() after creating the 
font. This is the default since only a few releases ago and Emacs code seems to 
assume it. This is not needed on Linux since the FreeType functions are used 
there.

Regards,
Khaled
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz

Re: [HarfBuzz] Failure in hb_font_get_nominal_glyph

2019-07-24 Thread Behdad Esfahbod
Nothing stands out to me.

On Tue, Jul 23, 2019 at 11:11 AM Eli Zaretskii  wrote:

> Could someone please take a look at the problems described here:
>
>   https://lists.gnu.org/archive/html/emacs-devel/2019-07/msg00540.html
>   https://lists.gnu.org/archive/html/emacs-devel/2019-07/msg00557.html
>   https://lists.gnu.org/archive/html/emacs-devel/2019-07/msg00558.html
>   https://lists.gnu.org/archive/html/emacs-devel/2019-07/msg00561.html
>
> and tell whether it is expected that HarfBuzz 1.7.5 is too old to
> support hb_font_get_nominal_glyph reliably on MS-Windows?  According
> to the HarfBuzz docs, that function is available since v1.2.3.
>
> Or maybe the code we have in Emacs has a bug?  If you want to have a
> look at the code that fails, it is here:
>
>   http://git.savannah.gnu.org/cgit/emacs.git/tree/src/w32uniscribe.c#n1328
>
> In a nutshell, the question is: why would hb_font_get_nominal_glyph
> fail for the Courier New font, even when we are requesting a glyph for
> an ASCII character?
>
> TIA
> ___
> HarfBuzz mailing list
> HarfBuzz@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/harfbuzz



-- 
behdad
http://behdad.org/
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/harfbuzz