[HarfBuzz] BASE table

Behdad Esfahbod behdad at behdad.org
Thu Aug 22 15:06:38 PDT 2013


On 13-08-22 08:56 AM, James Clark wrote:
> Thanks for the quick reply.
> 
> It sounds like implementing BASE for HarfBuzz might be a nice project for
> somebody. As you probably know, it's needed for CSS Level 3 Line Layout:
> http://dev.w3.org/csswg/css3-linebox/.
> 
> I've read the spec several times over the years and I believe I understand it:
> the GPOS/GSUB stuff you've already implemented seems much harder to me.  I was
> thinking of something like this for the API:

Getting the data from the font and presenting it in an API like the one you
propose is not hard.  What I never understood was how a client is supposed to
use this.  In my understanding all needed is "if I'm rendering script2 next to
script1, tell me how much to shift the baseline."  So I don't understand the
"different baselines" thing.  But thanks to the CSS link you provided I think
I can understand them reading that.

Will look into it some time.  But feel free to jump into it.

b

> hb_bool_t
> hb_font_get_extents (hb_font_t          *font,
>                      hb_direction_t      direction,
>                      hb_script_t         script,
>                      hb_language_t       language,
>                      const hb_feature_t *features,
>                      unsigned int        num_features,
>                      hb_position_t      *min_extent,
>                      hb_position_t      *max_extent);
> 
> typedef enum {
>   HB_BASELINE_ROMAN        = HB_TAG ('r', 'o', 'm', 'n'),
>   HB_BASELINE_IDEOGRAPHIC  = HB_TAG ('i', 'd', 'e', 'o'),
>   HB_BASELINE_MATHEMATICAL = HB_TAG ('m', 'a', 't', 'h'),
>   HB_BASELINE_HANGING      = HB_TAG ('h', 'a', 'n', 'g'),
>   /* etc */
>   HB_BASELINE_INVALID     = HB_TAG_NONE
> } hb_baseline_t;
> 
> hb_baseline_t
> hb_face_get_baseline (hb_face_t     *face,
>                       hb_direction_t direction,
>                       hb_script_t    script);
> 
> hb_bool_t
> hb_font_get_baseline_position (hb_font_t     *font,
>                                hb_direction_t direction,
>                                hb_baseline_t  baseline,
>                                hb_position_t *position /* OUT */);
> 
> Does that look roughly in the right direction to you?
> 
> Another way to do it would be to set the dominant font and script on the
> hb_buffer, and then hb_shape could deal with the baseline adjustments. This
> would be a bit easier to use, but I suspect would provide insufficient
> flexibility for some clients.
> 
> James
> 
> 
> On Thu, Aug 22, 2013 at 2:12 AM, Behdad Esfahbod <behdad at behdad.org
> <mailto:behdad at behdad.org>> wrote:
> 
>     On 13-08-21 07:22 AM, James Clark wrote:
>     > Does HarfBuzz do anything with the OpenType BASE table?
> 
>     It doesn't.
> 
>     >  If not, how in the
>     > grand scheme of things does the BASE table get used?
> 
>     BASE is not used in the Free Software text stack at all.  Every time I read
>     the spec to try to understand how to implement it I got confused and gave up.
> 
>     behdad
> 
> 
>     > James
> 
>     --
>     behdad
>     http://behdad.org/
> 
> 

-- 
behdad
http://behdad.org/



More information about the HarfBuzz mailing list