[HarfBuzz] problem with hb_ot_layout_lookup_would_substitute

Jonathan Kew jfkthame at googlemail.com
Thu Jan 2 07:10:36 PST 2014


On 2/1/14 10:17, Werner LEMBERG wrote:
> [harfbuzz 0.9.25]
>
> Please tell me why the attached program returns zero and not true.
>
> In font `pala.ttf' (version 5.00), GSUB lookup 1 (part of the `smcp'
> feature) maps glyph `f' to glyph 1107, so there is definitely a
> substitution.  However, `hb_ot_layout_lookup_would_substitute' returns
> zero, which irritates me.  A bug?
>
> And what's the function of the last argument of this function,
> `zero_extent'?
>
>
>      Werner
>
>
> subst.c
>
>
> #include <ft2build.h>
> #include FT_FREETYPE_H
>
> #include <hb.h>
> #include <hb-ot.h>
> #include <hb-ft.h>
>
>
> int
> main(void)
> {
>    FT_Library ft_library;
>    FT_Face ft_face;
>
>    hb_face_t* hb_face;
>
>    const char* filename = "pala.ttf";
>    hb_codepoint_t c = 'f';
>
>    FT_Init_FreeType(&ft_library);
>    FT_New_Face(ft_library, filename, 0, &ft_face);
>
>    hb_face = hb_ft_face_create(ft_face, NULL);

For your 'c' parameter, you want to be using the glyph ID of the default 
'f' glyph, not the character code 'f'. That's what lookup 1 will apply to.

>    return hb_ot_layout_lookup_would_substitute(hb_face, 1, &c, 1, 1);
> }
>
>
>
> _______________________________________________
> HarfBuzz mailing list
> HarfBuzz at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/harfbuzz
>



More information about the HarfBuzz mailing list