Add hb_buffer_reset() and hb_buffer_set_length()
This commit is contained in:
parent
69ea23cb5d
commit
c910bec863
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
|
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
|
||||||
* Copyright (C) 2004,2007,2009,2010 Red Hat, Inc.
|
* Copyright (C) 2004,2007,2009,2010 Red Hat, Inc.
|
||||||
|
* Copyright (C) 2011 Google, Inc.
|
||||||
*
|
*
|
||||||
* This is part of HarfBuzz, a text shaping library.
|
* This is part of HarfBuzz, a text shaping library.
|
||||||
*
|
*
|
||||||
|
@ -23,6 +24,7 @@
|
||||||
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
*
|
*
|
||||||
* Red Hat Author(s): Owen Taylor, Behdad Esfahbod
|
* Red Hat Author(s): Owen Taylor, Behdad Esfahbod
|
||||||
|
* Google Author(s): Behdad Esfahbod
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "hb-buffer-private.hh"
|
#include "hb-buffer-private.hh"
|
||||||
|
@ -226,6 +228,17 @@ hb_buffer_get_language (hb_buffer_t *buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
hb_buffer_reset (hb_buffer_t *buffer)
|
||||||
|
{
|
||||||
|
hb_buffer_clear (buffer);
|
||||||
|
|
||||||
|
buffer->props = _hb_buffer_nil.props;
|
||||||
|
|
||||||
|
hb_unicode_funcs_destroy (buffer->unicode);
|
||||||
|
buffer->unicode = _hb_buffer_nil.unicode;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
hb_buffer_clear (hb_buffer_t *buffer)
|
hb_buffer_clear (hb_buffer_t *buffer)
|
||||||
{
|
{
|
||||||
|
@ -434,6 +447,24 @@ _hb_buffer_set_masks (hb_buffer_t *buffer,
|
||||||
|
|
||||||
/* Public API again */
|
/* Public API again */
|
||||||
|
|
||||||
|
hb_bool_t
|
||||||
|
hb_buffer_set_length (hb_buffer_t *buffer,
|
||||||
|
unsigned int length)
|
||||||
|
{
|
||||||
|
if (!hb_buffer_ensure (buffer, length))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
/* Wipe the new space */
|
||||||
|
if (length > buffer->len) {
|
||||||
|
memset (buffer->info + buffer->len, 0, sizeof (buffer->info[0]) * (length - buffer->len));
|
||||||
|
if (buffer->have_positions)
|
||||||
|
memset (buffer->pos + buffer->len, 0, sizeof (buffer->pos[0]) * (length - buffer->len));
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer->len = length;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
hb_buffer_get_length (hb_buffer_t *buffer)
|
hb_buffer_get_length (hb_buffer_t *buffer)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
|
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
|
||||||
* Copyright (C) 2004,2007,2009 Red Hat, Inc.
|
* Copyright (C) 2004,2007,2009 Red Hat, Inc.
|
||||||
|
* Copyright (C) 2011 Google, Inc.
|
||||||
*
|
*
|
||||||
* This is part of HarfBuzz, a text shaping library.
|
* This is part of HarfBuzz, a text shaping library.
|
||||||
*
|
*
|
||||||
|
@ -23,6 +24,7 @@
|
||||||
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
*
|
*
|
||||||
* Red Hat Author(s): Owen Taylor, Behdad Esfahbod
|
* Red Hat Author(s): Owen Taylor, Behdad Esfahbod
|
||||||
|
* Google Author(s): Behdad Esfahbod
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HB_BUFFER_H
|
#ifndef HB_BUFFER_H
|
||||||
|
@ -95,6 +97,12 @@ hb_language_t
|
||||||
hb_buffer_get_language (hb_buffer_t *buffer);
|
hb_buffer_get_language (hb_buffer_t *buffer);
|
||||||
|
|
||||||
|
|
||||||
|
/* Resets the buffer. Afterwards it's as if it was just created,
|
||||||
|
* except that it has a larger buffer allocated perhaps... */
|
||||||
|
void
|
||||||
|
hb_buffer_reset (hb_buffer_t *buffer);
|
||||||
|
|
||||||
|
/* Clears buffer glyphs, but doesn't touch other buffer attributes. */
|
||||||
void
|
void
|
||||||
hb_buffer_clear (hb_buffer_t *buffer);
|
hb_buffer_clear (hb_buffer_t *buffer);
|
||||||
|
|
||||||
|
@ -142,12 +150,17 @@ hb_buffer_add_utf32 (hb_buffer_t *buffer,
|
||||||
unsigned int item_length);
|
unsigned int item_length);
|
||||||
|
|
||||||
|
|
||||||
/* Getting glyphs out of the buffer */
|
/* Clears any new items added at the end */
|
||||||
|
hb_bool_t
|
||||||
|
hb_buffer_set_length (hb_buffer_t *buffer,
|
||||||
|
unsigned int length);
|
||||||
|
|
||||||
/* Return value valid as long as buffer not modified */
|
/* Return value valid as long as buffer not modified */
|
||||||
unsigned int
|
unsigned int
|
||||||
hb_buffer_get_length (hb_buffer_t *buffer);
|
hb_buffer_get_length (hb_buffer_t *buffer);
|
||||||
|
|
||||||
|
/* Getting glyphs out of the buffer */
|
||||||
|
|
||||||
/* Return value valid as long as buffer not modified */
|
/* Return value valid as long as buffer not modified */
|
||||||
hb_glyph_info_t *
|
hb_glyph_info_t *
|
||||||
hb_buffer_get_glyph_infos (hb_buffer_t *buffer);
|
hb_buffer_get_glyph_infos (hb_buffer_t *buffer);
|
||||||
|
|
Loading…
Reference in New Issue