Mark internal symbols as HB_INTERNAL and define that to static in

2007-10-11  Behdad Esfahbod  <behdad@gnome.org>

        * pango/opentype/*: Mark internal symbols as HB_INTERNAL and
        define that to static in harfbuzz.c.

        * pango/opentype/harfbuzz-buffer-internal.h: New file.
This commit is contained in:
Behdad Esfahbod 2007-10-11 08:30:50 +00:00 committed by Behdad Esfahbod
parent 7cdfb61dee
commit 6b347138b5
16 changed files with 315 additions and 235 deletions

View File

@ -28,6 +28,7 @@ PUBLICHEADERS = \
PRIVATEHEADERS = \ PRIVATEHEADERS = \
ftglue.h \ ftglue.h \
harfbuzz-impl.h \ harfbuzz-impl.h \
harfbuzz-buffer-private.h \
harfbuzz-gdef-private.h \ harfbuzz-gdef-private.h \
harfbuzz-gpos-private.h \ harfbuzz-gpos-private.h \
harfbuzz-gsub-private.h \ harfbuzz-gsub-private.h \

View File

@ -51,7 +51,7 @@ _hb_ftglue_qalloc( FT_ULong size,
#define QALLOC(ptr,size) ( (ptr) = _hb_ftglue_qalloc( (size), &error ), error != 0 ) #define QALLOC(ptr,size) ( (ptr) = _hb_ftglue_qalloc( (size), &error ), error != 0 )
FT_Pointer HB_INTERNAL FT_Pointer
_hb_ftglue_alloc( FT_ULong size, _hb_ftglue_alloc( FT_ULong size,
HB_Error *perror ) HB_Error *perror )
{ {
@ -72,7 +72,7 @@ _hb_ftglue_alloc( FT_ULong size,
} }
FT_Pointer HB_INTERNAL FT_Pointer
_hb_ftglue_realloc( FT_Pointer block, _hb_ftglue_realloc( FT_Pointer block,
FT_ULong new_size, FT_ULong new_size,
HB_Error *perror ) HB_Error *perror )
@ -92,7 +92,7 @@ _hb_ftglue_realloc( FT_Pointer block,
} }
void HB_INTERNAL void
_hb_ftglue_free( FT_Pointer block ) _hb_ftglue_free( FT_Pointer block )
{ {
if ( block ) if ( block )
@ -100,7 +100,7 @@ _hb_ftglue_free( FT_Pointer block )
} }
FT_Long HB_INTERNAL FT_Long
_hb_ftglue_stream_pos( FT_Stream stream ) _hb_ftglue_stream_pos( FT_Stream stream )
{ {
LOG(( "ftglue:stream:pos() -> %ld\n", stream->pos )); LOG(( "ftglue:stream:pos() -> %ld\n", stream->pos ));
@ -108,7 +108,7 @@ _hb_ftglue_stream_pos( FT_Stream stream )
} }
HB_Error HB_INTERNAL HB_Error
_hb_ftglue_stream_seek( FT_Stream stream, _hb_ftglue_stream_seek( FT_Stream stream,
FT_Long pos ) FT_Long pos )
{ {
@ -128,7 +128,7 @@ _hb_ftglue_stream_seek( FT_Stream stream,
} }
HB_Error HB_INTERNAL HB_Error
_hb_ftglue_stream_frame_enter( FT_Stream stream, _hb_ftglue_stream_frame_enter( FT_Stream stream,
FT_ULong count ) FT_ULong count )
{ {
@ -176,7 +176,7 @@ Exit:
} }
void HB_INTERNAL void
_hb_ftglue_stream_frame_exit( FT_Stream stream ) _hb_ftglue_stream_frame_exit( FT_Stream stream )
{ {
if ( stream->read ) if ( stream->read )
@ -190,7 +190,7 @@ _hb_ftglue_stream_frame_exit( FT_Stream stream )
} }
HB_Error HB_INTERNAL HB_Error
_hb_ftglue_face_goto_table( FT_Face face, _hb_ftglue_face_goto_table( FT_Face face,
FT_ULong the_tag, FT_ULong the_tag,
FT_Stream stream ) FT_Stream stream )
@ -280,7 +280,7 @@ Exit:
/* abuse these private header/source files */ /* abuse these private header/source files */
/* helper func to set a breakpoint on */ /* helper func to set a breakpoint on */
HB_Error HB_INTERNAL HB_Error
_hb_err (HB_Error code) _hb_err (HB_Error code)
{ {
return code; return code;

View File

@ -46,6 +46,7 @@
#include <ft2build.h> #include <ft2build.h>
#include FT_FREETYPE_H #include FT_FREETYPE_H
#include "harfbuzz-impl.h"
#include "harfbuzz-open.h" #include "harfbuzz-open.h"
FT_BEGIN_HEADER FT_BEGIN_HEADER
@ -83,21 +84,21 @@ FT_BEGIN_HEADER
#define GET_ULong() ((FT_ULong)GET_Long()) #define GET_ULong() ((FT_ULong)GET_Long())
#define GET_Tag4() GET_ULong() #define GET_Tag4() GET_ULong()
FT_Long HB_INTERNAL FT_Long
_hb_ftglue_stream_pos( FT_Stream stream ); _hb_ftglue_stream_pos( FT_Stream stream );
HB_Error HB_INTERNAL HB_Error
_hb_ftglue_stream_seek( FT_Stream stream, _hb_ftglue_stream_seek( FT_Stream stream,
FT_Long pos ); FT_Long pos );
HB_Error HB_INTERNAL HB_Error
_hb_ftglue_stream_frame_enter( FT_Stream stream, _hb_ftglue_stream_frame_enter( FT_Stream stream,
FT_ULong size ); FT_ULong size );
void HB_INTERNAL void
_hb_ftglue_stream_frame_exit( FT_Stream stream ); _hb_ftglue_stream_frame_exit( FT_Stream stream );
HB_Error HB_INTERNAL HB_Error
_hb_ftglue_face_goto_table( FT_Face face, _hb_ftglue_face_goto_table( FT_Face face,
FT_ULong tag, FT_ULong tag,
FT_Stream stream ); FT_Stream stream );
@ -127,22 +128,23 @@ _hb_ftglue_face_goto_table( FT_Face face,
#define MEM_Copy(dest,source,count) memcpy( (char*)(dest), (const char*)(source), (size_t)(count) ) #define MEM_Copy(dest,source,count) memcpy( (char*)(dest), (const char*)(source), (size_t)(count) )
FT_Pointer HB_INTERNAL FT_Pointer
_hb_ftglue_alloc( FT_ULong size, _hb_ftglue_alloc( FT_ULong size,
HB_Error *perror_ ); HB_Error *perror_ );
FT_Pointer HB_INTERNAL FT_Pointer
_hb_ftglue_realloc( FT_Pointer block, _hb_ftglue_realloc( FT_Pointer block,
FT_ULong new_size, FT_ULong new_size,
HB_Error *perror_ ); HB_Error *perror_ );
void HB_INTERNAL void
_hb_ftglue_free( FT_Pointer block ); _hb_ftglue_free( FT_Pointer block );
/* abuse these private header/source files */ /* abuse these private header/source files */
/* helper func to set a breakpoint on */ /* helper func to set a breakpoint on */
HB_Error _hb_err (HB_Error code); HB_INTERNAL HB_Error
_hb_err (HB_Error code);
FT_END_HEADER FT_END_HEADER

View File

@ -0,0 +1,60 @@
/* harfbuzz-buffer-private.h: Buffer of glyphs for substitution/positioning
*
* Copyright 2004,7 Red Hat Software
*
* Portions Copyright 1996-2000 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
* modified and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*/
#ifndef HARFBUZZ_BUFFER_PRIVATE_H
#define HARFBUZZ_BUFFER_PRIVATE_H
#include "harfbuzz-impl.h"
#include "harfbuzz-buffer.h"
FT_BEGIN_HEADER
#define HB_GLYPH_PROPERTIES_UNKNOWN 0xFFFF
HB_INTERNAL void
_hb_buffer_swap( HB_Buffer buffer );
HB_INTERNAL void
_hb_buffer_clear_output( HB_Buffer buffer );
HB_INTERNAL HB_Error
_hb_buffer_clear_positions( HB_Buffer buffer );
HB_INTERNAL HB_Error
_hb_buffer_add_output_glyphs( HB_Buffer buffer,
FT_UShort num_in,
FT_UShort num_out,
FT_UShort *glyph_data,
FT_UShort component,
FT_UShort ligID );
HB_INTERNAL HB_Error
_hb_buffer_add_output_glyph ( HB_Buffer buffer,
FT_UInt glyph_index,
FT_UShort component,
FT_UShort ligID );
HB_INTERNAL HB_Error
_hb_buffer_copy_output_glyph ( HB_Buffer buffer );
HB_INTERNAL HB_Error
_hb_buffer_replace_output_glyph ( HB_Buffer buffer,
FT_UInt glyph_index,
FT_Bool inplace );
HB_INTERNAL FT_UShort
_hb_buffer_allocate_ligid( HB_Buffer buffer );
FT_END_HEADER
#endif /* HARFBUZZ_BUFFER_PRIVATE_H */

View File

@ -7,7 +7,7 @@
*/ */
#include "harfbuzz-impl.h" #include "harfbuzz-impl.h"
#include "harfbuzz-buffer.h" #include "harfbuzz-buffer-private.h"
#include "harfbuzz-gsub-private.h" #include "harfbuzz-gsub-private.h"
#include "harfbuzz-gpos-private.h" #include "harfbuzz-gpos-private.h"
@ -38,6 +38,8 @@
* to in_string (FALSE) or alt_string (TRUE). * to in_string (FALSE) or alt_string (TRUE).
*/ */
/* Internal API */
static HB_Error static HB_Error
hb_buffer_ensure( HB_Buffer buffer, hb_buffer_ensure( HB_Buffer buffer,
FT_ULong size ) FT_ULong size )
@ -102,6 +104,8 @@ hb_buffer_duplicate_out_buffer( HB_Buffer buffer )
return HB_Err_Ok; return HB_Err_Ok;
} }
/* Public API */
HB_Error HB_Error
hb_buffer_new( HB_Buffer *pbuffer ) hb_buffer_new( HB_Buffer *pbuffer )
{ {
@ -145,8 +149,36 @@ hb_buffer_clear( HB_Buffer buffer )
buffer->max_ligID = 0; buffer->max_ligID = 0;
} }
void HB_Error
hb_buffer_clear_output( HB_Buffer buffer ) hb_buffer_add_glyph( HB_Buffer buffer,
FT_UInt glyph_index,
FT_UInt properties,
FT_UInt cluster )
{
HB_Error error;
HB_GlyphItem glyph;
error = hb_buffer_ensure( buffer, buffer->in_length + 1 );
if ( error )
return error;
glyph = &buffer->in_string[buffer->in_length];
glyph->gindex = glyph_index;
glyph->properties = properties;
glyph->cluster = cluster;
glyph->component = 0;
glyph->ligID = 0;
glyph->gproperties = HB_GLYPH_PROPERTIES_UNKNOWN;
buffer->in_length++;
return HB_Err_Ok;
}
/* HarfBuzz-Internal API */
HB_INTERNAL void
_hb_buffer_clear_output( HB_Buffer buffer )
{ {
buffer->out_length = 0; buffer->out_length = 0;
buffer->out_pos = 0; buffer->out_pos = 0;
@ -154,8 +186,8 @@ hb_buffer_clear_output( HB_Buffer buffer )
buffer->separate_out = FALSE; buffer->separate_out = FALSE;
} }
HB_Error HB_INTERNAL HB_Error
hb_buffer_clear_positions( HB_Buffer buffer ) _hb_buffer_clear_positions( HB_Buffer buffer )
{ {
if ( !buffer->positions ) if ( !buffer->positions )
{ {
@ -170,8 +202,8 @@ hb_buffer_clear_positions( HB_Buffer buffer )
return HB_Err_Ok; return HB_Err_Ok;
} }
void HB_INTERNAL void
hb_buffer_swap( HB_Buffer buffer ) _hb_buffer_swap( HB_Buffer buffer )
{ {
HB_GlyphItem tmp_string; HB_GlyphItem tmp_string;
int tmp_length; int tmp_length;
@ -194,32 +226,6 @@ hb_buffer_swap( HB_Buffer buffer )
buffer->out_pos = tmp_pos; buffer->out_pos = tmp_pos;
} }
HB_Error
hb_buffer_add_glyph( HB_Buffer buffer,
FT_UInt glyph_index,
FT_UInt properties,
FT_UInt cluster )
{
HB_Error error;
HB_GlyphItem glyph;
error = hb_buffer_ensure( buffer, buffer->in_length + 1 );
if ( error )
return error;
glyph = &buffer->in_string[buffer->in_length];
glyph->gindex = glyph_index;
glyph->properties = properties;
glyph->cluster = cluster;
glyph->component = 0;
glyph->ligID = 0;
glyph->gproperties = HB_GLYPH_PROPERTIES_UNKNOWN;
buffer->in_length++;
return HB_Err_Ok;
}
/* The following function copies `num_out' elements from `glyph_data' /* The following function copies `num_out' elements from `glyph_data'
to `buffer->out_string', advancing the in array pointer in the structure to `buffer->out_string', advancing the in array pointer in the structure
by `num_in' elements, and the out array pointer by `num_out' elements. by `num_in' elements, and the out array pointer by `num_out' elements.
@ -239,8 +245,8 @@ hb_buffer_add_glyph( HB_Buffer buffer,
The cluster value for the glyph at position buffer->in_pos is used The cluster value for the glyph at position buffer->in_pos is used
for all replacement glyphs */ for all replacement glyphs */
HB_Error HB_INTERNAL HB_Error
hb_buffer_add_output_glyphs( HB_Buffer buffer, _hb_buffer_add_output_glyphs( HB_Buffer buffer,
FT_UShort num_in, FT_UShort num_in,
FT_UShort num_out, FT_UShort num_out,
FT_UShort *glyph_data, FT_UShort *glyph_data,
@ -290,20 +296,20 @@ hb_buffer_add_output_glyphs( HB_Buffer buffer,
return HB_Err_Ok; return HB_Err_Ok;
} }
HB_Error HB_INTERNAL HB_Error
hb_buffer_add_output_glyph( HB_Buffer buffer, _hb_buffer_add_output_glyph( HB_Buffer buffer,
FT_UInt glyph_index, FT_UInt glyph_index,
FT_UShort component, FT_UShort component,
FT_UShort ligID ) FT_UShort ligID )
{ {
FT_UShort glyph_data = glyph_index; FT_UShort glyph_data = glyph_index;
return hb_buffer_add_output_glyphs ( buffer, 1, 1, return _hb_buffer_add_output_glyphs ( buffer, 1, 1,
&glyph_data, component, ligID ); &glyph_data, component, ligID );
} }
HB_Error HB_INTERNAL HB_Error
hb_buffer_copy_output_glyph ( HB_Buffer buffer ) _hb_buffer_copy_output_glyph ( HB_Buffer buffer )
{ {
HB_Error error; HB_Error error;
@ -323,17 +329,17 @@ hb_buffer_copy_output_glyph ( HB_Buffer buffer )
return HB_Err_Ok; return HB_Err_Ok;
} }
HB_Error HB_INTERNAL HB_Error
hb_buffer_replace_output_glyph( HB_Buffer buffer, _hb_buffer_replace_output_glyph( HB_Buffer buffer,
FT_UInt glyph_index, FT_UInt glyph_index,
FT_Bool inplace ) FT_Bool inplace )
{ {
HB_Error error; HB_Error error;
if ( inplace ) if ( inplace )
{ {
error = hb_buffer_copy_output_glyph ( buffer ); error = _hb_buffer_copy_output_glyph ( buffer );
if ( error ) if ( error )
return error; return error;
@ -341,14 +347,14 @@ hb_buffer_replace_output_glyph( HB_Buffer buffer,
} }
else 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; return HB_Err_Ok;
} }
FT_UShort HB_INTERNAL FT_UShort
hb_buffer_allocate_ligid( HB_Buffer buffer ) _hb_buffer_allocate_ligid( HB_Buffer buffer )
{ {
return ++buffer->max_ligID; return ++buffer->max_ligID;
} }

View File

@ -1,6 +1,6 @@
/* harfbuzz-buffer.h: Buffer of glyphs for substitution/positioning /* harfbuzz-buffer.h: Buffer of glyphs for substitution/positioning
* *
* Copyrigh 2004 Red Hat Software * Copyright 2004,7 Red Hat Software
* *
* Portions Copyright 1996-2000 by * Portions Copyright 1996-2000 by
* David Turner, Robert Wilhelm, and Werner Lemberg. * David Turner, Robert Wilhelm, and Werner Lemberg.
@ -19,8 +19,6 @@
FT_BEGIN_HEADER FT_BEGIN_HEADER
#define HB_GLYPH_PROPERTIES_UNKNOWN 0xFFFF
typedef struct HB_GlyphItemRec_ { typedef struct HB_GlyphItemRec_ {
FT_UInt gindex; FT_UInt gindex;
FT_UInt properties; FT_UInt properties;
@ -66,52 +64,18 @@ typedef struct HB_BufferRec_{
HB_Error HB_Error
hb_buffer_new( HB_Buffer *buffer ); hb_buffer_new( HB_Buffer *buffer );
void
hb_buffer_swap( HB_Buffer buffer );
void void
hb_buffer_free( HB_Buffer buffer ); hb_buffer_free( HB_Buffer buffer );
void void
hb_buffer_clear( HB_Buffer buffer ); hb_buffer_clear( HB_Buffer buffer );
void
hb_buffer_clear_output( HB_Buffer buffer );
HB_Error
hb_buffer_clear_positions( HB_Buffer buffer );
HB_Error HB_Error
hb_buffer_add_glyph( HB_Buffer buffer, hb_buffer_add_glyph( HB_Buffer buffer,
FT_UInt glyph_index, FT_UInt glyph_index,
FT_UInt properties, FT_UInt properties,
FT_UInt cluster ); FT_UInt cluster );
HB_Error
hb_buffer_add_output_glyphs( HB_Buffer buffer,
FT_UShort num_in,
FT_UShort num_out,
FT_UShort *glyph_data,
FT_UShort component,
FT_UShort ligID );
HB_Error
hb_buffer_add_output_glyph ( HB_Buffer buffer,
FT_UInt glyph_index,
FT_UShort component,
FT_UShort ligID );
HB_Error
hb_buffer_copy_output_glyph ( HB_Buffer buffer );
HB_Error
hb_buffer_replace_output_glyph ( HB_Buffer buffer,
FT_UInt glyph_index,
FT_Bool inplace );
FT_UShort
hb_buffer_allocate_ligid( HB_Buffer buffer );
FT_END_HEADER FT_END_HEADER
#endif /* HARFBUZZ_BUFFER_H */ #endif /* HARFBUZZ_BUFFER_H */

View File

@ -13,6 +13,7 @@
#ifndef HARFBUZZ_GDEF_PRIVATE_H #ifndef HARFBUZZ_GDEF_PRIVATE_H
#define HARFBUZZ_GDEF_PRIVATE_H #define HARFBUZZ_GDEF_PRIVATE_H
#include "harfbuzz-impl.h"
#include "harfbuzz-gdef.h" #include "harfbuzz-gdef.h"
#include "harfbuzz-buffer.h" #include "harfbuzz-buffer.h"
@ -87,14 +88,16 @@ struct HB_LigGlyph_
}; };
HB_Error _HB_GDEF_Add_Glyph_Property( HB_GDEFHeader* gdef, HB_INTERNAL HB_Error
FT_UShort glyphID, _HB_GDEF_Add_Glyph_Property( HB_GDEFHeader* gdef,
FT_UShort property ); FT_UShort glyphID,
FT_UShort property );
HB_Error _HB_GDEF_Check_Property( HB_GDEFHeader* gdef, HB_INTERNAL HB_Error
HB_GlyphItem item, _HB_GDEF_Check_Property( HB_GDEFHeader* gdef,
FT_UShort flags, HB_GlyphItem item,
FT_UShort* property ); FT_UShort flags,
FT_UShort* property );
FT_END_HEADER FT_END_HEADER

View File

@ -762,7 +762,7 @@ HB_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef,
FT_UShort glyphID, FT_UShort glyphID,
FT_UShort* property ) FT_UShort* property )
{ {
FT_UShort class, index; FT_UShort class = 0, index = 0; /* shut compiler up */
HB_Error error; HB_Error error;
@ -1057,12 +1057,13 @@ static void Free_NewGlyphClasses( HB_GDEFHeader* gdef )
} }
HB_Error _HB_GDEF_Add_Glyph_Property( HB_GDEFHeader* gdef, HB_INTERNAL HB_Error
FT_UShort glyphID, _HB_GDEF_Add_Glyph_Property( HB_GDEFHeader* gdef,
FT_UShort property ) FT_UShort glyphID,
FT_UShort property )
{ {
HB_Error error; HB_Error error;
FT_UShort class, new_class, index; FT_UShort class, new_class, index = 0; /* shut compiler up */
FT_UShort byte, bits, mask; FT_UShort byte, bits, mask;
FT_UShort array_index, glyph_index, count; FT_UShort array_index, glyph_index, count;
@ -1142,10 +1143,11 @@ HB_Error _HB_GDEF_Add_Glyph_Property( HB_GDEFHeader* gdef,
} }
HB_Error _HB_GDEF_Check_Property( HB_GDEFHeader* gdef, HB_INTERNAL HB_Error
HB_GlyphItem gitem, _HB_GDEF_Check_Property( HB_GDEFHeader* gdef,
FT_UShort flags, HB_GlyphItem gitem,
FT_UShort* property ) FT_UShort flags,
FT_UShort* property )
{ {
HB_Error error; HB_Error error;

View File

@ -13,6 +13,7 @@
#ifndef HARFBUZZ_GPOS_PRIVATE_H #ifndef HARFBUZZ_GPOS_PRIVATE_H
#define HARFBUZZ_GPOS_PRIVATE_H #define HARFBUZZ_GPOS_PRIVATE_H
#include "harfbuzz-impl.h"
#include "harfbuzz-gpos.h" #include "harfbuzz-gpos.h"
FT_BEGIN_HEADER FT_BEGIN_HEADER
@ -670,12 +671,14 @@ typedef union HB_GPOS_SubTable_ HB_GPOS_SubTable;
HB_Error _HB_GPOS_Load_SubTable( HB_GPOS_SubTable* st, HB_INTERNAL HB_Error
FT_Stream stream, _HB_GPOS_Load_SubTable( HB_GPOS_SubTable* st,
FT_UShort lookup_type ); FT_Stream stream,
FT_UShort lookup_type );
void _HB_GPOS_Free_SubTable( HB_GPOS_SubTable* st, HB_INTERNAL void
FT_UShort lookup_type ); _HB_GPOS_Free_SubTable( HB_GPOS_SubTable* st,
FT_UShort lookup_type );
FT_END_HEADER FT_END_HEADER

View File

@ -1533,7 +1533,7 @@ static HB_Error Lookup_PairPos2( GPOS_Instance* gpi,
FT_UShort format2 ) FT_UShort format2 )
{ {
HB_Error error; HB_Error error;
FT_UShort cl1, cl2; FT_UShort cl1 = 0, cl2 = 0; /* shut compiler up */
HB_Class1Record* c1r; HB_Class1Record* c1r;
HB_Class2Record* c2r; HB_Class2Record* c2r;
@ -5877,9 +5877,10 @@ static HB_Error GPOS_Do_Glyph_Lookup( GPOS_Instance* gpi,
} }
HB_Error _HB_GPOS_Load_SubTable( HB_GPOS_SubTable* st, HB_INTERNAL HB_Error
FT_Stream stream, _HB_GPOS_Load_SubTable( HB_GPOS_SubTable* st,
FT_UShort lookup_type ) FT_Stream stream,
FT_UShort lookup_type )
{ {
switch ( lookup_type ) { switch ( lookup_type ) {
case HB_GPOS_LOOKUP_SINGLE: return Load_SinglePos ( st, stream ); case HB_GPOS_LOOKUP_SINGLE: return Load_SinglePos ( st, stream );
@ -5896,8 +5897,9 @@ HB_Error _HB_GPOS_Load_SubTable( HB_GPOS_SubTable* st,
} }
void _HB_GPOS_Free_SubTable( HB_GPOS_SubTable* st, HB_INTERNAL void
FT_UShort lookup_type ) _HB_GPOS_Free_SubTable( HB_GPOS_SubTable* st,
FT_UShort lookup_type )
{ {
switch ( lookup_type ) { switch ( lookup_type ) {
case HB_GPOS_LOOKUP_SINGLE: Free_SinglePos ( st ); return; case HB_GPOS_LOOKUP_SINGLE: Free_SinglePos ( st ); return;
@ -6110,7 +6112,7 @@ HB_Error HB_GPOS_Apply_String( FT_Face face,
if ( num_features ) if ( num_features )
{ {
error = hb_buffer_clear_positions( buffer ); error = _hb_buffer_clear_positions( buffer );
if ( error ) if ( error )
return error; return error;
} }

View File

@ -13,6 +13,7 @@
#ifndef HARFBUZZ_GSUB_PRIVATE_H #ifndef HARFBUZZ_GSUB_PRIVATE_H
#define HARFBUZZ_GSUB_PRIVATE_H #define HARFBUZZ_GSUB_PRIVATE_H
#include "harfbuzz-impl.h"
#include "harfbuzz-gsub.h" #include "harfbuzz-gsub.h"
FT_BEGIN_HEADER FT_BEGIN_HEADER
@ -434,13 +435,14 @@ union HB_GSUB_SubTable_
HB_INTERNAL HB_Error
_HB_GSUB_Load_SubTable( HB_GSUB_SubTable* st,
FT_Stream stream,
FT_UShort lookup_type );
HB_Error _HB_GSUB_Load_SubTable( HB_GSUB_SubTable* st, HB_INTERNAL void
FT_Stream stream, _HB_GSUB_Free_SubTable( HB_GSUB_SubTable* st,
FT_UShort lookup_type ); FT_UShort lookup_type );
void _HB_GSUB_Free_SubTable( HB_GSUB_SubTable* st,
FT_UShort lookup_type );
FT_END_HEADER FT_END_HEADER

View File

@ -1042,7 +1042,7 @@ static HB_Error Lookup_LigatureSubst( HB_GSUBHeader* gsub,
} }
else else
{ {
FT_UShort ligID = hb_buffer_allocate_ligid( buffer ); FT_UShort ligID = _hb_buffer_allocate_ligid( buffer );
if ( ADD_String( buffer, i, 1, &lig->LigGlyph, if ( ADD_String( buffer, i, 1, &lig->LigGlyph,
0xFFFF, ligID ) ) 0xFFFF, ligID ) )
return error; return error;
@ -1050,7 +1050,7 @@ static HB_Error Lookup_LigatureSubst( HB_GSUBHeader* gsub,
} }
else else
{ {
FT_UShort ligID = hb_buffer_allocate_ligid( buffer ); FT_UShort ligID = _hb_buffer_allocate_ligid( buffer );
if ( ADD_Glyph( buffer, lig->LigGlyph, 0xFFFF, ligID ) ) if ( ADD_Glyph( buffer, lig->LigGlyph, 0xFFFF, ligID ) )
return error; return error;
@ -4112,9 +4112,10 @@ static HB_Error GSUB_Do_Glyph_Lookup( HB_GSUBHeader* gsub,
} }
HB_Error _HB_GSUB_Load_SubTable( HB_GSUB_SubTable* st, HB_INTERNAL HB_Error
FT_Stream stream, _HB_GSUB_Load_SubTable( HB_GSUB_SubTable* st,
FT_UShort lookup_type ) FT_Stream stream,
FT_UShort lookup_type )
{ {
switch (lookup_type) { switch (lookup_type) {
case HB_GSUB_LOOKUP_SINGLE: return Load_SingleSubst ( st, stream ); case HB_GSUB_LOOKUP_SINGLE: return Load_SingleSubst ( st, stream );
@ -4130,8 +4131,9 @@ HB_Error _HB_GSUB_Load_SubTable( HB_GSUB_SubTable* st,
} }
void _HB_GSUB_Free_SubTable( HB_GSUB_SubTable* st, HB_INTERNAL void
FT_UShort lookup_type ) _HB_GSUB_Free_SubTable( HB_GSUB_SubTable* st,
FT_UShort lookup_type )
{ {
switch ( lookup_type ) { switch ( lookup_type ) {
case HB_GSUB_LOOKUP_SINGLE: Free_SingleSubst ( st ); return; case HB_GSUB_LOOKUP_SINGLE: Free_SingleSubst ( st ); return;
@ -4173,7 +4175,7 @@ static HB_Error GSUB_Do_String_Lookup( HB_GSUBHeader* gsub,
case HB_GSUB_LOOKUP_CHAIN: case HB_GSUB_LOOKUP_CHAIN:
/* in/out forward substitution (implemented lazy) */ /* in/out forward substitution (implemented lazy) */
hb_buffer_clear_output ( buffer ); _hb_buffer_clear_output ( buffer );
buffer->in_pos = 0; buffer->in_pos = 0;
while ( buffer->in_pos < buffer->in_length ) while ( buffer->in_pos < buffer->in_length )
{ {
@ -4201,7 +4203,7 @@ static HB_Error GSUB_Do_String_Lookup( HB_GSUBHeader* gsub,
* shouldn't matter in that case though. * shouldn't matter in that case though.
*/ */
if ( retError == HB_Err_Ok ) if ( retError == HB_Err_Ok )
hb_buffer_swap( buffer ); _hb_buffer_swap( buffer );
return retError; return retError;

View File

@ -19,6 +19,10 @@
FT_BEGIN_HEADER FT_BEGIN_HEADER
#ifndef HB_INTERNAL
# define HB_INTERNAL
#endif
#ifndef NULL #ifndef NULL
# define NULL ((void *)0) # define NULL ((void *)0)
#endif #endif
@ -68,19 +72,19 @@ FT_BEGIN_HEADER
(property) ) ) != HB_Err_Ok ) (property) ) ) != HB_Err_Ok )
#define ADD_String( buffer, num_in, num_out, glyph_data, component, ligID ) \ #define ADD_String( buffer, num_in, num_out, glyph_data, component, ligID ) \
( ( error = hb_buffer_add_output_glyphs( (buffer), \ ( ( error = _hb_buffer_add_output_glyphs( (buffer), \
(num_in), (num_out), \ (num_in), (num_out), \
(glyph_data), (component), (ligID) \ (glyph_data), (component), (ligID) \
) ) != HB_Err_Ok ) ) ) != HB_Err_Ok )
#define ADD_Glyph( buffer, glyph_index, component, ligID ) \ #define ADD_Glyph( buffer, glyph_index, component, ligID ) \
( ( error = hb_buffer_add_output_glyph( (buffer), \ ( ( error = _hb_buffer_add_output_glyph( (buffer), \
(glyph_index), (component), (ligID) \ (glyph_index), (component), (ligID) \
) ) != HB_Err_Ok ) ) ) != HB_Err_Ok )
#define REPLACE_Glyph( buffer, glyph_index, nesting_level ) \ #define REPLACE_Glyph( buffer, glyph_index, nesting_level ) \
( ( error = hb_buffer_replace_output_glyph( (buffer), (glyph_index), \ ( ( error = _hb_buffer_replace_output_glyph( (buffer), (glyph_index), \
(nesting_level) == 1 ) ) != HB_Err_Ok ) (nesting_level) == 1 ) ) != HB_Err_Ok )
#define COPY_Glyph( buffer ) \ #define COPY_Glyph( buffer ) \
( (error = hb_buffer_copy_output_glyph ( buffer ) ) != HB_Err_Ok ) ( (error = _hb_buffer_copy_output_glyph ( buffer ) ) != HB_Err_Ok )
FT_END_HEADER FT_END_HEADER

View File

@ -13,6 +13,7 @@
#ifndef HARFBUZZ_OPEN_PRIVATE_H #ifndef HARFBUZZ_OPEN_PRIVATE_H
#define HARFBUZZ_OPEN_PRIVATE_H #define HARFBUZZ_OPEN_PRIVATE_H
#include "harfbuzz-impl.h"
#include "harfbuzz-open.h" #include "harfbuzz-open.h"
#include "harfbuzz-gsub-private.h" #include "harfbuzz-gsub-private.h"
#include "harfbuzz-gpos-private.h" #include "harfbuzz-gpos-private.h"
@ -30,48 +31,58 @@ struct HB_SubTable_
}; };
HB_Error _HB_OPEN_Load_ScriptList( HB_ScriptList* sl, HB_INTERNAL HB_Error
_HB_OPEN_Load_ScriptList( HB_ScriptList* sl,
FT_Stream stream ); FT_Stream stream );
HB_Error _HB_OPEN_Load_FeatureList( HB_FeatureList* fl, HB_INTERNAL HB_Error
FT_Stream input ); _HB_OPEN_Load_FeatureList( HB_FeatureList* fl,
HB_Error _HB_OPEN_Load_LookupList( HB_LookupList* ll, FT_Stream input );
FT_Stream input, HB_INTERNAL HB_Error
HB_Type type ); _HB_OPEN_Load_LookupList( HB_LookupList* ll,
FT_Stream input,
HB_Type type );
HB_Error _HB_OPEN_Load_Coverage( HB_Coverage* c, HB_INTERNAL HB_Error
FT_Stream input ); _HB_OPEN_Load_Coverage( HB_Coverage* c,
HB_Error _HB_OPEN_Load_ClassDefinition( HB_ClassDefinition* cd, FT_Stream input );
FT_UShort limit, HB_INTERNAL HB_Error
FT_Stream input ); _HB_OPEN_Load_ClassDefinition( HB_ClassDefinition* cd,
HB_Error _HB_OPEN_Load_EmptyOrClassDefinition( HB_ClassDefinition* cd, FT_UShort limit,
FT_UShort limit, FT_Stream input );
FT_ULong class_offset, HB_INTERNAL HB_Error
FT_ULong base_offset, _HB_OPEN_Load_EmptyOrClassDefinition( HB_ClassDefinition* cd,
FT_Stream stream ); FT_UShort limit,
HB_Error _HB_OPEN_Load_Device( HB_Device* d, FT_ULong class_offset,
FT_Stream input ); FT_ULong base_offset,
FT_Stream stream );
HB_INTERNAL HB_Error
_HB_OPEN_Load_Device( HB_Device* d,
FT_Stream input );
void _HB_OPEN_Free_ScriptList( HB_ScriptList* sl ); HB_INTERNAL void _HB_OPEN_Free_ScriptList( HB_ScriptList* sl );
void _HB_OPEN_Free_FeatureList( HB_FeatureList* fl ); HB_INTERNAL void _HB_OPEN_Free_FeatureList( HB_FeatureList* fl );
void _HB_OPEN_Free_LookupList( HB_LookupList* ll, HB_INTERNAL void _HB_OPEN_Free_LookupList( HB_LookupList* ll,
HB_Type type ); HB_Type type );
void _HB_OPEN_Free_Coverage( HB_Coverage* c ); HB_INTERNAL void _HB_OPEN_Free_Coverage( HB_Coverage* c );
void _HB_OPEN_Free_ClassDefinition( HB_ClassDefinition* cd ); HB_INTERNAL void _HB_OPEN_Free_ClassDefinition( HB_ClassDefinition* cd );
void _HB_OPEN_Free_Device( HB_Device* d ); HB_INTERNAL void _HB_OPEN_Free_Device( HB_Device* d );
HB_Error _HB_OPEN_Coverage_Index( HB_Coverage* c, HB_INTERNAL HB_Error
FT_UShort glyphID, _HB_OPEN_Coverage_Index( HB_Coverage* c,
FT_UShort* index ); FT_UShort glyphID,
HB_Error _HB_OPEN_Get_Class( HB_ClassDefinition* cd, FT_UShort* index );
FT_UShort glyphID, HB_INTERNAL HB_Error
FT_UShort* class, _HB_OPEN_Get_Class( HB_ClassDefinition* cd,
FT_UShort* index ); FT_UShort glyphID,
HB_Error _HB_OPEN_Get_Device( HB_Device* d, FT_UShort* klass,
FT_UShort size, FT_UShort* index );
FT_Short* value ); HB_INTERNAL HB_Error
_HB_OPEN_Get_Device( HB_Device* d,
FT_UShort size,
FT_Short* value );
FT_END_HEADER FT_END_HEADER

View File

@ -184,8 +184,9 @@ static void Free_Script( HB_Script* s )
/* ScriptList */ /* ScriptList */
HB_Error _HB_OPEN_Load_ScriptList( HB_ScriptList* sl, HB_INTERNAL HB_Error
FT_Stream stream ) _HB_OPEN_Load_ScriptList( HB_ScriptList* sl,
FT_Stream stream )
{ {
HB_Error error; HB_Error error;
@ -258,7 +259,8 @@ Fail:
} }
void _HB_OPEN_Free_ScriptList( HB_ScriptList* sl ) HB_INTERNAL void
_HB_OPEN_Free_ScriptList( HB_ScriptList* sl )
{ {
FT_UShort n, count; FT_UShort n, count;
@ -334,8 +336,9 @@ static void Free_Feature( HB_Feature* f )
/* FeatureList */ /* FeatureList */
HB_Error _HB_OPEN_Load_FeatureList( HB_FeatureList* fl, HB_INTERNAL HB_Error
FT_Stream stream ) _HB_OPEN_Load_FeatureList( HB_FeatureList* fl,
FT_Stream stream )
{ {
HB_Error error; HB_Error error;
@ -397,7 +400,8 @@ Fail2:
} }
void _HB_OPEN_Free_FeatureList( HB_FeatureList* fl ) HB_INTERNAL void
_HB_OPEN_Free_FeatureList( HB_FeatureList* fl )
{ {
FT_UShort n, count; FT_UShort n, count;
@ -557,9 +561,10 @@ static void Free_Lookup( HB_Lookup* l,
/* LookupList */ /* LookupList */
HB_Error _HB_OPEN_Load_LookupList( HB_LookupList* ll, HB_INTERNAL HB_Error
FT_Stream stream, _HB_OPEN_Load_LookupList( HB_LookupList* ll,
HB_Type type ) FT_Stream stream,
HB_Type type )
{ {
HB_Error error; HB_Error error;
@ -617,8 +622,9 @@ Fail2:
} }
void _HB_OPEN_Free_LookupList( HB_LookupList* ll, HB_INTERNAL void
HB_Type type ) _HB_OPEN_Free_LookupList( HB_LookupList* ll,
HB_Type type )
{ {
FT_UShort n, count; FT_UShort n, count;
@ -754,8 +760,9 @@ static void Free_Coverage2( HB_CoverageFormat2* cf2 )
} }
HB_Error _HB_OPEN_Load_Coverage( HB_Coverage* c, HB_INTERNAL HB_Error
FT_Stream stream ) _HB_OPEN_Load_Coverage( HB_Coverage* c,
FT_Stream stream )
{ {
HB_Error error; HB_Error error;
@ -777,7 +784,8 @@ HB_Error _HB_OPEN_Load_Coverage( HB_Coverage* c,
} }
void _HB_OPEN_Free_Coverage( HB_Coverage* c ) HB_INTERNAL void
_HB_OPEN_Free_Coverage( HB_Coverage* c )
{ {
switch ( c->CoverageFormat ) switch ( c->CoverageFormat )
{ {
@ -888,9 +896,10 @@ static HB_Error Coverage_Index2( HB_CoverageFormat2* cf2,
} }
HB_Error _HB_OPEN_Coverage_Index( HB_Coverage* c, HB_INTERNAL HB_Error
FT_UShort glyphID, _HB_OPEN_Coverage_Index( HB_Coverage* c,
FT_UShort* index ) FT_UShort glyphID,
FT_UShort* index )
{ {
switch ( c->CoverageFormat ) switch ( c->CoverageFormat )
{ {
@ -1059,9 +1068,10 @@ static void Free_ClassDef2( HB_ClassDefFormat2* cdf2 )
/* ClassDefinition */ /* ClassDefinition */
HB_Error _HB_OPEN_Load_ClassDefinition( HB_ClassDefinition* cd, HB_INTERNAL HB_Error
FT_UShort limit, _HB_OPEN_Load_ClassDefinition( HB_ClassDefinition* cd,
FT_Stream stream ) FT_UShort limit,
FT_Stream stream )
{ {
HB_Error error; HB_Error error;
@ -1095,7 +1105,8 @@ Fail:
} }
static HB_Error _HB_OPEN_Load_EmptyClassDefinition( HB_ClassDefinition* cd ) static HB_Error
_HB_OPEN_Load_EmptyClassDefinition( HB_ClassDefinition* cd )
{ {
HB_Error error; HB_Error error;
@ -1115,11 +1126,12 @@ Fail:
return error; return error;
} }
HB_Error _HB_OPEN_Load_EmptyOrClassDefinition( HB_ClassDefinition* cd, HB_INTERNAL HB_Error
FT_UShort limit, _HB_OPEN_Load_EmptyOrClassDefinition( HB_ClassDefinition* cd,
FT_ULong class_offset, FT_UShort limit,
FT_ULong base_offset, FT_ULong class_offset,
FT_Stream stream ) FT_ULong base_offset,
FT_Stream stream )
{ {
HB_Error error; HB_Error error;
FT_ULong cur_offset; FT_ULong cur_offset;
@ -1140,7 +1152,8 @@ HB_Error _HB_OPEN_Load_EmptyOrClassDefinition( HB_ClassDefinition* cd,
return error; return error;
} }
void _HB_OPEN_Free_ClassDefinition( HB_ClassDefinition* cd ) HB_INTERNAL void
_HB_OPEN_Free_ClassDefinition( HB_ClassDefinition* cd )
{ {
if ( !cd->loaded ) if ( !cd->loaded )
return; return;
@ -1158,7 +1171,7 @@ void _HB_OPEN_Free_ClassDefinition( HB_ClassDefinition* cd )
static HB_Error Get_Class1( HB_ClassDefFormat1* cdf1, static HB_Error Get_Class1( HB_ClassDefFormat1* cdf1,
FT_UShort glyphID, FT_UShort glyphID,
FT_UShort* class, FT_UShort* klass,
FT_UShort* index ) FT_UShort* index )
{ {
FT_UShort* cva = cdf1->ClassValueArray; FT_UShort* cva = cdf1->ClassValueArray;
@ -1170,12 +1183,12 @@ static HB_Error Get_Class1( HB_ClassDefFormat1* cdf1,
if ( glyphID >= cdf1->StartGlyph && if ( glyphID >= cdf1->StartGlyph &&
glyphID < cdf1->StartGlyph + cdf1->GlyphCount ) glyphID < cdf1->StartGlyph + cdf1->GlyphCount )
{ {
*class = cva[glyphID - cdf1->StartGlyph]; *klass = cva[glyphID - cdf1->StartGlyph];
return HB_Err_Ok; return HB_Err_Ok;
} }
else else
{ {
*class = 0; *klass = 0;
return HB_Err_Not_Covered; return HB_Err_Not_Covered;
} }
} }
@ -1186,7 +1199,7 @@ static HB_Error Get_Class1( HB_ClassDefFormat1* cdf1,
static HB_Error Get_Class2( HB_ClassDefFormat2* cdf2, static HB_Error Get_Class2( HB_ClassDefFormat2* cdf2,
FT_UShort glyphID, FT_UShort glyphID,
FT_UShort* class, FT_UShort* klass,
FT_UShort* index ) FT_UShort* index )
{ {
HB_Error error = HB_Err_Ok; HB_Error error = HB_Err_Ok;
@ -1199,7 +1212,7 @@ static HB_Error Get_Class2( HB_ClassDefFormat2* cdf2,
if ( cdf2->ClassRangeCount == 0 ) if ( cdf2->ClassRangeCount == 0 )
{ {
*class = 0; *klass = 0;
if ( index ) if ( index )
*index = 0; *index = 0;
@ -1221,7 +1234,7 @@ static HB_Error Get_Class2( HB_ClassDefFormat2* cdf2,
if ( glyphID >= crr[middle].Start && glyphID <= crr[middle].End ) if ( glyphID >= crr[middle].Start && glyphID <= crr[middle].End )
{ {
*class = crr[middle].Class; *klass = crr[middle].Class;
error = HB_Err_Ok; error = HB_Err_Ok;
break; break;
} }
@ -1229,7 +1242,7 @@ static HB_Error Get_Class2( HB_ClassDefFormat2* cdf2,
{ {
if ( middle == min ) if ( middle == min )
{ {
*class = 0; *klass = 0;
error = HB_Err_Not_Covered; error = HB_Err_Not_Covered;
break; break;
} }
@ -1239,7 +1252,7 @@ static HB_Error Get_Class2( HB_ClassDefFormat2* cdf2,
{ {
if ( middle == max ) if ( middle == max )
{ {
*class = 0; *klass = 0;
error = HB_Err_Not_Covered; error = HB_Err_Not_Covered;
break; break;
} }
@ -1254,15 +1267,16 @@ static HB_Error Get_Class2( HB_ClassDefFormat2* cdf2,
} }
HB_Error _HB_OPEN_Get_Class( HB_ClassDefinition* cd, HB_INTERNAL HB_Error
FT_UShort glyphID, _HB_OPEN_Get_Class( HB_ClassDefinition* cd,
FT_UShort* class, FT_UShort glyphID,
FT_UShort* index ) FT_UShort* klass,
FT_UShort* index )
{ {
switch ( cd->ClassFormat ) switch ( cd->ClassFormat )
{ {
case 1: return Get_Class1( &cd->cd.cd1, glyphID, class, index ); case 1: return Get_Class1( &cd->cd.cd1, glyphID, klass, index );
case 2: return Get_Class2( &cd->cd.cd2, glyphID, class, index ); case 2: return Get_Class2( &cd->cd.cd2, glyphID, klass, index );
default: return _hb_err(HB_Err_Invalid_SubTable_Format); default: return _hb_err(HB_Err_Invalid_SubTable_Format);
} }
@ -1276,8 +1290,9 @@ HB_Error _HB_OPEN_Get_Class( HB_ClassDefinition* cd,
***************************/ ***************************/
HB_Error _HB_OPEN_Load_Device( HB_Device* d, HB_INTERNAL HB_Error
FT_Stream stream ) _HB_OPEN_Load_Device( HB_Device* d,
FT_Stream stream )
{ {
HB_Error error; HB_Error error;
@ -1331,7 +1346,8 @@ HB_Error _HB_OPEN_Load_Device( HB_Device* d,
} }
void _HB_OPEN_Free_Device( HB_Device* d ) HB_INTERNAL void
_HB_OPEN_Free_Device( HB_Device* d )
{ {
FREE( d->DeltaValue ); FREE( d->DeltaValue );
} }
@ -1372,9 +1388,10 @@ void _HB_OPEN_Free_Device( HB_Device* d )
mask = 0x00FF */ mask = 0x00FF */
HB_Error _HB_OPEN_Get_Device( HB_Device* d, HB_INTERNAL HB_Error
FT_UShort size, _HB_OPEN_Get_Device( HB_Device* d,
FT_Short* value ) FT_UShort size,
FT_Short* value )
{ {
FT_UShort byte, bits, mask, f, s; FT_UShort byte, bits, mask, f, s;

View File

@ -10,6 +10,7 @@
* See the file name COPYING for licensing information. * See the file name COPYING for licensing information.
* *
******************************************************************/ ******************************************************************/
#define HB_INTERNAL static
#include "ftglue.c" #include "ftglue.c"
#include "harfbuzz-open.c" #include "harfbuzz-open.c"
#include "harfbuzz-buffer.c" #include "harfbuzz-buffer.c"