Commit 336bb320 authored by Behdad Esfahbod's avatar Behdad Esfahbod

[HB] Remove all references to the old code!

parent 15a0220c
## 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
PUBLICHEADERS = \
harfbuzz.h \
harfbuzz-global.h \
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)
HBHEADERS = \
hb-common.h \
harfbuzz-buffer.h \
harfbuzz-gpos.h \
harfbuzz-gsub.h \
harfbuzz-open.h
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 = \
$(MAINSOURCES) \
$(PUBLICHEADERS) \
$(PRIVATEHEADERS)
libharfbuzz_1_la_LIBADD = \
$(FREETYPE_LIBS)
noinst_PROGRAMS = harfbuzz-dump main
hb-ot-layout.h \
$(NULL)
harfbuzz_dump_SOURCES = \
harfbuzz-dump.c \
harfbuzz-dump.h \
harfbuzz-dump-main.c
libharfbuzz_1_la_SOURCES = $(HBSOURCES) $(HBHEADERS)
libharfbuzz_1_la_LIBADD = $(FREETYPE_LIBS)
harfbuzz_dump_LDADD = \
$(libharfbuzz_1_la_LIBADD) \
libharfbuzz-1.la
noinst_PROGRAMS = main
main_SOURCES = \
main.cc
main_LDADD = \
$(GLIB_LIBS)
main_SOURCES = main.cc
main_LDADD = $(GLIB_LIBS)
EXTRA_DIST = \
README \
COPYING \
$(INCLUDEDSOURCES)
EXTRA_DIST = README COPYING
-include $(top_srcdir)/git.mk
......@@ -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 ( REALLOC_ARRAY( buffer->positions, new_allocated, HB_PositionRec ) )
return error;
}
if (buffer->positions)
buffer->positions = realloc (buffer->positions, new_allocated * sizeof (buffer->positions[0]));
if ( REALLOC_ARRAY( buffer->in_string, new_allocated, HB_GlyphItemRec ) )
return error;
buffer->in_string = realloc (buffer->in_string, new_allocated * sizeof (buffer->in_string[0]));
if ( buffer->separate_out )
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;
if ( ALLOC( buffer, sizeof( HB_BufferRec ) ) )
return error;
hb_buffer_t *buffer;
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;
......@@ -188,16 +171,14 @@ hb_buffer_add_glyph( HB_Buffer buffer,
glyph->component = 0;
glyph->ligID = 0;
glyph->gproperty = HB_GLYPH_PROPERTY_UNKNOWN;
buffer->in_length++;
return HB_Err_Ok;
buffer->in_length++;
}
/* 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;
}
......@@ -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
for drawing current glyph */
HB_Bool 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,
may be positive or negative; used
only internally */
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_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. */
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 */
......@@ -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();
......
......@@ -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 )
{
......
......@@ -28,6 +28,7 @@
#define HB_OT_LAYOUT_H
#include "hb-common.h"
#include "harfbuzz-buffer.h"
HB_BEGIN_DECLS();
......
......@@ -24,26 +24,26 @@
#include "pango-ot-private.h"
#include "pangofc-private.h"
/* cache a single HB_Buffer */
static HB_Buffer cached_buffer = NULL;
/* cache a single hb_buffer_t */
static hb_buffer_t *cached_buffer = NULL;
G_LOCK_DEFINE_STATIC (cached_buffer);
static HB_Buffer
static hb_buffer_t *
acquire_buffer (gboolean *free_buffer)
{
HB_Buffer buffer;
hb_buffer_t *buffer;
if (G_LIKELY (G_TRYLOCK (cached_buffer)))
{
if (G_UNLIKELY (!cached_buffer))
hb_buffer_new (&cached_buffer);
cached_buffer = hb_buffer_new ();
buffer = cached_buffer;
*free_buffer = FALSE;
}
else
{
hb_buffer_new (&buffer);
buffer = hb_buffer_new ();
*free_buffer = TRUE;
}
......@@ -51,7 +51,7 @@ acquire_buffer (gboolean *free_buffer)
}
static void
release_buffer (HB_Buffer buffer, gboolean free_buffer)
release_buffer (hb_buffer_t *buffer, gboolean free_buffer)
{
if (G_LIKELY (!free_buffer))
{
......
......@@ -139,8 +139,8 @@ _pango_ot_info_get_layout (PangoOTInfo *info)
typedef struct _GlyphInfo GlyphInfo;
struct _GlyphInfo {
HB_UShort glyph;
HB_UShort class;
unsigned short glyph;
unsigned short class;
};
static int
......@@ -158,8 +158,8 @@ compare_glyph_info (gconstpointer a,
* a character code that maps to the glyph
*/
static gboolean
get_glyph_class (gunichar charcode,
HB_UShort *class)
get_glyph_class (gunichar charcode,
unsigned short *class)
{
/* For characters mapped into the Arabic Presentation forms, using properties
* derived as we apply GSUB substitutions will be more reliable
......@@ -193,8 +193,8 @@ set_unicode_charmap (FT_Face face)
for (charmap = 0; charmap < face->num_charmaps; charmap++)
if (face->charmaps[charmap]->encoding == ft_encoding_unicode)
{
HB_Error error = FT_Set_Charmap(face, face->charmaps[charmap]);
return error == HB_Err_Ok;
FT_Error error = FT_Set_Charmap(face, face->charmaps[charmap]);
return error == FT_Err_Ok;
}
return FALSE;
......@@ -599,7 +599,7 @@ _pango_ot_info_position (const PangoOTInfo *info,
}
{
HB_UInt i, j;
unsigned int i, j;
HB_Position positions = buffer->buffer->positions;
/* First handle all left-to-right connections */
......
......@@ -25,7 +25,7 @@
#include <glib-object.h>
#include <pango/pango-ot.h>
#include "opentype/harfbuzz.h"
#include "opentype/hb-ot-layout.h"
G_BEGIN_DECLS
......@@ -52,9 +52,9 @@ typedef struct _PangoOTRule PangoOTRule;
struct _PangoOTRule
{
gulong property_bit;
HB_UShort feature_index;
guint table_type : 1;
gulong property_bit;
guint feature_index;
guint table_type : 1;
};
typedef struct _PangoOTRulesetClass PangoOTRulesetClass;
......@@ -79,7 +79,7 @@ struct _PangoOTRulesetClass
struct _PangoOTBuffer
{
HB_Buffer buffer;
hb_buffer_t *buffer;
gboolean should_free_hb_buffer;
PangoFcFont *font;
guint rtl : 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment