mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-04 13:05:04 +00:00
[buffer] Minor add a function
This commit is contained in:
parent
ea08b04752
commit
17c875c309
4 changed files with 41 additions and 31 deletions
|
@ -32,7 +32,7 @@
|
|||
#include "hb.hh"
|
||||
|
||||
|
||||
#line 36 "hb-buffer-deserialize-text-glyphs.hh"
|
||||
#line 33 "hb-buffer-deserialize-text-glyphs.hh"
|
||||
static const unsigned char _deserialize_text_glyphs_trans_keys[] = {
|
||||
0u, 0u, 35u, 124u, 48u, 57u, 93u, 124u, 45u, 57u, 48u, 57u, 35u, 124u, 45u, 57u,
|
||||
48u, 57u, 35u, 124u, 35u, 124u, 35u, 124u, 48u, 57u, 35u, 124u, 45u, 57u, 48u, 57u,
|
||||
|
@ -274,7 +274,7 @@ static const int deserialize_text_glyphs_error = 0;
|
|||
static const int deserialize_text_glyphs_en_main = 25;
|
||||
|
||||
|
||||
#line 99 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
#line 98 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
|
||||
|
||||
static hb_bool_t
|
||||
|
@ -294,12 +294,12 @@ _hb_buffer_deserialize_text_glyphs (hb_buffer_t *buffer,
|
|||
hb_glyph_info_t info = {0};
|
||||
hb_glyph_position_t pos = {0};
|
||||
|
||||
#line 298 "hb-buffer-deserialize-text-glyphs.hh"
|
||||
#line 291 "hb-buffer-deserialize-text-glyphs.hh"
|
||||
{
|
||||
cs = deserialize_text_glyphs_start;
|
||||
}
|
||||
|
||||
#line 303 "hb-buffer-deserialize-text-glyphs.hh"
|
||||
#line 294 "hb-buffer-deserialize-text-glyphs.hh"
|
||||
{
|
||||
int _slen;
|
||||
int _trans;
|
||||
|
@ -325,13 +325,13 @@ _resume:
|
|||
|
||||
switch ( _deserialize_text_glyphs_trans_actions[_trans] ) {
|
||||
case 2:
|
||||
#line 51 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
#line 50 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
{
|
||||
tok = p;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
#line 55 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
#line 54 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
{
|
||||
/* TODO Unescape delimiters. */
|
||||
if (!hb_font_glyph_from_string (font,
|
||||
|
@ -341,27 +341,27 @@ _resume:
|
|||
}
|
||||
break;
|
||||
case 6:
|
||||
#line 63 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
#line 62 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
{ if (!parse_uint (tok, p, &info.cluster )) return false; }
|
||||
break;
|
||||
case 7:
|
||||
#line 64 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
#line 63 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
{ if (!parse_int (tok, p, &pos.x_offset )) return false; }
|
||||
break;
|
||||
case 8:
|
||||
#line 65 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
#line 64 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
{ if (!parse_int (tok, p, &pos.y_offset )) return false; }
|
||||
break;
|
||||
case 4:
|
||||
#line 66 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
#line 65 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
{ if (!parse_int (tok, p, &pos.x_advance)) return false; }
|
||||
break;
|
||||
case 5:
|
||||
#line 67 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
#line 66 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
{ if (!parse_int (tok, p, &pos.y_advance)) return false; }
|
||||
break;
|
||||
case 3:
|
||||
#line 68 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
#line 67 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
{ if (!parse_uint (tok, p, &info.mask )) return false; }
|
||||
break;
|
||||
case 9:
|
||||
|
@ -370,7 +370,7 @@ _resume:
|
|||
hb_memset (&info, 0, sizeof (info));
|
||||
hb_memset (&pos , 0, sizeof (pos ));
|
||||
}
|
||||
#line 51 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
#line 50 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
{
|
||||
tok = p;
|
||||
}
|
||||
|
@ -381,11 +381,11 @@ _resume:
|
|||
hb_memset (&info, 0, sizeof (info));
|
||||
hb_memset (&pos , 0, sizeof (pos ));
|
||||
}
|
||||
#line 51 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
#line 50 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
{
|
||||
tok = p;
|
||||
}
|
||||
#line 55 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
#line 54 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
{
|
||||
/* TODO Unescape delimiters. */
|
||||
if (!hb_font_glyph_from_string (font,
|
||||
|
@ -397,10 +397,9 @@ _resume:
|
|||
case 12:
|
||||
#line 43 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
{
|
||||
buffer->add_info (info);
|
||||
buffer->add_info_and_pos (info, pos);
|
||||
if (unlikely (!buffer->successful))
|
||||
return false;
|
||||
buffer->pos[buffer->len - 1] = pos;
|
||||
*end_ptr = p;
|
||||
}
|
||||
#line 38 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
|
@ -408,13 +407,13 @@ _resume:
|
|||
hb_memset (&info, 0, sizeof (info));
|
||||
hb_memset (&pos , 0, sizeof (pos ));
|
||||
}
|
||||
#line 51 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
#line 50 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
{
|
||||
tok = p;
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
#line 55 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
#line 54 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
{
|
||||
/* TODO Unescape delimiters. */
|
||||
if (!hb_font_glyph_from_string (font,
|
||||
|
@ -427,7 +426,7 @@ _resume:
|
|||
hb_memset (&info, 0, sizeof (info));
|
||||
hb_memset (&pos , 0, sizeof (pos ));
|
||||
}
|
||||
#line 51 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
#line 50 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
{
|
||||
tok = p;
|
||||
}
|
||||
|
@ -435,10 +434,9 @@ _resume:
|
|||
case 13:
|
||||
#line 43 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
{
|
||||
buffer->add_info (info);
|
||||
buffer->add_info_and_pos (info, pos);
|
||||
if (unlikely (!buffer->successful))
|
||||
return false;
|
||||
buffer->pos[buffer->len - 1] = pos;
|
||||
*end_ptr = p;
|
||||
}
|
||||
#line 38 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
|
@ -446,11 +444,11 @@ _resume:
|
|||
hb_memset (&info, 0, sizeof (info));
|
||||
hb_memset (&pos , 0, sizeof (pos ));
|
||||
}
|
||||
#line 51 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
#line 50 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
{
|
||||
tok = p;
|
||||
}
|
||||
#line 55 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
#line 54 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
{
|
||||
/* TODO Unescape delimiters. */
|
||||
if (!hb_font_glyph_from_string (font,
|
||||
|
@ -459,7 +457,7 @@ _resume:
|
|||
return false;
|
||||
}
|
||||
break;
|
||||
#line 463 "hb-buffer-deserialize-text-glyphs.hh"
|
||||
#line 428 "hb-buffer-deserialize-text-glyphs.hh"
|
||||
}
|
||||
|
||||
_again:
|
||||
|
@ -474,21 +472,20 @@ _again:
|
|||
case 11:
|
||||
#line 43 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
{
|
||||
buffer->add_info (info);
|
||||
buffer->add_info_and_pos (info, pos);
|
||||
if (unlikely (!buffer->successful))
|
||||
return false;
|
||||
buffer->pos[buffer->len - 1] = pos;
|
||||
*end_ptr = p;
|
||||
}
|
||||
break;
|
||||
#line 485 "hb-buffer-deserialize-text-glyphs.hh"
|
||||
#line 447 "hb-buffer-deserialize-text-glyphs.hh"
|
||||
}
|
||||
}
|
||||
|
||||
_out: {}
|
||||
}
|
||||
|
||||
#line 120 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
#line 119 "hb-buffer-deserialize-text-glyphs.rl"
|
||||
|
||||
|
||||
*end_ptr = p;
|
||||
|
|
|
@ -41,10 +41,9 @@ action clear_item {
|
|||
}
|
||||
|
||||
action add_item {
|
||||
buffer->add_info (info);
|
||||
buffer->add_info_and_pos (info, pos);
|
||||
if (unlikely (!buffer->successful))
|
||||
return false;
|
||||
buffer->pos[buffer->len - 1] = pos;
|
||||
*end_ptr = p;
|
||||
}
|
||||
|
||||
|
|
|
@ -370,6 +370,18 @@ hb_buffer_t::add_info (const hb_glyph_info_t &glyph_info)
|
|||
|
||||
len++;
|
||||
}
|
||||
void
|
||||
hb_buffer_t::add_info_and_pos (const hb_glyph_info_t &glyph_info,
|
||||
const hb_glyph_position_t &glyph_pos)
|
||||
{
|
||||
if (unlikely (!ensure (len + 1))) return;
|
||||
|
||||
info[len] = glyph_info;
|
||||
assert (have_positions);
|
||||
pos[len] = glyph_pos;
|
||||
|
||||
len++;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
|
|
|
@ -229,6 +229,8 @@ struct hb_buffer_t
|
|||
HB_INTERNAL void add (hb_codepoint_t codepoint,
|
||||
unsigned int cluster);
|
||||
HB_INTERNAL void add_info (const hb_glyph_info_t &glyph_info);
|
||||
HB_INTERNAL void add_info_and_pos (const hb_glyph_info_t &glyph_info,
|
||||
const hb_glyph_position_t &glyph_pos);
|
||||
|
||||
void reverse_range (unsigned start, unsigned end)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue