Apply patch from Jonathan Kew
This commit is contained in:
parent
2ebb89d63d
commit
f9cd1014f8
@ -52,41 +52,6 @@
|
|||||||
|
|
||||||
/* Internal API */
|
/* Internal API */
|
||||||
|
|
||||||
static void
|
|
||||||
hb_buffer_ensure (hb_buffer_t *buffer, unsigned int size)
|
|
||||||
{
|
|
||||||
unsigned int new_allocated = buffer->allocated;
|
|
||||||
|
|
||||||
if (size > new_allocated)
|
|
||||||
{
|
|
||||||
while (size > new_allocated)
|
|
||||||
new_allocated += (new_allocated >> 1) + 8;
|
|
||||||
|
|
||||||
if (buffer->positions)
|
|
||||||
buffer->positions = realloc (buffer->positions, new_allocated * sizeof (buffer->positions[0]));
|
|
||||||
|
|
||||||
buffer->in_string = realloc (buffer->in_string, new_allocated * sizeof (buffer->in_string[0]));
|
|
||||||
|
|
||||||
if (buffer->out_string != buffer->in_string)
|
|
||||||
{
|
|
||||||
buffer->alt_string = realloc (buffer->alt_string, new_allocated * sizeof (buffer->alt_string[0]));
|
|
||||||
buffer->out_string = buffer->alt_string;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buffer->out_string = buffer->in_string;
|
|
||||||
|
|
||||||
if (buffer->alt_string)
|
|
||||||
{
|
|
||||||
free (buffer->alt_string);
|
|
||||||
buffer->alt_string = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
buffer->allocated = new_allocated;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
hb_buffer_ensure_separate (hb_buffer_t *buffer, unsigned int size)
|
hb_buffer_ensure_separate (hb_buffer_t *buffer, unsigned int size)
|
||||||
{
|
{
|
||||||
@ -104,7 +69,7 @@ hb_buffer_ensure_separate (hb_buffer_t *buffer, unsigned int size)
|
|||||||
/* Public API */
|
/* Public API */
|
||||||
|
|
||||||
hb_buffer_t *
|
hb_buffer_t *
|
||||||
hb_buffer_new (void)
|
hb_buffer_new (unsigned int allocation_size)
|
||||||
{
|
{
|
||||||
hb_buffer_t *buffer;
|
hb_buffer_t *buffer;
|
||||||
|
|
||||||
@ -119,6 +84,9 @@ hb_buffer_new (void)
|
|||||||
|
|
||||||
hb_buffer_clear (buffer);
|
hb_buffer_clear (buffer);
|
||||||
|
|
||||||
|
if (allocation_size)
|
||||||
|
hb_buffer_ensure(buffer, allocation_size);
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,6 +110,41 @@ hb_buffer_clear (hb_buffer_t *buffer)
|
|||||||
buffer->max_lig_id = 0;
|
buffer->max_lig_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
hb_buffer_ensure (hb_buffer_t *buffer, unsigned int size)
|
||||||
|
{
|
||||||
|
unsigned int new_allocated = buffer->allocated;
|
||||||
|
|
||||||
|
if (size > new_allocated)
|
||||||
|
{
|
||||||
|
while (size > new_allocated)
|
||||||
|
new_allocated += (new_allocated >> 1) + 8;
|
||||||
|
|
||||||
|
if (buffer->positions)
|
||||||
|
buffer->positions = realloc (buffer->positions, new_allocated * sizeof (buffer->positions[0]));
|
||||||
|
|
||||||
|
if (buffer->out_string != buffer->in_string)
|
||||||
|
{
|
||||||
|
buffer->in_string = realloc (buffer->in_string, new_allocated * sizeof (buffer->in_string[0]));
|
||||||
|
buffer->alt_string = realloc (buffer->alt_string, new_allocated * sizeof (buffer->alt_string[0]));
|
||||||
|
buffer->out_string = buffer->alt_string;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buffer->in_string = realloc (buffer->in_string, new_allocated * sizeof (buffer->in_string[0]));
|
||||||
|
buffer->out_string = buffer->in_string;
|
||||||
|
|
||||||
|
if (buffer->alt_string)
|
||||||
|
{
|
||||||
|
free (buffer->alt_string);
|
||||||
|
buffer->alt_string = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer->allocated = new_allocated;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
hb_buffer_add_glyph (hb_buffer_t *buffer,
|
hb_buffer_add_glyph (hb_buffer_t *buffer,
|
||||||
hb_codepoint_t glyph_index,
|
hb_codepoint_t glyph_index,
|
||||||
|
@ -76,7 +76,7 @@ typedef struct _hb_buffer_t {
|
|||||||
} hb_buffer_t;
|
} hb_buffer_t;
|
||||||
|
|
||||||
hb_buffer_t *
|
hb_buffer_t *
|
||||||
hb_buffer_new (void);
|
hb_buffer_new (unsigned int allocation_size);
|
||||||
|
|
||||||
void
|
void
|
||||||
hb_buffer_free (hb_buffer_t *buffer);
|
hb_buffer_free (hb_buffer_t *buffer);
|
||||||
@ -84,6 +84,10 @@ hb_buffer_free (hb_buffer_t *buffer);
|
|||||||
void
|
void
|
||||||
hb_buffer_clear (hb_buffer_t *buffer);
|
hb_buffer_clear (hb_buffer_t *buffer);
|
||||||
|
|
||||||
|
void
|
||||||
|
hb_buffer_ensure (hb_buffer_t *buffer,
|
||||||
|
unsigned int size);
|
||||||
|
|
||||||
void
|
void
|
||||||
hb_buffer_add_glyph (hb_buffer_t *buffer,
|
hb_buffer_add_glyph (hb_buffer_t *buffer,
|
||||||
hb_codepoint_t glyph_index,
|
hb_codepoint_t glyph_index,
|
||||||
|
@ -56,6 +56,18 @@ hb_ot_layout_create (void)
|
|||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hb_bool_t
|
||||||
|
hb_ot_layout_has_substitution (hb_ot_layout_t *layout)
|
||||||
|
{
|
||||||
|
return layout->gsub != &Null(GSUB);
|
||||||
|
}
|
||||||
|
|
||||||
|
hb_bool_t
|
||||||
|
hb_ot_layout_has_positioning (hb_ot_layout_t *layout)
|
||||||
|
{
|
||||||
|
return layout->gpos != &Null(GPOS);
|
||||||
|
}
|
||||||
|
|
||||||
hb_ot_layout_t *
|
hb_ot_layout_t *
|
||||||
hb_ot_layout_create_for_data (const char *font_data,
|
hb_ot_layout_create_for_data (const char *font_data,
|
||||||
int face_index)
|
int face_index)
|
||||||
@ -77,6 +89,25 @@ hb_ot_layout_create_for_data (const char *font_data,
|
|||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hb_ot_layout_t *
|
||||||
|
hb_ot_layout_create_for_tables (const char *gdef_data,
|
||||||
|
const char *gsub_data,
|
||||||
|
const char *gpos_data)
|
||||||
|
{
|
||||||
|
hb_ot_layout_t *layout;
|
||||||
|
|
||||||
|
if (HB_UNLIKELY (gdef_data == NULL && gsub_data == NULL && gpos_data == NULL))
|
||||||
|
return hb_ot_layout_create ();
|
||||||
|
|
||||||
|
layout = (hb_ot_layout_t *) calloc (1, sizeof (hb_ot_layout_t));
|
||||||
|
|
||||||
|
layout->gdef = &GDEF::get_for_data (gdef_data);
|
||||||
|
layout->gsub = &GSUB::get_for_data (gsub_data);
|
||||||
|
layout->gpos = &GPOS::get_for_data (gpos_data);
|
||||||
|
|
||||||
|
return layout;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
hb_ot_layout_destroy (hb_ot_layout_t *layout)
|
hb_ot_layout_destroy (hb_ot_layout_t *layout)
|
||||||
{
|
{
|
||||||
|
@ -45,6 +45,11 @@ hb_ot_layout_t *
|
|||||||
hb_ot_layout_create_for_data (const char *font_data,
|
hb_ot_layout_create_for_data (const char *font_data,
|
||||||
int face_index);
|
int face_index);
|
||||||
|
|
||||||
|
hb_ot_layout_t *
|
||||||
|
hb_ot_layout_create_for_tables (const char *gdef_data,
|
||||||
|
const char *gsub_data,
|
||||||
|
const char *gpos_data);
|
||||||
|
|
||||||
void
|
void
|
||||||
hb_ot_layout_destroy (hb_ot_layout_t *layout);
|
hb_ot_layout_destroy (hb_ot_layout_t *layout);
|
||||||
|
|
||||||
@ -231,12 +236,22 @@ hb_ot_layout_feature_get_lookup_index (hb_ot_layout_t *layout,
|
|||||||
* GSUB
|
* GSUB
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
hb_bool_t
|
||||||
|
hb_ot_layout_has_substitution (hb_ot_layout_t *layout);
|
||||||
|
|
||||||
hb_bool_t
|
hb_bool_t
|
||||||
hb_ot_layout_substitute_lookup (hb_ot_layout_t *layout,
|
hb_ot_layout_substitute_lookup (hb_ot_layout_t *layout,
|
||||||
hb_buffer_t *buffer,
|
hb_buffer_t *buffer,
|
||||||
unsigned int lookup_index,
|
unsigned int lookup_index,
|
||||||
hb_ot_layout_feature_mask_t mask);
|
hb_ot_layout_feature_mask_t mask);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* GPOS
|
||||||
|
*/
|
||||||
|
|
||||||
|
hb_bool_t
|
||||||
|
hb_ot_layout_has_positioning (hb_ot_layout_t *layout);
|
||||||
|
|
||||||
hb_bool_t
|
hb_bool_t
|
||||||
hb_ot_layout_position_lookup (hb_ot_layout_t *layout,
|
hb_ot_layout_position_lookup (hb_ot_layout_t *layout,
|
||||||
hb_buffer_t *buffer,
|
hb_buffer_t *buffer,
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#ifndef HB_PRIVATE_H
|
#ifndef HB_PRIVATE_H
|
||||||
#define HB_PRIVATE_H
|
#define HB_PRIVATE_H
|
||||||
|
|
||||||
#include <hb-common.h>
|
#include "hb-common.h"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user