[HarfBuzz] [287] more efficient glyph extraction (again)

Kelvin Ma kelvinsthirteen at gmail.com
Fri Aug 5 02:56:29 UTC 2016

So in reference to #287 <https://github.com/behdad/harfbuzz/issues/287> I'm
struggling to add this function into harfbuzz which would package glyph
position and info into a compact, positional format:

// hb-buffer.cc

hb_buffer_get_glyphs_horiz (hb_buffer_t * buffer, int length, int **
    assert (buffer->have_positions);
    assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_GLYPHS);

    unsigned int count = buffer->len;
    if (length < count)
        count = length;
    hb_glyph_info_t     *info = buffer->info;
    hb_glyph_position_t *pos  = buffer->pos;

    for (unsigned int i = 0; i < count; i++)
        serialized_glyphs[i][0] = info[i].codepoint;
        serialized_glyphs[i][1] = info[i].cluster;
        serialized_glyphs[i][2] = pos [i].x_advance;
        serialized_glyphs[i][3] = pos [i].x_offset;

Is what I have right now. But making it work with the gobject introspection
API is in the way. The expected output is an array of 4-tuples, but I don’t
know how to make this happen with gobject. I can only make this work with a
one-dimensional array, when I need a two-dimensional array to store the
four ints (Item 0: Must be number, not list when i call from python). Can
somebody please help? I don’t have much experience with C/C++ at this
level, and very little with gobject.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/harfbuzz/attachments/20160804/f4ff084d/attachment.html>

More information about the HarfBuzz mailing list