[HB] Remove all references to the old code!

This commit is contained in:
Behdad Esfahbod 2009-05-20 05:35:14 -04:00
parent e1593a6e62
commit b857b49c82
6 changed files with 138 additions and 198 deletions

View File

@ -1,5 +1,7 @@
## Process this file with automake to produce Makefile.in
NULL =
INCLUDES = \
-I $(srcdir) \
$(FREETYPE_CFLAGS) \
@ -8,63 +10,33 @@ CXX = gcc $(GCCOPTS) -g -fno-rtti -fno-exceptions -Wabi -Wpadded -Wcast-align
noinst_LTLIBRARIES = libharfbuzz-1.la
MAINSOURCES = \
$(INCLUDEDSOURCES) \
hb-ot-layout.cc
# harfbuzz.c
# included from harfbuzz.c
INCLUDEDSOURCES = \
HBSOURCES = \
harfbuzz-buffer.c \
harfbuzz-gpos.c \
harfbuzz-gsub.c \
harfbuzz-impl.c \
harfbuzz-open.c \
harfbuzz-stream.c
hb-private.h \
hb-ot-layout.cc \
hb-ot-layout-common-private.h \
hb-ot-layout-gdef-private.h \
hb-ot-layout-gpos-private.h \
hb-ot-layout-gsubgpos-private.h \
hb-ot-layout-gsub-private.h \
hb-ot-layout-open-private.h \
hb-ot-layout-private.h \
$(NULL)
PUBLICHEADERS = \
harfbuzz.h \
harfbuzz-global.h \
HBHEADERS = \
hb-common.h \
harfbuzz-buffer.h \
harfbuzz-gpos.h \
harfbuzz-gsub.h \
harfbuzz-open.h
hb-ot-layout.h \
$(NULL)
PRIVATEHEADERS = \
harfbuzz-impl.h \
harfbuzz-buffer-private.h \
harfbuzz-gpos-private.h \
harfbuzz-gsub-private.h \
harfbuzz-open-private.h \
harfbuzz-stream-private.h
libharfbuzz_1_la_SOURCES = $(HBSOURCES) $(HBHEADERS)
libharfbuzz_1_la_LIBADD = $(FREETYPE_LIBS)
libharfbuzz_1_la_SOURCES = \
$(MAINSOURCES) \
$(PUBLICHEADERS) \
$(PRIVATEHEADERS)
noinst_PROGRAMS = main
libharfbuzz_1_la_LIBADD = \
$(FREETYPE_LIBS)
main_SOURCES = main.cc
main_LDADD = $(GLIB_LIBS)
noinst_PROGRAMS = harfbuzz-dump main
harfbuzz_dump_SOURCES = \
harfbuzz-dump.c \
harfbuzz-dump.h \
harfbuzz-dump-main.c
harfbuzz_dump_LDADD = \
$(libharfbuzz_1_la_LIBADD) \
libharfbuzz-1.la
main_SOURCES = \
main.cc
main_LDADD = \
$(GLIB_LIBS)
EXTRA_DIST = \
README \
COPYING \
$(INCLUDEDSOURCES)
EXTRA_DIST = README COPYING
-include $(top_srcdir)/git.mk

View File

