[HarfBuzz] get/set_user_data()

Konstantin Ritt ritt.ks at gmail.com
Mon May 19 15:39:52 PDT 2014


I only use get/set_user_data() in a single place, where it is impossible to
pass some modifiers anyhow else:

{code}
static hb_user_data_key_t _useDesignMetricsKey;
void hb_qt_font_set_use_design_metrics(hb_font_t *font, uint value) {
hb_font_set_user_data(font, &_useDesignMetricsKey, (void *)quintptr(value),
NULL, true); }
uint hb_qt_font_get_use_design_metrics(hb_font_t *font) { return
quintptr(hb_font_get_user_data(font, &_useDesignMetricsKey)); }
static hb_position_t _hb_qt_font_get_glyph_h_advance(hb_font_t *font, void
*font_data, hb_codepoint_t glyph, void * /*user_data*/)
{
    QFontEngine *fe = (QFontEngine *)font_data;
    ...
    fe->recalcAdvances(&g,
QFontEngine::ShaperFlags(hb_qt_font_get_use_design_metrics(font)));
{/code}

However, I find the get/set_user_data() API somewhat inconvenient (mostly
due to key restrictions) and would love a proper solution for the issue
solved here with a useDesignMetrics flag (the issue was described in
another thread).
Except of that, I don't think this API is really that useful.


Regards,
Konstantin


2014-05-20 1:10 GMT+03:00 Behdad Esfahbod <behdad at behdad.org>:

> So, are people actually using the get/set_user_data() methods on HB
> objects?
> I'm thinking about removing them at least for hb_blob_t, as part of
> streamlining blobs and making them more lightweight.  But if no one uses
> the
> get/set_user_data(), I may as well just remove them all.
>
> Initially I added these because (based on cairo experience) I was under the
> impression that they are extremely useful for language bindings.  However,
> they are only if one is willing to write manual bindings, which is
> something I
> prefer to avoid.
>
> So, if no existing user of HarfBuzz uses them, I think it's a good
> indication
> that they were overkill design artifacts and I'll remove before 1.0.
>
> Thanks,
> --
> behdad
> http://behdad.org/
> _______________________________________________
> HarfBuzz mailing list
> HarfBuzz at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/harfbuzz
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/harfbuzz/attachments/20140520/8e27c020/attachment.html>


More information about the HarfBuzz mailing list