のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

pango pango_ot_buffer_output

  159 
  171 void
  172 pango_ot_buffer_output (const PangoOTBuffer *buffer,
  173             PangoGlyphString    *glyphs)
  174 {
  175   unsigned int i;
  176   int last_cluster;
  177 
  178   unsigned int num_glyphs;
  179   hb_buffer_t *hb_buffer = buffer->buffer;
  180   hb_glyph_info_t *hb_glyph;
  181   hb_glyph_position_t *hb_position;
  182 
  183   if (HB_DIRECTION_IS_BACKWARD (hb_buffer_get_direction (buffer->buffer)))
  184     hb_buffer_reverse (buffer->buffer);
  185 
  186   /* Copy glyphs into output glyph string */
  187   num_glyphs = hb_buffer_get_length (hb_buffer);
  188   hb_glyph = hb_buffer_get_glyph_infos (hb_buffer, NULL);
  189   hb_position = hb_buffer_get_glyph_positions (hb_buffer, NULL);
  190   pango_glyph_string_set_size (glyphs, num_glyphs);
  191   last_cluster = -1;
  192   for (i = 0; i < num_glyphs; i++)
  193     {
  194       glyphs->glyphs[i].glyph = hb_glyph->codepoint;
  195       glyphs->log_clusters[i] = hb_glyph->cluster;
  196       glyphs->glyphs[i].attr.is_cluster_start = glyphs->log_clusters[i] != last_cluster;
  197       last_cluster = glyphs->log_clusters[i];
  198 
  199       glyphs->glyphs[i].geometry.width = hb_position->x_advance;
  200       glyphs->glyphs[i].geometry.x_offset = hb_position->x_offset;
  201       glyphs->glyphs[i].geometry.y_offset = hb_position->y_offset;
  202 
  203       hb_glyph++;
  204       hb_position++;
  205     }
  206 
  207   if (HB_DIRECTION_IS_BACKWARD (hb_buffer_get_direction (buffer->buffer)))
  208     hb_buffer_reverse (buffer->buffer);
  209 }

OpenType Font Handling: Pango Reference Manual