@ -59,11 +59,12 @@
/* Internal API */
/*static XXX */ HB_Error
hb_buffer_ensure( HB_Buffer buffer,
HB_UInt size )
/*static XXX */ void
hb_buffer_ensure (hb_buffer_t *buffer,
unsigned int size)
{
HB_UInt new_allocated = buffer->allocated;
/* XXX err handling */
if (size > new_allocated)
{
@ -72,52 +73,39 @@ hb_buffer_ensure( HB_Buffer buffer,
while (size > new_allocated)
new_allocated += (new_allocated >> 1) + 8;
if ( buffer->positions )
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->separate_out)
{
if ( REALLOC_ARRAY( buffer->positions, new_allocated, HB_PositionRec ) )
return error;
}
if ( REALLOC_ARRAY( buffer->in_string, new_allocated, HB_GlyphItemRec ) )
return error;
if ( buffer->separate_out )
{
if ( REALLOC_ARRAY( buffer->alt_string, new_allocated, HB_GlyphItemRec ) )
return error;
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 )
if (buffer->alt_string)
{
if ( REALLOC_ARRAY( buffer->alt_string, new_allocated, HB_GlyphItemRec ) )
return error;
free (buffer->alt_string);
buffer->alt_string = NULL;
}
}
buffer->allocated = new_allocated;
}
return HB_Err_Ok;
}
static HB_Error
hb_buffer_duplicate_out_buffer( HB_Buffer buffer )
hb_buffer_duplicate_out_buffer (HB_Buffer buffer)
{
if ( !buffer->alt_string )
{
HB_Error error;
if ( ALLOC_ARRAY( buffer->alt_string, buffer->allocated, HB_GlyphItemRec ) )
return error;
}
if (!buffer->alt_string)
buffer->alt_string = malloc (buffer->allocated * sizeof (buffer->alt_string[0]));
buffer->out_string = buffer->alt_string;
memcpy( buffer->out_string, buffer->in_string, buffer->out_length * sizeof (buffer->out_string[0]) );
memcpy (buffer->out_string, buffer->in_string, buffer->out_length * sizeof (buffer->out_string[0]));
buffer->separate_out = TRUE;
return HB_Err_Ok;
@ -125,39 +113,36 @@ hb_buffer_duplicate_out_buffer( HB_Buffer buffer )
/* Public API */
HB_Error
hb_buffer_new( HB_Buffer *pbuffer )
hb_buffer_t *
hb_buffer_new (void)
{
HB_Buffer buffer;
HB_Error error;
hb_buffer_t *buffer;
if ( ALLOC( buffer, sizeof( HB_BufferRec ) ) )
return error;
buffer = malloc (sizeof (hb_buffer_t));
if (HB_UNLIKELY (!buffer))
return NULL;
buffer->allocated = 0;
buffer->in_string = NULL;
buffer->alt_string = NULL;
buffer->positions = NULL;
hb_buffer_clear( buffer );
hb_buffer_clear (buffer);
*pbuffer = buffer;
return HB_Err_Ok;
return buffer;
}
void
hb_buffer_free( HB_Buffer buffer )
hb_buffer_free (HB_Buffer buffer)
{
FREE( buffer->in_string );
FREE( buffer->alt_string );
buffer->out_string = NULL;
FREE( buffer->positions );
FREE( buffer );
free (buffer->in_string);
free (buffer->alt_string);
free (buffer->positions);
free (buffer);
}
void
hb_buffer_clear( HB_Buffer buffer )
hb_buffer_clear (HB_Buffer buffer)
{
buffer->in_length = 0;
buffer->out_length = 0;
@ -168,18 +153,16 @@ hb_buffer_clear( HB_Buffer buffer )
buffer->max_ligID = 0;
}
HB_Error
hb_buffer_add_glyph( HB_Buffer buffer,
void
hb_buffer_add_glyph (HB_Buffer buffer,
HB_UInt glyph_index,
HB_UInt properties,
HB_UInt cluster )
HB_UInt cluster)
{
HB_Error error;
HB_GlyphItem glyph;
error = hb_buffer_ensure( buffer, buffer->in_length + 1 );
if ( error )
return error;
hb_buffer_ensure (buffer, buffer->in_length + 1);
glyph = &buffer->in_string[buffer->in_length];
glyph->gindex = glyph_index;
@ -190,14 +173,12 @@ hb_buffer_add_glyph( HB_Buffer buffer,
glyph->gproperty = HB_GLYPH_PROPERTY_UNKNOWN;
buffer->in_length++;
return HB_Err_Ok;
}
/* HarfBuzz-Internal API */
HB_INTERNAL void
_hb_buffer_clear_output( HB_Buffer buffer )
_hb_buffer_clear_output (HB_Buffer buffer)
{
buffer->out_length = 0;
buffer->out_pos = 0;
@ -206,17 +187,12 @@ _hb_buffer_clear_output( HB_Buffer buffer )
}
HB_INTERNAL HB_Error
_hb_buffer_clear_positions( HB_Buffer buffer )
_hb_buffer_clear_positions (HB_Buffer buffer)
{
_hb_buffer_clear_output (buffer);
if ( !buffer->positions )
{
HB_Error error;
if ( ALLOC_ARRAY( buffer->positions, buffer->allocated, HB_PositionRec ) )
return error;
}
if (!buffer->positions)
buffer->positions = malloc (buffer->allocated * sizeof (buffer->positions[0]));
memset (buffer->positions, 0, sizeof (buffer->positions[0]) * buffer->in_length);
@ -224,13 +200,13 @@ _hb_buffer_clear_positions( HB_Buffer buffer )
}
HB_INTERNAL void
_hb_buffer_swap( HB_Buffer buffer )
_hb_buffer_swap (HB_Buffer buffer)
{
HB_GlyphItem tmp_string;
int tmp_length;
int tmp_pos;
if ( buffer->separate_out )
if (buffer->separate_out)
{
tmp_string = buffer->in_string;
buffer->in_string = buffer->out_string;
@ -267,37 +243,35 @@ _hb_buffer_swap( HB_Buffer buffer )
The cluster value for the glyph at position buffer->in_pos is used
for all replacement glyphs */
HB_INTERNAL HB_Error
_hb_buffer_add_output_glyphs( HB_Buffer buffer,
_hb_buffer_add_output_glyphs (HB_Buffer buffer,
HB_UShort num_in,
HB_UShort num_out,
HB_UShort *glyph_data,
HB_UShort component,
HB_UShort ligID )
HB_UShort ligID)
{
HB_Error error;
HB_UShort i;
HB_UInt properties;
HB_UInt cluster;
error = hb_buffer_ensure( buffer, buffer->out_pos + num_out );
if ( error )
return error;
hb_buffer_ensure (buffer, buffer->out_pos + num_out);
if ( !buffer->separate_out )
if (!buffer->separate_out)
{
error = hb_buffer_duplicate_out_buffer( buffer );
if ( error )
error = hb_buffer_duplicate_out_buffer (buffer);
if (error)
return error;
}
properties = buffer->in_string[buffer->in_pos].properties;
cluster = buffer->in_string[buffer->in_pos].cluster;
if ( component == 0xFFFF )
if (component == 0xFFFF)
component = buffer->in_string[buffer->in_pos].component;
if ( ligID == 0xFFFF )
if (ligID == 0xFFFF)
ligID = buffer->in_string[buffer->in_pos].ligID;
for ( i = 0; i < num_out; i++ )
for (i = 0; i < num_out; i++)
{
HB_GlyphItem item = &buffer->out_string[buffer->out_pos + i];
@ -318,27 +292,25 @@ _hb_buffer_add_output_glyphs( HB_Buffer buffer,
}
HB_INTERNAL HB_Error
_hb_buffer_add_output_glyph( HB_Buffer buffer,
_hb_buffer_add_output_glyph (HB_Buffer buffer,
HB_UInt glyph_index,
HB_UShort component,
HB_UShort ligID )
HB_UShort ligID)
{
HB_UShort glyph_data = glyph_index;
return _hb_buffer_add_output_glyphs ( buffer, 1, 1,
&glyph_data, component, ligID );
return _hb_buffer_add_output_glyphs (buffer, 1, 1,
&glyph_data, component, ligID);
}
HB_INTERNAL HB_Error
_hb_buffer_next_glyph ( HB_Buffer buffer )
_hb_buffer_next_glyph (HB_Buffer buffer)
{
HB_Error error;
if ( buffer->separate_out )
if (buffer->separate_out)
{
error = hb_buffer_ensure( buffer, buffer->out_pos + 1 );
if ( error )
return error;
hb_buffer_ensure (buffer, buffer->out_pos + 1);
buffer->out_string[buffer->out_pos] = buffer->in_string[buffer->in_pos];
}
@ -351,10 +323,10 @@ _hb_buffer_next_glyph ( HB_Buffer buffer )
}
HB_INTERNAL HB_Error
_hb_buffer_replace_glyph( HB_Buffer buffer,
HB_UInt glyph_index )
_hb_buffer_replace_glyph (HB_Buffer buffer,
HB_UInt glyph_index)
{
if ( !buffer->separate_out )
if (!buffer->separate_out)
{
buffer->out_string[buffer->out_pos].gindex = glyph_index;
@ -364,14 +336,14 @@ _hb_buffer_replace_glyph( HB_Buffer buffer,
}
else
{
return _hb_buffer_add_output_glyph( buffer, glyph_index, 0xFFFF, 0xFFFF );
return _hb_buffer_add_output_glyph (buffer, glyph_index, 0xFFFF, 0xFFFF);
}
return HB_Err_Ok;
}
HB_INTERNAL HB_UShort
_hb_buffer_allocate_ligid( HB_Buffer buffer )
_hb_buffer_allocate_ligid (HB_Buffer buffer)
{
return ++buffer->max_ligID;
}

View File

@ -28,67 +28,67 @@
#ifndef HARFBUZZ_BUFFER_H
#define HARFBUZZ_BUFFER_H
#include "harfbuzz-global.h"
#include "hb-common.h"
HB_BEGIN_HEADER
HB_BEGIN_DECLS();
typedef struct HB_GlyphItemRec_ {
HB_UInt gindex;
HB_UInt properties;
HB_UInt cluster;
HB_UShort component;
HB_UShort ligID;
HB_UShort gproperty;
hb_codepoint_t gindex;
unsigned int properties;
unsigned int cluster;
unsigned short component;
unsigned short ligID;
unsigned short gproperty;
} HB_GlyphItemRec, *HB_GlyphItem;
typedef struct HB_PositionRec_ {
HB_Fixed x_pos;
HB_Fixed y_pos;
HB_Fixed x_advance;
HB_Fixed y_advance;
HB_UShort back; /* number of glyphs to go back
hb_position_t x_pos;
hb_position_t y_pos;
hb_position_t x_advance;
hb_position_t y_advance;
unsigned short back; /* number of glyphs to go back
for drawing current glyph */
HB_Bool new_advance; /* if set, the advance width values are
hb_bool_t new_advance; /* if set, the advance width values are
absolute, i.e., they won't be
added to the original glyph's value
but rather replace them. */
HB_Short cursive_chain; /* character to which this connects,
short cursive_chain; /* character to which this connects,
may be positive or negative; used
only internally */
} HB_PositionRec, *HB_Position;
typedef struct HB_BufferRec_{
HB_UInt allocated;
typedef struct _hb_buffer_t {
unsigned int allocated;
HB_UInt in_length;
HB_UInt out_length;
HB_UInt in_pos;
HB_UInt out_pos;
unsigned int in_length;
unsigned int out_length;
unsigned int in_pos;
unsigned int out_pos;
HB_Bool separate_out;
hb_bool_t separate_out;
HB_GlyphItem in_string;
HB_GlyphItem out_string;
HB_GlyphItem alt_string;
HB_Position positions;
HB_UShort max_ligID;
} HB_BufferRec, *HB_Buffer;
unsigned int max_ligID;
} HB_BufferRec, *HB_Buffer, hb_buffer_t;
HB_Error
hb_buffer_new( HB_Buffer *buffer );
hb_buffer_t *
hb_buffer_new (void);
void
hb_buffer_free( HB_Buffer buffer );
hb_buffer_free (hb_buffer_t *buffer);
void
hb_buffer_clear( HB_Buffer buffer );
hb_buffer_clear (hb_buffer_t *buffer);
HB_Error
hb_buffer_add_glyph( HB_Buffer buffer,
HB_UInt glyph_index,
HB_UInt properties,
HB_UInt cluster );
void
hb_buffer_add_glyph (hb_buffer_t *buffer,
hb_codepoint_t glyph_index,
unsigned int properties,
unsigned int cluster);
HB_END_HEADER
HB_END_DECLS();
#endif /* HARFBUZZ_BUFFER_H */

View File

@ -92,9 +92,9 @@ _hb_ot_layout_check_glyph_property (hb_ot_layout_t *layout,
unsigned int *property);
/* XXX */
HB_Error
hb_buffer_ensure( HB_Buffer buffer,
HB_UInt size );
void
hb_buffer_ensure (hb_buffer_t *buffer,
unsigned int size);
HB_END_DECLS();

View File

@ -582,16 +582,11 @@ hb_ot_layout_position_lookup (hb_ot_layout_t *layout,
static HB_Error
hb_buffer_duplicate_out_buffer( HB_Buffer buffer )
{
if ( !buffer->alt_string )
{
HB_Error error;
if ( ALLOC_ARRAY( buffer->alt_string, buffer->allocated, HB_GlyphItemRec ) )
return error;
}
if (!buffer->alt_string)
buffer->alt_string = (HB_GlyphItemRec_ *) malloc (buffer->allocated * sizeof (buffer->out_string[0]));
buffer->out_string = buffer->alt_string;
memcpy( buffer->out_string, buffer->in_string, buffer->out_length * sizeof (buffer->out_string[0]) );
memcpy (buffer->out_string, buffer->in_string, buffer->out_length * sizeof (buffer->out_string[0]));
buffer->separate_out = TRUE;
return HB_Err_Ok;
@ -599,6 +594,7 @@ hb_buffer_duplicate_out_buffer( HB_Buffer buffer )
/* XXX */
HB_INTERNAL HB_Error
_hb_buffer_add_output_glyph_ids( HB_Buffer buffer,
HB_UShort num_in,
@ -612,9 +608,8 @@ _hb_buffer_add_output_glyph_ids( HB_Buffer buffer,
HB_UInt properties;
HB_UInt cluster;
error = hb_buffer_ensure( buffer, buffer->out_pos + num_out );
if ( error )
return error;
hb_buffer_ensure( buffer, buffer->out_pos + num_out );
/* XXX */
if ( !buffer->separate_out )
{

View File

@ -28,6 +28,7 @@
#define HB_OT_LAYOUT_H
#include "hb-common.h"
#include "harfbuzz-buffer.h"
HB_BEGIN_DECLS();