Bug 485559 – Boston Summit HarfBuzz optimizations
2007-10-10 Behdad Esfahbod <behdad@gnome.org> Bug 485559 – Boston Summit HarfBuzz optimizations * pango/opentype/*: HarfBuzz hacking to: - Rename last remaining FT_Err stuff to HB_Err. - Fix a couple invalid table paths to be permissive so fonts work better. Particularly GDEF table for Nafees Nastaliq is loaded and works great now. - Optimize harfbuzz buffer to not copy/swap for simple one-to-one and "copy" GSUB operations. * pango/pango-ot*: Update to FT_Err to HB_Err renaming.
This commit is contained in:
parent
dd810b76bc
commit
a8abb8b994
51
src/ftglue.c
51
src/ftglue.c
|
@ -32,16 +32,16 @@ _hb_ftglue_log( const char* format, ... )
|
|||
static FT_Pointer
|
||||
_hb_ftglue_qalloc( FT_Memory memory,
|
||||
FT_ULong size,
|
||||
FT_Error *perror )
|
||||
HB_Error *perror )
|
||||
{
|
||||
FT_Error error = 0;
|
||||
HB_Error error = 0;
|
||||
FT_Pointer block = NULL;
|
||||
|
||||
if ( size > 0 )
|
||||
{
|
||||
block = memory->alloc( memory, size );
|
||||
if ( !block )
|
||||
error = FT_Err_Out_Of_Memory;
|
||||
error = HB_Err_Out_Of_Memory;
|
||||
}
|
||||
|
||||
*perror = error;
|
||||
|
@ -55,16 +55,16 @@ _hb_ftglue_qalloc( FT_Memory memory,
|
|||
FTGLUE_APIDEF( FT_Pointer )
|
||||
_hb_ftglue_alloc( FT_Memory memory,
|
||||
FT_ULong size,
|
||||
FT_Error *perror )
|
||||
HB_Error *perror )
|
||||
{
|
||||
FT_Error error = 0;
|
||||
HB_Error error = 0;
|
||||
FT_Pointer block = NULL;
|
||||
|
||||
if ( size > 0 )
|
||||
{
|
||||
block = memory->alloc( memory, size );
|
||||
if ( !block )
|
||||
error = FT_Err_Out_Of_Memory;
|
||||
error = HB_Err_Out_Of_Memory;
|
||||
else
|
||||
memset( (char*)block, 0, (size_t)size );
|
||||
}
|
||||
|
@ -79,10 +79,10 @@ _hb_ftglue_realloc( FT_Memory memory,
|
|||
FT_Pointer block,
|
||||
FT_ULong old_size,
|
||||
FT_ULong new_size,
|
||||
FT_Error *perror )
|
||||
HB_Error *perror )
|
||||
{
|
||||
FT_Pointer block2 = NULL;
|
||||
FT_Error error = 0;
|
||||
HB_Error error = 0;
|
||||
|
||||
if ( old_size == 0 || block == NULL )
|
||||
{
|
||||
|
@ -96,7 +96,7 @@ _hb_ftglue_realloc( FT_Memory memory,
|
|||
{
|
||||
block2 = memory->realloc( memory, old_size, new_size, block );
|
||||
if ( block2 == NULL )
|
||||
error = FT_Err_Out_Of_Memory;
|
||||
error = HB_Err_Out_Of_Memory;
|
||||
else if ( new_size > old_size )
|
||||
memset( (char*)block2 + old_size, 0, (size_t)(new_size - old_size) );
|
||||
}
|
||||
|
@ -126,31 +126,31 @@ _hb_ftglue_stream_pos( FT_Stream stream )
|
|||
}
|
||||
|
||||
|
||||
FTGLUE_APIDEF( FT_Error )
|
||||
FTGLUE_APIDEF( HB_Error )
|
||||
_hb_ftglue_stream_seek( FT_Stream stream,
|
||||
FT_Long pos )
|
||||
{
|
||||
FT_Error error = 0;
|
||||
HB_Error error = 0;
|
||||
|
||||
stream->pos = pos;
|
||||
if ( stream->read )
|
||||
{
|
||||
if ( stream->read( stream, pos, NULL, 0 ) )
|
||||
error = FT_Err_Invalid_Stream_Operation;
|
||||
error = HB_Err_Invalid_Stream_Operation;
|
||||
}
|
||||
else if ( pos > (FT_Long)stream->size )
|
||||
error = FT_Err_Invalid_Stream_Operation;
|
||||
error = HB_Err_Invalid_Stream_Operation;
|
||||
|
||||
LOG(( "ftglue:stream:seek(%ld) -> %d\n", pos, error ));
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
FTGLUE_APIDEF( FT_Error )
|
||||
FTGLUE_APIDEF( HB_Error )
|
||||
_hb_ftglue_stream_frame_enter( FT_Stream stream,
|
||||
FT_ULong count )
|
||||
{
|
||||
FT_Error error = FT_Err_Ok;
|
||||
HB_Error error = HB_Err_Ok;
|
||||
FT_ULong read_bytes;
|
||||
|
||||
if ( stream->read )
|
||||
|
@ -168,7 +168,7 @@ _hb_ftglue_stream_frame_enter( FT_Stream stream,
|
|||
if ( read_bytes < count )
|
||||
{
|
||||
FREE( stream->base );
|
||||
error = FT_Err_Invalid_Stream_Operation;
|
||||
error = HB_Err_Invalid_Stream_Operation;
|
||||
}
|
||||
stream->cursor = stream->base;
|
||||
stream->limit = stream->cursor + count;
|
||||
|
@ -180,7 +180,7 @@ _hb_ftglue_stream_frame_enter( FT_Stream stream,
|
|||
if ( stream->pos >= stream->size ||
|
||||
stream->pos + count > stream->size )
|
||||
{
|
||||
error = FT_Err_Invalid_Stream_Operation;
|
||||
error = HB_Err_Invalid_Stream_Operation;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
@ -212,12 +212,12 @@ _hb_ftglue_stream_frame_exit( FT_Stream stream )
|
|||
}
|
||||
|
||||
|
||||
FTGLUE_APIDEF( FT_Error )
|
||||
FTGLUE_APIDEF( HB_Error )
|
||||
_hb_ftglue_face_goto_table( FT_Face face,
|
||||
FT_ULong the_tag,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
|
||||
LOG(( "_hb_ftglue_face_goto_table( %p, %c%c%c%c, %p )\n",
|
||||
face,
|
||||
|
@ -230,7 +230,7 @@ _hb_ftglue_face_goto_table( FT_Face face,
|
|||
if ( !FT_IS_SFNT(face) )
|
||||
{
|
||||
LOG(( "not a SFNT face !!\n" ));
|
||||
error = FT_Err_Invalid_Face_Handle;
|
||||
error = HB_Err_Invalid_Face_Handle;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -285,7 +285,7 @@ _hb_ftglue_face_goto_table( FT_Face face,
|
|||
goto FoundIt;
|
||||
}
|
||||
}
|
||||
error = FT_Err_Table_Missing;
|
||||
error = HB_Err_Table_Missing;
|
||||
|
||||
FoundIt:
|
||||
FORGET_Frame();
|
||||
|
@ -298,3 +298,12 @@ Exit:
|
|||
}
|
||||
|
||||
#undef QALLOC
|
||||
|
||||
/* abuse these private header/source files */
|
||||
|
||||
/* helper func to set a breakpoint on */
|
||||
HB_Error
|
||||
_hb_err (HB_Error code)
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
|
21
src/ftglue.h
21
src/ftglue.h
|
@ -46,11 +46,17 @@
|
|||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
#include "harfbuzz-open.h"
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
/* utility macros */
|
||||
|
||||
#ifndef HB_Error
|
||||
#define HB_Error FT_Error
|
||||
#endif
|
||||
|
||||
#define SET_ERR(c) ( (error = (c)) != 0 )
|
||||
|
||||
#ifndef FTGLUE_API
|
||||
|
@ -88,18 +94,18 @@ FT_BEGIN_HEADER
|
|||
FTGLUE_API( FT_Long )
|
||||
_hb_ftglue_stream_pos( FT_Stream stream );
|
||||
|
||||
FTGLUE_API( FT_Error )
|
||||
FTGLUE_API( HB_Error )
|
||||
_hb_ftglue_stream_seek( FT_Stream stream,
|
||||
FT_Long pos );
|
||||
|
||||
FTGLUE_API( FT_Error )
|
||||
FTGLUE_API( HB_Error )
|
||||
_hb_ftglue_stream_frame_enter( FT_Stream stream,
|
||||
FT_ULong size );
|
||||
|
||||
FTGLUE_API( void )
|
||||
_hb_ftglue_stream_frame_exit( FT_Stream stream );
|
||||
|
||||
FTGLUE_API( FT_Error )
|
||||
FTGLUE_API( HB_Error )
|
||||
_hb_ftglue_face_goto_table( FT_Face face,
|
||||
FT_ULong tag,
|
||||
FT_Stream stream );
|
||||
|
@ -132,19 +138,24 @@ _hb_ftglue_face_goto_table( FT_Face face,
|
|||
FTGLUE_API( FT_Pointer )
|
||||
_hb_ftglue_alloc( FT_Memory memory,
|
||||
FT_ULong size,
|
||||
FT_Error *perror_ );
|
||||
HB_Error *perror_ );
|
||||
|
||||
FTGLUE_API( FT_Pointer )
|
||||
_hb_ftglue_realloc( FT_Memory memory,
|
||||
FT_Pointer block,
|
||||
FT_ULong old_size,
|
||||
FT_ULong new_size,
|
||||
FT_Error *perror_ );
|
||||
HB_Error *perror_ );
|
||||
|
||||
FTGLUE_API( void )
|
||||
_hb_ftglue_free( FT_Memory memory,
|
||||
FT_Pointer block );
|
||||
|
||||
/* abuse these private header/source files */
|
||||
|
||||
/* helper func to set a breakpoint on */
|
||||
HB_Error _hb_err (HB_Error code);
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* FTGLUE_H */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* harfbuzz-buffer.c: Buffer of glyphs for substitution/positioning
|
||||
*
|
||||
* Copyright 2004 Red Hat Software
|
||||
* Copyright 2004,2007 Red Hat Software
|
||||
*
|
||||
* Portions Copyright 1996-2000 by
|
||||
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
@ -11,7 +11,34 @@
|
|||
#include "harfbuzz-gsub-private.h"
|
||||
#include "harfbuzz-gpos-private.h"
|
||||
|
||||
static FT_Error
|
||||
/* Here is how the buffer works internally:
|
||||
*
|
||||
* There are two string pointers: in_string and out_string. They
|
||||
* always have same allocated size, but different length and positions.
|
||||
*
|
||||
* As an optimization, both in_string and out_string may point to the
|
||||
* same piece of memory, which is owned by in_string. This remains the
|
||||
* case as long as:
|
||||
*
|
||||
* - copy_glyph() is called
|
||||
* - replace_glyph() is called with inplace=TRUE
|
||||
* - add_output_glyph() and add_output_glyphs() are not called
|
||||
*
|
||||
* In that case swap(), and copy_glyph(), and replace_glyph() are all
|
||||
* mostly no-op.
|
||||
*
|
||||
* As soon an add_output_glyph[s]() or replace_glyph() with inplace=FALSE is
|
||||
* called, out_string is moved over to an alternate buffer (alt_string), and
|
||||
* its current contents (out_length entries) are copied to the alt buffer.
|
||||
* This should all remain transparent to the user. swap() then switches
|
||||
* in_string and alt_string. alt_string is not allocated until its needed,
|
||||
* but after that it's grown with in_string unconditionally.
|
||||
*
|
||||
* The buffer->inplace boolean keeps status of whether out_string points to
|
||||
* in_string or alt_string.
|
||||
*/
|
||||
|
||||
static HB_Error
|
||||
hb_buffer_ensure( HB_Buffer buffer,
|
||||
FT_ULong size )
|
||||
{
|
||||
|
@ -20,29 +47,63 @@ hb_buffer_ensure( HB_Buffer buffer,
|
|||
|
||||
if (size > new_allocated)
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
|
||||
while (size > new_allocated)
|
||||
new_allocated += (new_allocated >> 1) + 8;
|
||||
|
||||
if ( REALLOC_ARRAY( buffer->in_string, buffer->allocated, new_allocated, HB_GlyphItemRec ) )
|
||||
return error;
|
||||
if ( REALLOC_ARRAY( buffer->out_string, buffer->allocated, new_allocated, HB_GlyphItemRec ) )
|
||||
return error;
|
||||
if ( REALLOC_ARRAY( buffer->positions, buffer->allocated, new_allocated, HB_PositionRec ) )
|
||||
return error;
|
||||
if ( REALLOC_ARRAY( buffer->in_string, buffer->allocated, new_allocated, HB_GlyphItemRec ) )
|
||||
return error;
|
||||
if ( buffer->inplace )
|
||||
{
|
||||
buffer->out_string = buffer->in_string;
|
||||
|
||||
if ( buffer->alt_string )
|
||||
{
|
||||
if ( REALLOC_ARRAY( buffer->alt_string, buffer->allocated, new_allocated, HB_GlyphItemRec ) )
|
||||
return error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( REALLOC_ARRAY( buffer->alt_string, buffer->allocated, new_allocated, HB_GlyphItemRec ) )
|
||||
return error;
|
||||
|
||||
buffer->out_string = buffer->alt_string;
|
||||
}
|
||||
|
||||
buffer->allocated = new_allocated;
|
||||
}
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
|
||||
FT_Error
|
||||
static HB_Error
|
||||
hb_buffer_duplicate_out_buffer( HB_Buffer buffer )
|
||||
{
|
||||
if ( !buffer->alt_string )
|
||||
{
|
||||
FT_Memory memory = buffer->memory;
|
||||
HB_Error error;
|
||||
|
||||
if ( ALLOC_ARRAY( buffer->alt_string, buffer->allocated, HB_GlyphItemRec ) )
|
||||
return error;
|
||||
}
|
||||
|
||||
buffer->out_string = buffer->alt_string;
|
||||
memcpy( buffer->out_string, buffer->in_string, buffer->out_length * sizeof (buffer->out_string[0]) );
|
||||
buffer->inplace = FALSE;
|
||||
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
|
||||
HB_Error
|
||||
hb_buffer_new( FT_Memory memory,
|
||||
HB_Buffer *buffer )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
|
||||
if ( ALLOC( *buffer, sizeof( HB_BufferRec ) ) )
|
||||
return error;
|
||||
|
@ -56,61 +117,77 @@ hb_buffer_new( FT_Memory memory,
|
|||
|
||||
(*buffer)->in_string = NULL;
|
||||
(*buffer)->out_string = NULL;
|
||||
(*buffer)->alt_string = NULL;
|
||||
(*buffer)->positions = NULL;
|
||||
(*buffer)->max_ligID = 0;
|
||||
(*buffer)->inplace = TRUE;
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
|
||||
FT_Error
|
||||
void
|
||||
hb_buffer_clear_output( HB_Buffer buffer )
|
||||
{
|
||||
buffer->out_length = 0;
|
||||
buffer->out_pos = 0;
|
||||
buffer->out_string = buffer->in_string;
|
||||
buffer->inplace = TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
hb_buffer_swap( HB_Buffer buffer )
|
||||
{
|
||||
HB_GlyphItem tmp_string;
|
||||
int tmp_length;
|
||||
int tmp_pos;
|
||||
|
||||
tmp_string = buffer->in_string;
|
||||
buffer->in_string = buffer->out_string;
|
||||
buffer->out_string = tmp_string;
|
||||
if ( ! buffer->inplace )
|
||||
{
|
||||
tmp_string = buffer->in_string;
|
||||
buffer->in_string = buffer->out_string;
|
||||
buffer->out_string = tmp_string;
|
||||
buffer->alt_string = buffer->out_string;
|
||||
}
|
||||
|
||||
tmp_length = buffer->in_length;
|
||||
buffer->in_length = buffer->out_length;
|
||||
buffer->out_length = 0;
|
||||
buffer->out_length = tmp_length;
|
||||
|
||||
buffer->in_pos = 0;
|
||||
buffer->out_pos = 0;
|
||||
|
||||
return FT_Err_Ok;
|
||||
tmp_pos = buffer->in_pos;
|
||||
buffer->in_pos = buffer->out_pos;
|
||||
buffer->out_pos = tmp_pos;
|
||||
}
|
||||
|
||||
FT_Error
|
||||
void
|
||||
hb_buffer_free( HB_Buffer buffer )
|
||||
{
|
||||
FT_Memory memory = buffer->memory;
|
||||
|
||||
FREE( buffer->in_string );
|
||||
FREE( buffer->out_string );
|
||||
FREE( buffer->alt_string );
|
||||
buffer->out_string = NULL;
|
||||
FREE( buffer->positions );
|
||||
FREE( buffer );
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
FT_Error
|
||||
void
|
||||
hb_buffer_clear( HB_Buffer buffer )
|
||||
{
|
||||
buffer->in_length = 0;
|
||||
buffer->out_length = 0;
|
||||
buffer->in_pos = 0;
|
||||
buffer->out_pos = 0;
|
||||
|
||||
return FT_Err_Ok;
|
||||
buffer->out_string = buffer->in_string;
|
||||
buffer->inplace = TRUE;
|
||||
}
|
||||
|
||||
FT_Error
|
||||
HB_Error
|
||||
hb_buffer_add_glyph( HB_Buffer buffer,
|
||||
FT_UInt glyph_index,
|
||||
FT_UInt properties,
|
||||
FT_UInt cluster )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
HB_GlyphItem glyph;
|
||||
|
||||
error = hb_buffer_ensure( buffer, buffer->in_length + 1 );
|
||||
|
@ -127,7 +204,7 @@ hb_buffer_add_glyph( HB_Buffer buffer,
|
|||
|
||||
buffer->in_length++;
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
|
||||
/* The following function copies `num_out' elements from `glyph_data'
|
||||
|
@ -149,7 +226,7 @@ hb_buffer_add_glyph( HB_Buffer buffer,
|
|||
|
||||
The cluster value for the glyph at position buffer->in_pos is used
|
||||
for all replacement glyphs */
|
||||
FT_Error
|
||||
HB_Error
|
||||
hb_buffer_add_output_glyphs( HB_Buffer buffer,
|
||||
FT_UShort num_in,
|
||||
FT_UShort num_out,
|
||||
|
@ -157,7 +234,7 @@ hb_buffer_add_output_glyphs( HB_Buffer buffer,
|
|||
FT_UShort component,
|
||||
FT_UShort ligID )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
FT_UShort i;
|
||||
FT_UInt properties;
|
||||
FT_UInt cluster;
|
||||
|
@ -166,6 +243,13 @@ hb_buffer_add_output_glyphs( HB_Buffer buffer,
|
|||
if ( error )
|
||||
return error;
|
||||
|
||||
if ( buffer->inplace )
|
||||
{
|
||||
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 )
|
||||
|
@ -190,10 +274,10 @@ hb_buffer_add_output_glyphs( HB_Buffer buffer,
|
|||
|
||||
buffer->out_length = buffer->out_pos;
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
|
||||
FT_Error
|
||||
HB_Error
|
||||
hb_buffer_add_output_glyph( HB_Buffer buffer,
|
||||
FT_UInt glyph_index,
|
||||
FT_UShort component,
|
||||
|
@ -205,19 +289,49 @@ hb_buffer_add_output_glyph( HB_Buffer buffer,
|
|||
&glyph_data, component, ligID );
|
||||
}
|
||||
|
||||
FT_Error
|
||||
HB_Error
|
||||
hb_buffer_copy_output_glyph ( HB_Buffer buffer )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
|
||||
error = hb_buffer_ensure( buffer, buffer->out_pos + 1 );
|
||||
if ( error )
|
||||
return error;
|
||||
|
||||
buffer->out_string[buffer->out_pos++] = buffer->in_string[buffer->in_pos++];
|
||||
if ( ! buffer->inplace )
|
||||
{
|
||||
buffer->out_string[buffer->out_pos] = buffer->in_string[buffer->in_pos];
|
||||
}
|
||||
|
||||
buffer->in_pos++;
|
||||
buffer->out_pos++;
|
||||
buffer->out_length = buffer->out_pos;
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
|
||||
HB_Error
|
||||
hb_buffer_replace_output_glyph( HB_Buffer buffer,
|
||||
FT_UInt glyph_index,
|
||||
FT_Bool inplace )
|
||||
{
|
||||
|
||||
HB_Error error;
|
||||
|
||||
if ( inplace )
|
||||
{
|
||||
error = hb_buffer_copy_output_glyph ( buffer );
|
||||
if ( error )
|
||||
return error;
|
||||
|
||||
buffer->out_string[buffer->out_pos-1].gindex = glyph_index;
|
||||
}
|
||||
else
|
||||
{
|
||||
return hb_buffer_add_output_glyph( buffer, glyph_index, 0xFFFF, 0xFFFF );
|
||||
}
|
||||
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
|
||||
FT_UShort
|
||||
|
|
|
@ -56,32 +56,37 @@ typedef struct HB_BufferRec_{
|
|||
FT_ULong in_pos;
|
||||
FT_ULong out_pos;
|
||||
|
||||
FT_Bool inplace;
|
||||
HB_GlyphItem in_string;
|
||||
HB_GlyphItem out_string;
|
||||
HB_GlyphItem alt_string;
|
||||
HB_Position positions;
|
||||
FT_UShort max_ligID;
|
||||
} HB_BufferRec, *HB_Buffer;
|
||||
|
||||
FT_Error
|
||||
HB_Error
|
||||
hb_buffer_new( FT_Memory memory,
|
||||
HB_Buffer *buffer );
|
||||
|
||||
FT_Error
|
||||
void
|
||||
hb_buffer_swap( HB_Buffer buffer );
|
||||
|
||||
FT_Error
|
||||
void
|
||||
hb_buffer_free( HB_Buffer buffer );
|
||||
|
||||
FT_Error
|
||||
void
|
||||
hb_buffer_clear( HB_Buffer buffer );
|
||||
|
||||
FT_Error
|
||||
void
|
||||
hb_buffer_clear_output( HB_Buffer buffer );
|
||||
|
||||
HB_Error
|
||||
hb_buffer_add_glyph( HB_Buffer buffer,
|
||||
FT_UInt glyph_index,
|
||||
FT_UInt properties,
|
||||
FT_UInt cluster );
|
||||
|
||||
FT_Error
|
||||
HB_Error
|
||||
hb_buffer_add_output_glyphs( HB_Buffer buffer,
|
||||
FT_UShort num_in,
|
||||
FT_UShort num_out,
|
||||
|
@ -89,15 +94,20 @@ hb_buffer_add_output_glyphs( HB_Buffer buffer,
|
|||
FT_UShort component,
|
||||
FT_UShort ligID );
|
||||
|
||||
FT_Error
|
||||
HB_Error
|
||||
hb_buffer_add_output_glyph ( HB_Buffer buffer,
|
||||
FT_UInt glyph_index,
|
||||
FT_UShort component,
|
||||
FT_UShort ligID );
|
||||
|
||||
FT_Error
|
||||
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 );
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#define N_ELEMENTS(arr) (sizeof(arr)/ sizeof((arr)[0]))
|
||||
|
||||
static int
|
||||
croak (const char *situation, FT_Error error)
|
||||
croak (const char *situation, HB_Error error)
|
||||
{
|
||||
fprintf (stderr, "%s: Error %d\n", situation, error);
|
||||
|
||||
|
@ -59,7 +59,7 @@ maybe_add_feature (HB_GSUB gsub,
|
|||
FT_ULong tag,
|
||||
FT_UShort property)
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
FT_UShort feature_index;
|
||||
|
||||
/* 0xffff == default language system */
|
||||
|
@ -122,7 +122,7 @@ select_cmap (FT_Face face)
|
|||
static void
|
||||
add_features (HB_GSUB gsub)
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
FT_ULong tag = FT_MAKE_TAG ('a', 'r', 'a', 'b');
|
||||
FT_UShort script_index;
|
||||
|
||||
|
@ -173,7 +173,7 @@ try_string (FT_Library library,
|
|||
FT_Face face,
|
||||
HB_GSUB gsub)
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
HB_GSUB_String *in_str;
|
||||
HB_GSUB_String *out_str;
|
||||
FT_ULong i;
|
||||
|
@ -210,7 +210,7 @@ try_string (FT_Library library,
|
|||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
FT_Library library;
|
||||
FT_Face face;
|
||||
HB_GSUB gsub;
|
||||
|
@ -238,7 +238,7 @@ main (int argc, char **argv)
|
|||
if ((error = HB_Done_GSUB_Table (gsub)))
|
||||
croak ("HB_Done_GSUB_Table", error);
|
||||
}
|
||||
else if (error != FT_Err_Table_Missing)
|
||||
else if (error != HB_Err_Table_Missing)
|
||||
fprintf (stderr, "HB_Load_GSUB_Table %x\n", error);
|
||||
|
||||
if (!(error = HB_Load_GPOS_Table (face, &gpos, NULL)))
|
||||
|
@ -248,7 +248,7 @@ main (int argc, char **argv)
|
|||
if ((error = HB_Done_GPOS_Table (gpos)))
|
||||
croak ("HB_Done_GPOS_Table", error);
|
||||
}
|
||||
else if (error != FT_Err_Table_Missing)
|
||||
else if (error != HB_Err_Table_Missing)
|
||||
fprintf (stderr, "HB_Load_GPOS_Table %x\n", error);
|
||||
|
||||
printf ("</OpenType>\n");
|
||||
|
|
|
@ -452,7 +452,7 @@ static void
|
|||
Dump_Device (HB_Device *Device, FILE *stream, int indent, HB_Type hb_type)
|
||||
{
|
||||
int i;
|
||||
int bits = 0;
|
||||
int bits;
|
||||
int n_per;
|
||||
unsigned int mask;
|
||||
|
||||
|
@ -472,6 +472,9 @@ Dump_Device (HB_Device *Device, FILE *stream, int indent, HB_Type hb_type)
|
|||
case 3:
|
||||
bits = 8;
|
||||
break;
|
||||
default:
|
||||
bits = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
DUMP ("<DeltaValue>");
|
||||
|
@ -634,7 +637,7 @@ Dump_GPOS_Lookup_Markbase (HB_SubTable *subtable, FILE *stream, int indent, HB_T
|
|||
DEF_DUMP (Lookup)
|
||||
{
|
||||
int i;
|
||||
const char *lookup_name = NULL;
|
||||
const char *lookup_name;
|
||||
void (*lookup_func) (HB_SubTable *subtable, FILE *stream, int indent, HB_Type hb_type) = NULL;
|
||||
|
||||
if (hb_type == HB_Type_GSUB)
|
||||
|
@ -663,6 +666,10 @@ DEF_DUMP (Lookup)
|
|||
lookup_name = "CHAIN";
|
||||
lookup_func = Dump_GSUB_Lookup_Chain;
|
||||
break;
|
||||
default:
|
||||
lookup_name = "(unknown)";
|
||||
lookup_func = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -696,6 +703,10 @@ DEF_DUMP (Lookup)
|
|||
case HB_GPOS_LOOKUP_CHAIN:
|
||||
lookup_name = "CHAIN";
|
||||
break;
|
||||
default:
|
||||
lookup_name = "(unknown)";
|
||||
lookup_func = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,11 +87,11 @@ struct HB_LigGlyph_
|
|||
};
|
||||
|
||||
|
||||
FT_Error _HB_GDEF_Add_Glyph_Property( HB_GDEFHeader* gdef,
|
||||
HB_Error _HB_GDEF_Add_Glyph_Property( HB_GDEFHeader* gdef,
|
||||
FT_UShort glyphID,
|
||||
FT_UShort property );
|
||||
|
||||
FT_Error _HB_GDEF_Check_Property( HB_GDEFHeader* gdef,
|
||||
HB_Error _HB_GDEF_Check_Property( HB_GDEFHeader* gdef,
|
||||
HB_GlyphItem item,
|
||||
FT_UShort flags,
|
||||
FT_UShort* property );
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
#include "harfbuzz-gdef-private.h"
|
||||
#include "harfbuzz-open-private.h"
|
||||
|
||||
static FT_Error Load_AttachList( HB_AttachList* al,
|
||||
static HB_Error Load_AttachList( HB_AttachList* al,
|
||||
FT_Stream stream );
|
||||
static FT_Error Load_LigCaretList( HB_LigCaretList* lcl,
|
||||
static HB_Error Load_LigCaretList( HB_LigCaretList* lcl,
|
||||
FT_Stream stream );
|
||||
|
||||
static void Free_AttachList( HB_AttachList* al,
|
||||
|
@ -37,7 +37,7 @@ static void Free_NewGlyphClasses( HB_GDEFHeader* gdef,
|
|||
#define GDEF_ID Build_Extension_ID( 'G', 'D', 'E', 'F' )
|
||||
|
||||
|
||||
static FT_Error GDEF_Create( void* ext,
|
||||
static HB_Error GDEF_Create( void* ext,
|
||||
PFace face )
|
||||
{
|
||||
DEFINE_LOAD_LOCALS( face->stream );
|
||||
|
@ -49,7 +49,7 @@ static FT_Error GDEF_Create( void* ext,
|
|||
/* by convention */
|
||||
|
||||
if ( !gdef )
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
|
||||
/* a null offset indicates that there is no GDEF table */
|
||||
|
||||
|
@ -59,7 +59,7 @@ static FT_Error GDEF_Create( void* ext,
|
|||
|
||||
table = HB_LookUp_Table( face, TTAG_GDEF );
|
||||
if ( table < 0 )
|
||||
return FT_Err_Ok; /* The table is optional */
|
||||
return HB_Err_Ok; /* The table is optional */
|
||||
|
||||
if ( FILE_Seek( face->dirTables[table].Offset ) ||
|
||||
ACCESS_Frame( 4L ) )
|
||||
|
@ -72,11 +72,11 @@ static FT_Error GDEF_Create( void* ext,
|
|||
|
||||
gdef->loaded = FALSE;
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
static FT_Error GDEF_Destroy( void* ext,
|
||||
static HB_Error GDEF_Destroy( void* ext,
|
||||
PFace face )
|
||||
{
|
||||
HB_GDEFHeader* gdef = (HB_GDEFHeader*)ext;
|
||||
|
@ -85,7 +85,7 @@ static FT_Error GDEF_Destroy( void* ext,
|
|||
/* by convention */
|
||||
|
||||
if ( !gdef )
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
|
||||
if ( gdef->loaded )
|
||||
{
|
||||
|
@ -97,18 +97,18 @@ static FT_Error GDEF_Destroy( void* ext,
|
|||
Free_NewGlyphClasses( gdef, memory );
|
||||
}
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
|
||||
FT_Error HB_Init_GDEF_Extension( HB_Engine engine )
|
||||
HB_Error HB_Init_GDEF_Extension( HB_Engine engine )
|
||||
{
|
||||
PEngine_Instance _engine = HANDLE_Engine( engine );
|
||||
|
||||
|
||||
if ( !_engine )
|
||||
return FT_Err_Invalid_Engine;
|
||||
return HB_Err_Invalid_Engine;
|
||||
|
||||
return HB_Register_Extension( _engine,
|
||||
GDEF_ID,
|
||||
|
@ -130,16 +130,16 @@ FT_Error HB_Init_GDEF_Extension( HB_Engine engine )
|
|||
|
||||
|
||||
|
||||
FT_Error HB_New_GDEF_Table( FT_Face face,
|
||||
HB_Error HB_New_GDEF_Table( FT_Face face,
|
||||
HB_GDEFHeader** retptr )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
FT_Memory memory = face->memory;
|
||||
|
||||
HB_GDEFHeader* gdef;
|
||||
|
||||
if ( !retptr )
|
||||
return FT_Err_Invalid_Argument;
|
||||
return HB_Err_Invalid_Argument;
|
||||
|
||||
if ( ALLOC( gdef, sizeof( *gdef ) ) )
|
||||
return error;
|
||||
|
@ -157,14 +157,14 @@ FT_Error HB_New_GDEF_Table( FT_Face face,
|
|||
|
||||
*retptr = gdef;
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
FT_Error HB_Load_GDEF_Table( FT_Face face,
|
||||
HB_Error HB_Load_GDEF_Table( FT_Face face,
|
||||
HB_GDEFHeader** retptr )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
FT_Memory memory = face->memory;
|
||||
FT_Stream stream = face->stream;
|
||||
FT_ULong cur_offset, new_offset, base_offset;
|
||||
|
@ -173,7 +173,7 @@ FT_Error HB_Load_GDEF_Table( FT_Face face,
|
|||
|
||||
|
||||
if ( !retptr )
|
||||
return FT_Err_Invalid_Argument;
|
||||
return HB_Err_Invalid_Argument;
|
||||
|
||||
if (( error = _hb_ftglue_face_goto_table( face, TTAG_GDEF, stream ) ))
|
||||
return error;
|
||||
|
@ -204,7 +204,7 @@ FT_Error HB_Load_GDEF_Table( FT_Face face,
|
|||
cur_offset = FILE_Pos();
|
||||
if ( FILE_Seek( new_offset ) ||
|
||||
( error = _HB_OPEN_Load_ClassDefinition( &gdef->GlyphClassDef, 5,
|
||||
stream ) ) != FT_Err_Ok )
|
||||
stream ) ) != HB_Err_Ok )
|
||||
goto Fail0;
|
||||
(void)FILE_Seek( cur_offset );
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ FT_Error HB_Load_GDEF_Table( FT_Face face,
|
|||
cur_offset = FILE_Pos();
|
||||
if ( FILE_Seek( new_offset ) ||
|
||||
( error = Load_AttachList( &gdef->AttachList,
|
||||
stream ) ) != FT_Err_Ok )
|
||||
stream ) ) != HB_Err_Ok )
|
||||
goto Fail1;
|
||||
(void)FILE_Seek( cur_offset );
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ FT_Error HB_Load_GDEF_Table( FT_Face face,
|
|||
cur_offset = FILE_Pos();
|
||||
if ( FILE_Seek( new_offset ) ||
|
||||
( error = Load_LigCaretList( &gdef->LigCaretList,
|
||||
stream ) ) != FT_Err_Ok )
|
||||
stream ) ) != HB_Err_Ok )
|
||||
goto Fail2;
|
||||
(void)FILE_Seek( cur_offset );
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ FT_Error HB_Load_GDEF_Table( FT_Face face,
|
|||
|
||||
*retptr = gdef;
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
|
||||
Fail3:
|
||||
Free_LigCaretList( &gdef->LigCaretList, memory );
|
||||
|
@ -283,7 +283,7 @@ Fail0:
|
|||
}
|
||||
|
||||
|
||||
FT_Error HB_Done_GDEF_Table ( HB_GDEFHeader* gdef )
|
||||
HB_Error HB_Done_GDEF_Table ( HB_GDEFHeader* gdef )
|
||||
{
|
||||
FT_Memory memory = gdef->memory;
|
||||
|
||||
|
@ -296,7 +296,7 @@ FT_Error HB_Done_GDEF_Table ( HB_GDEFHeader* gdef )
|
|||
|
||||
FREE( gdef );
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
|
@ -309,11 +309,11 @@ FT_Error HB_Done_GDEF_Table ( HB_GDEFHeader* gdef )
|
|||
|
||||
/* AttachPoint */
|
||||
|
||||
static FT_Error Load_AttachPoint( HB_AttachPoint* ap,
|
||||
static HB_Error Load_AttachPoint( HB_AttachPoint* ap,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Memory memory = stream->memory;
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
|
||||
FT_UShort n, count;
|
||||
FT_UShort* pi;
|
||||
|
@ -347,7 +347,7 @@ static FT_Error Load_AttachPoint( HB_AttachPoint* ap,
|
|||
FORGET_Frame();
|
||||
}
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
|
@ -360,11 +360,11 @@ static void Free_AttachPoint( HB_AttachPoint* ap,
|
|||
|
||||
/* AttachList */
|
||||
|
||||
static FT_Error Load_AttachList( HB_AttachList* al,
|
||||
static HB_Error Load_AttachList( HB_AttachList* al,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Memory memory = stream->memory;
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
|
||||
FT_UShort n, m, count;
|
||||
FT_ULong cur_offset, new_offset, base_offset;
|
||||
|
@ -383,7 +383,7 @@ static FT_Error Load_AttachList( HB_AttachList* al,
|
|||
|
||||
cur_offset = FILE_Pos();
|
||||
if ( FILE_Seek( new_offset ) ||
|
||||
( error = _HB_OPEN_Load_Coverage( &al->Coverage, stream ) ) != FT_Err_Ok )
|
||||
( error = _HB_OPEN_Load_Coverage( &al->Coverage, stream ) ) != HB_Err_Ok )
|
||||
return error;
|
||||
(void)FILE_Seek( cur_offset );
|
||||
|
||||
|
@ -412,14 +412,14 @@ static FT_Error Load_AttachList( HB_AttachList* al,
|
|||
|
||||
cur_offset = FILE_Pos();
|
||||
if ( FILE_Seek( new_offset ) ||
|
||||
( error = Load_AttachPoint( &ap[n], stream ) ) != FT_Err_Ok )
|
||||
( error = Load_AttachPoint( &ap[n], stream ) ) != HB_Err_Ok )
|
||||
goto Fail1;
|
||||
(void)FILE_Seek( cur_offset );
|
||||
}
|
||||
|
||||
al->loaded = TRUE;
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
|
||||
Fail1:
|
||||
for ( m = 0; m < n; m++ )
|
||||
|
@ -470,10 +470,10 @@ static void Free_AttachList( HB_AttachList* al,
|
|||
/* CaretValueFormat3 */
|
||||
/* CaretValueFormat4 */
|
||||
|
||||
static FT_Error Load_CaretValue( HB_CaretValue* cv,
|
||||
static HB_Error Load_CaretValue( HB_CaretValue* cv,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
|
||||
FT_ULong cur_offset, new_offset, base_offset;
|
||||
|
||||
|
@ -522,7 +522,7 @@ static FT_Error Load_CaretValue( HB_CaretValue* cv,
|
|||
cur_offset = FILE_Pos();
|
||||
if ( FILE_Seek( new_offset ) ||
|
||||
( error = _HB_OPEN_Load_Device( &cv->cvf.cvf3.Device,
|
||||
stream ) ) != FT_Err_Ok )
|
||||
stream ) ) != HB_Err_Ok )
|
||||
return error;
|
||||
(void)FILE_Seek( cur_offset );
|
||||
|
||||
|
@ -538,10 +538,10 @@ static FT_Error Load_CaretValue( HB_CaretValue* cv,
|
|||
break;
|
||||
|
||||
default:
|
||||
return HB_Err_Invalid_GDEF_SubTable_Format;
|
||||
return _hb_err(HB_Err_Invalid_GDEF_SubTable_Format);
|
||||
}
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
|
@ -555,11 +555,11 @@ static void Free_CaretValue( HB_CaretValue* cv,
|
|||
|
||||
/* LigGlyph */
|
||||
|
||||
static FT_Error Load_LigGlyph( HB_LigGlyph* lg,
|
||||
static HB_Error Load_LigGlyph( HB_LigGlyph* lg,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Memory memory = stream->memory;
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
|
||||
FT_UShort n, m, count;
|
||||
FT_ULong cur_offset, new_offset, base_offset;
|
||||
|
@ -594,12 +594,12 @@ static FT_Error Load_LigGlyph( HB_LigGlyph* lg,
|
|||
|
||||
cur_offset = FILE_Pos();
|
||||
if ( FILE_Seek( new_offset ) ||
|
||||
( error = Load_CaretValue( &cv[n], stream ) ) != FT_Err_Ok )
|
||||
( error = Load_CaretValue( &cv[n], stream ) ) != HB_Err_Ok )
|
||||
goto Fail;
|
||||
(void)FILE_Seek( cur_offset );
|
||||
}
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
|
||||
Fail:
|
||||
for ( m = 0; m < n; m++ )
|
||||
|
@ -633,11 +633,11 @@ static void Free_LigGlyph( HB_LigGlyph* lg,
|
|||
|
||||
/* LigCaretList */
|
||||
|
||||
static FT_Error Load_LigCaretList( HB_LigCaretList* lcl,
|
||||
static HB_Error Load_LigCaretList( HB_LigCaretList* lcl,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Memory memory = stream->memory;
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
|
||||
FT_UShort m, n, count;
|
||||
FT_ULong cur_offset, new_offset, base_offset;
|
||||
|
@ -656,7 +656,7 @@ static FT_Error Load_LigCaretList( HB_LigCaretList* lcl,
|
|||
|
||||
cur_offset = FILE_Pos();
|
||||
if ( FILE_Seek( new_offset ) ||
|
||||
( error = _HB_OPEN_Load_Coverage( &lcl->Coverage, stream ) ) != FT_Err_Ok )
|
||||
( error = _HB_OPEN_Load_Coverage( &lcl->Coverage, stream ) ) != HB_Err_Ok )
|
||||
return error;
|
||||
(void)FILE_Seek( cur_offset );
|
||||
|
||||
|
@ -685,14 +685,14 @@ static FT_Error Load_LigCaretList( HB_LigCaretList* lcl,
|
|||
|
||||
cur_offset = FILE_Pos();
|
||||
if ( FILE_Seek( new_offset ) ||
|
||||
( error = Load_LigGlyph( &lg[n], stream ) ) != FT_Err_Ok )
|
||||
( error = Load_LigGlyph( &lg[n], stream ) ) != HB_Err_Ok )
|
||||
goto Fail1;
|
||||
(void)FILE_Seek( cur_offset );
|
||||
}
|
||||
|
||||
lcl->loaded = TRUE;
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
|
||||
Fail1:
|
||||
for ( m = 0; m < n; m++ )
|
||||
|
@ -778,17 +778,17 @@ static FT_UShort Get_New_Class( HB_GDEFHeader* gdef,
|
|||
|
||||
|
||||
|
||||
FT_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef,
|
||||
HB_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef,
|
||||
FT_UShort glyphID,
|
||||
FT_UShort* property )
|
||||
{
|
||||
FT_UShort class, index;
|
||||
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
|
||||
|
||||
if ( !gdef || !property )
|
||||
return FT_Err_Invalid_Argument;
|
||||
return HB_Err_Invalid_Argument;
|
||||
|
||||
/* first, we check for mark attach classes */
|
||||
|
||||
|
@ -800,7 +800,7 @@ FT_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef,
|
|||
if ( !error )
|
||||
{
|
||||
*property = class << 8;
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -816,6 +816,7 @@ FT_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef,
|
|||
|
||||
switch ( class )
|
||||
{
|
||||
default:
|
||||
case UNCLASSIFIED_GLYPH:
|
||||
*property = 0;
|
||||
break;
|
||||
|
@ -837,17 +838,17 @@ FT_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef,
|
|||
break;
|
||||
}
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
static FT_Error Make_ClassRange( HB_ClassDefinition* cd,
|
||||
static HB_Error Make_ClassRange( HB_ClassDefinition* cd,
|
||||
FT_UShort start,
|
||||
FT_UShort end,
|
||||
FT_UShort class,
|
||||
FT_Memory memory )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
FT_UShort index;
|
||||
|
||||
HB_ClassDefFormat2* cdf2;
|
||||
|
@ -873,12 +874,12 @@ static FT_Error Make_ClassRange( HB_ClassDefinition* cd,
|
|||
|
||||
cd->Defined[class] = TRUE;
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
|
||||
FT_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
|
||||
HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
|
||||
FT_UShort num_glyphs,
|
||||
FT_UShort glyph_count,
|
||||
FT_UShort* glyph_array,
|
||||
|
@ -886,7 +887,7 @@ FT_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
|
|||
{
|
||||
FT_UShort start, curr_glyph, curr_class;
|
||||
FT_UShort n, m, count;
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
FT_Memory memory;
|
||||
|
||||
HB_ClassDefinition* gcd;
|
||||
|
@ -895,7 +896,7 @@ FT_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
|
|||
|
||||
|
||||
if ( !gdef || !glyph_array || !class_array )
|
||||
return FT_Err_Invalid_Argument;
|
||||
return HB_Err_Invalid_Argument;
|
||||
|
||||
memory = gdef->memory;
|
||||
gcd = &gdef->GlyphClassDef;
|
||||
|
@ -918,13 +919,13 @@ FT_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
|
|||
|
||||
if ( curr_class >= 5 )
|
||||
{
|
||||
error = FT_Err_Invalid_Argument;
|
||||
error = HB_Err_Invalid_Argument;
|
||||
goto Fail4;
|
||||
}
|
||||
|
||||
glyph_count--;
|
||||
|
||||
for ( n = 0; n <= glyph_count; n++ )
|
||||
for ( n = 0; n < glyph_count + 1; n++ )
|
||||
{
|
||||
if ( curr_glyph == glyph_array[n] && curr_class == class_array[n] )
|
||||
{
|
||||
|
@ -933,14 +934,14 @@ FT_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
|
|||
if ( ( error = Make_ClassRange( gcd, start,
|
||||
curr_glyph,
|
||||
curr_class,
|
||||
memory ) ) != FT_Err_Ok )
|
||||
memory ) ) != HB_Err_Ok )
|
||||
goto Fail3;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( curr_glyph == 0xFFFF )
|
||||
{
|
||||
error = FT_Err_Invalid_Argument;
|
||||
error = HB_Err_Invalid_Argument;
|
||||
goto Fail3;
|
||||
}
|
||||
else
|
||||
|
@ -952,12 +953,12 @@ FT_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
|
|||
if ( ( error = Make_ClassRange( gcd, start,
|
||||
curr_glyph - 1,
|
||||
curr_class,
|
||||
memory ) ) != FT_Err_Ok )
|
||||
memory ) ) != HB_Err_Ok )
|
||||
goto Fail3;
|
||||
|
||||
if ( curr_glyph > glyph_array[n] )
|
||||
{
|
||||
error = FT_Err_Invalid_Argument;
|
||||
error = HB_Err_Invalid_Argument;
|
||||
goto Fail3;
|
||||
}
|
||||
|
||||
|
@ -967,7 +968,7 @@ FT_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
|
|||
|
||||
if ( curr_class >= 5 )
|
||||
{
|
||||
error = FT_Err_Invalid_Argument;
|
||||
error = HB_Err_Invalid_Argument;
|
||||
goto Fail3;
|
||||
}
|
||||
|
||||
|
@ -976,14 +977,14 @@ FT_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
|
|||
if ( ( error = Make_ClassRange( gcd, start,
|
||||
curr_glyph,
|
||||
curr_class,
|
||||
memory ) ) != FT_Err_Ok )
|
||||
memory ) ) != HB_Err_Ok )
|
||||
goto Fail3;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( curr_glyph == 0xFFFF )
|
||||
{
|
||||
error = FT_Err_Invalid_Argument;
|
||||
error = HB_Err_Invalid_Argument;
|
||||
goto Fail3;
|
||||
}
|
||||
else
|
||||
|
@ -1046,7 +1047,7 @@ FT_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
|
|||
|
||||
gcd->loaded = TRUE;
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
|
||||
Fail1:
|
||||
for ( m = 0; m < n; m++ )
|
||||
|
@ -1084,11 +1085,11 @@ static void Free_NewGlyphClasses( HB_GDEFHeader* gdef,
|
|||
}
|
||||
|
||||
|
||||
FT_Error _HB_GDEF_Add_Glyph_Property( HB_GDEFHeader* gdef,
|
||||
HB_Error _HB_GDEF_Add_Glyph_Property( HB_GDEFHeader* gdef,
|
||||
FT_UShort glyphID,
|
||||
FT_UShort property )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
FT_UShort class, new_class, index;
|
||||
FT_UShort byte, bits, mask;
|
||||
FT_UShort array_index, glyph_index, count;
|
||||
|
@ -1129,7 +1130,7 @@ FT_Error _HB_GDEF_Add_Glyph_Property( HB_GDEFHeader* gdef,
|
|||
break;
|
||||
|
||||
default:
|
||||
return FT_Err_Invalid_Argument;
|
||||
return HB_Err_Invalid_Argument;
|
||||
}
|
||||
|
||||
count = gdef->GlyphClassDef.cd.cd2.ClassRangeCount;
|
||||
|
@ -1165,16 +1166,16 @@ FT_Error _HB_GDEF_Add_Glyph_Property( HB_GDEFHeader* gdef,
|
|||
ngc[array_index][glyph_index / 4] |= bits;
|
||||
}
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
FT_Error _HB_GDEF_Check_Property( HB_GDEFHeader* gdef,
|
||||
HB_Error _HB_GDEF_Check_Property( HB_GDEFHeader* gdef,
|
||||
HB_GlyphItem gitem,
|
||||
FT_UShort flags,
|
||||
FT_UShort* property )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
|
||||
if ( gdef )
|
||||
{
|
||||
|
@ -1221,7 +1222,7 @@ FT_Error _HB_GDEF_Check_Property( HB_GDEFHeader* gdef,
|
|||
*property = 0;
|
||||
}
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -100,22 +100,22 @@ typedef struct HB_GDEFHeader_ HB_GDEFHeader;
|
|||
typedef struct HB_GDEFHeader_* HB_GDEF;
|
||||
|
||||
|
||||
FT_Error HB_New_GDEF_Table( FT_Face face,
|
||||
HB_Error HB_New_GDEF_Table( FT_Face face,
|
||||
HB_GDEFHeader** retptr );
|
||||
|
||||
|
||||
FT_Error HB_Load_GDEF_Table( FT_Face face,
|
||||
HB_Error HB_Load_GDEF_Table( FT_Face face,
|
||||
HB_GDEFHeader** gdef );
|
||||
|
||||
|
||||
FT_Error HB_Done_GDEF_Table ( HB_GDEFHeader* gdef );
|
||||
HB_Error HB_Done_GDEF_Table ( HB_GDEFHeader* gdef );
|
||||
|
||||
|
||||
FT_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef,
|
||||
HB_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef,
|
||||
FT_UShort glyphID,
|
||||
FT_UShort* property );
|
||||
|
||||
FT_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
|
||||
HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
|
||||
FT_UShort num_glyphs,
|
||||
FT_UShort glyph_count,
|
||||
FT_UShort* glyph_array,
|
||||
|
|
|
@ -670,7 +670,7 @@ typedef union HB_GPOS_SubTable_ HB_GPOS_SubTable;
|
|||
|
||||
|
||||
|
||||
FT_Error _HB_GPOS_Load_SubTable( HB_GPOS_SubTable* st,
|
||||
HB_Error _HB_GPOS_Load_SubTable( HB_GPOS_SubTable* st,
|
||||
FT_Stream stream,
|
||||
FT_UShort lookup_type );
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -48,7 +48,7 @@ FT_BEGIN_HEADER
|
|||
|
||||
_glyph = HANDLE_Glyph( glyph ) */
|
||||
|
||||
typedef FT_Error (*HB_GlyphFunction)(FT_Face face,
|
||||
typedef HB_Error (*HB_GlyphFunction)(FT_Face face,
|
||||
FT_UInt glyphIndex,
|
||||
FT_Int loadFlags );
|
||||
|
||||
|
@ -64,7 +64,7 @@ typedef FT_Error (*HB_GlyphFunction)(FT_Face face,
|
|||
`metric_value' must be returned as a scaled value (but shouldn't
|
||||
be rounded). */
|
||||
|
||||
typedef FT_Error (*HB_MMFunction)(FT_Face face,
|
||||
typedef HB_Error (*HB_MMFunction)(FT_Face face,
|
||||
FT_UShort metric_id,
|
||||
FT_Pos* metric_value,
|
||||
void* data );
|
||||
|
@ -99,56 +99,56 @@ typedef struct HB_GPOSHeader_ HB_GPOSHeader;
|
|||
typedef HB_GPOSHeader* HB_GPOS;
|
||||
|
||||
|
||||
FT_Error HB_Load_GPOS_Table( FT_Face face,
|
||||
HB_Error HB_Load_GPOS_Table( FT_Face face,
|
||||
HB_GPOSHeader** gpos,
|
||||
HB_GDEFHeader* gdef );
|
||||
|
||||
|
||||
FT_Error HB_Done_GPOS_Table( HB_GPOSHeader* gpos );
|
||||
HB_Error HB_Done_GPOS_Table( HB_GPOSHeader* gpos );
|
||||
|
||||
|
||||
FT_Error HB_GPOS_Select_Script( HB_GPOSHeader* gpos,
|
||||
HB_Error HB_GPOS_Select_Script( HB_GPOSHeader* gpos,
|
||||
FT_ULong script_tag,
|
||||
FT_UShort* script_index );
|
||||
|
||||
FT_Error HB_GPOS_Select_Language( HB_GPOSHeader* gpos,
|
||||
HB_Error HB_GPOS_Select_Language( HB_GPOSHeader* gpos,
|
||||
FT_ULong language_tag,
|
||||
FT_UShort script_index,
|
||||
FT_UShort* language_index,
|
||||
FT_UShort* req_feature_index );
|
||||
|
||||
FT_Error HB_GPOS_Select_Feature( HB_GPOSHeader* gpos,
|
||||
HB_Error HB_GPOS_Select_Feature( HB_GPOSHeader* gpos,
|
||||
FT_ULong feature_tag,
|
||||
FT_UShort script_index,
|
||||
FT_UShort language_index,
|
||||
FT_UShort* feature_index );
|
||||
|
||||
|
||||
FT_Error HB_GPOS_Query_Scripts( HB_GPOSHeader* gpos,
|
||||
HB_Error HB_GPOS_Query_Scripts( HB_GPOSHeader* gpos,
|
||||
FT_ULong** script_tag_list );
|
||||
|
||||
FT_Error HB_GPOS_Query_Languages( HB_GPOSHeader* gpos,
|
||||
HB_Error HB_GPOS_Query_Languages( HB_GPOSHeader* gpos,
|
||||
FT_UShort script_index,
|
||||
FT_ULong** language_tag_list );
|
||||
|
||||
FT_Error HB_GPOS_Query_Features( HB_GPOSHeader* gpos,
|
||||
HB_Error HB_GPOS_Query_Features( HB_GPOSHeader* gpos,
|
||||
FT_UShort script_index,
|
||||
FT_UShort language_index,
|
||||
FT_ULong** feature_tag_list );
|
||||
|
||||
|
||||
FT_Error HB_GPOS_Add_Feature( HB_GPOSHeader* gpos,
|
||||
HB_Error HB_GPOS_Add_Feature( HB_GPOSHeader* gpos,
|
||||
FT_UShort feature_index,
|
||||
FT_UInt property );
|
||||
|
||||
FT_Error HB_GPOS_Clear_Features( HB_GPOSHeader* gpos );
|
||||
HB_Error HB_GPOS_Clear_Features( HB_GPOSHeader* gpos );
|
||||
|
||||
|
||||
FT_Error HB_GPOS_Register_Glyph_Function( HB_GPOSHeader* gpos,
|
||||
HB_Error HB_GPOS_Register_Glyph_Function( HB_GPOSHeader* gpos,
|
||||
HB_GlyphFunction gfunc );
|
||||
|
||||
|
||||
FT_Error HB_GPOS_Register_MM_Function( HB_GPOSHeader* gpos,
|
||||
HB_Error HB_GPOS_Register_MM_Function( HB_GPOSHeader* gpos,
|
||||
HB_MMFunction mmfunc,
|
||||
void* data );
|
||||
|
||||
|
@ -156,7 +156,7 @@ FT_Error HB_GPOS_Register_MM_Function( HB_GPOSHeader* gpos,
|
|||
tables are ignored -- you will get device independent values. */
|
||||
|
||||
|
||||
FT_Error HB_GPOS_Apply_String( FT_Face face,
|
||||
HB_Error HB_GPOS_Apply_String( FT_Face face,
|
||||
HB_GPOSHeader* gpos,
|
||||
FT_UShort load_flags,
|
||||
HB_Buffer buffer,
|
||||
|
|
|
@ -435,7 +435,7 @@ union HB_GSUB_SubTable_
|
|||
|
||||
|
||||
|
||||
FT_Error _HB_GSUB_Load_SubTable( HB_GSUB_SubTable* st,
|
||||
HB_Error _HB_GSUB_Load_SubTable( HB_GSUB_SubTable* st,
|
||||
FT_Stream stream,
|
||||
FT_UShort lookup_type );
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -73,57 +73,57 @@ typedef struct HB_GSUBHeader_ HB_GSUBHeader;
|
|||
typedef HB_GSUBHeader* HB_GSUB;
|
||||
|
||||
|
||||
FT_Error HB_Load_GSUB_Table( FT_Face face,
|
||||
HB_Error HB_Load_GSUB_Table( FT_Face face,
|
||||
HB_GSUBHeader** gsub,
|
||||
HB_GDEFHeader* gdef );
|
||||
|
||||
|
||||
FT_Error HB_Done_GSUB_Table( HB_GSUBHeader* gsub );
|
||||
HB_Error HB_Done_GSUB_Table( HB_GSUBHeader* gsub );
|
||||
|
||||
|
||||
FT_Error HB_GSUB_Select_Script( HB_GSUBHeader* gsub,
|
||||
HB_Error HB_GSUB_Select_Script( HB_GSUBHeader* gsub,
|
||||
FT_ULong script_tag,
|
||||
FT_UShort* script_index );
|
||||
|
||||
FT_Error HB_GSUB_Select_Language( HB_GSUBHeader* gsub,
|
||||
HB_Error HB_GSUB_Select_Language( HB_GSUBHeader* gsub,
|
||||
FT_ULong language_tag,
|
||||
FT_UShort script_index,
|
||||
FT_UShort* language_index,
|
||||
FT_UShort* req_feature_index );
|
||||
|
||||
FT_Error HB_GSUB_Select_Feature( HB_GSUBHeader* gsub,
|
||||
HB_Error HB_GSUB_Select_Feature( HB_GSUBHeader* gsub,
|
||||
FT_ULong feature_tag,
|
||||
FT_UShort script_index,
|
||||
FT_UShort language_index,
|
||||
FT_UShort* feature_index );
|
||||
|
||||
|
||||
FT_Error HB_GSUB_Query_Scripts( HB_GSUBHeader* gsub,
|
||||
HB_Error HB_GSUB_Query_Scripts( HB_GSUBHeader* gsub,
|
||||
FT_ULong** script_tag_list );
|
||||
|
||||
FT_Error HB_GSUB_Query_Languages( HB_GSUBHeader* gsub,
|
||||
HB_Error HB_GSUB_Query_Languages( HB_GSUBHeader* gsub,
|
||||
FT_UShort script_index,
|
||||
FT_ULong** language_tag_list );
|
||||
|
||||
FT_Error HB_GSUB_Query_Features( HB_GSUBHeader* gsub,
|
||||
HB_Error HB_GSUB_Query_Features( HB_GSUBHeader* gsub,
|
||||
FT_UShort script_index,
|
||||
FT_UShort language_index,
|
||||
FT_ULong** feature_tag_list );
|
||||
|
||||
|
||||
FT_Error HB_GSUB_Add_Feature( HB_GSUBHeader* gsub,
|
||||
HB_Error HB_GSUB_Add_Feature( HB_GSUBHeader* gsub,
|
||||
FT_UShort feature_index,
|
||||
FT_UInt property );
|
||||
|
||||
FT_Error HB_GSUB_Clear_Features( HB_GSUBHeader* gsub );
|
||||
HB_Error HB_GSUB_Clear_Features( HB_GSUBHeader* gsub );
|
||||
|
||||
|
||||
FT_Error HB_GSUB_Register_Alternate_Function( HB_GSUBHeader* gsub,
|
||||
HB_Error HB_GSUB_Register_Alternate_Function( HB_GSUBHeader* gsub,
|
||||
HB_AltFunction altfunc,
|
||||
void* data );
|
||||
|
||||
|
||||
FT_Error HB_GSUB_Apply_String( HB_GSUBHeader* gsub,
|
||||
HB_Error HB_GSUB_Apply_String( HB_GSUBHeader* gsub,
|
||||
HB_Buffer buffer );
|
||||
|
||||
|
||||
|
|
|
@ -63,20 +63,24 @@ FT_BEGIN_HEADER
|
|||
#define OUT_GLYPH( pos ) (buffer->out_string[(pos)].gindex)
|
||||
#define OUT_ITEM( pos ) (&buffer->out_string[(pos)])
|
||||
|
||||
#define CHECK_Property( gdef, index, flags, property ) \
|
||||
( ( error = _HB_GDEF_Check_Property( (gdef), (index), (flags), \
|
||||
(property) ) ) != FT_Err_Ok )
|
||||
#define CHECK_Property( gdef, index, flags, property ) \
|
||||
( ( error = _HB_GDEF_Check_Property( (gdef), (index), (flags), \
|
||||
(property) ) ) != HB_Err_Ok )
|
||||
|
||||
#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), \
|
||||
(glyph_data), (component), (ligID) \
|
||||
) ) != FT_Err_Ok )
|
||||
#define ADD_Glyph( buffer, glyph_index, component, ligID ) \
|
||||
) ) != HB_Err_Ok )
|
||||
#define ADD_Glyph( buffer, glyph_index, component, ligID ) \
|
||||
( ( error = hb_buffer_add_output_glyph( (buffer), \
|
||||
(glyph_index), (component), (ligID) \
|
||||
) ) != FT_Err_Ok )
|
||||
|
||||
(glyph_index), (component), (ligID) \
|
||||
) ) != HB_Err_Ok )
|
||||
#define REPLACE_Glyph( buffer, glyph_index, nesting_level ) \
|
||||
( ( error = hb_buffer_replace_output_glyph( (buffer), (glyph_index), \
|
||||
(nesting_level) == 1 ) ) != HB_Err_Ok )
|
||||
#define COPY_Glyph( buffer ) \
|
||||
( (error = hb_buffer_copy_output_glyph ( buffer ) ) != HB_Err_Ok )
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
|
|
|
@ -30,22 +30,22 @@ struct HB_SubTable_
|
|||
};
|
||||
|
||||
|
||||
FT_Error _HB_OPEN_Load_ScriptList( HB_ScriptList* sl,
|
||||
HB_Error _HB_OPEN_Load_ScriptList( HB_ScriptList* sl,
|
||||
FT_Stream stream );
|
||||
FT_Error _HB_OPEN_Load_FeatureList( HB_FeatureList* fl,
|
||||
HB_Error _HB_OPEN_Load_FeatureList( HB_FeatureList* fl,
|
||||
FT_Stream input );
|
||||
FT_Error _HB_OPEN_Load_LookupList( HB_LookupList* ll,
|
||||
HB_Error _HB_OPEN_Load_LookupList( HB_LookupList* ll,
|
||||
FT_Stream input,
|
||||
HB_Type type );
|
||||
|
||||
FT_Error _HB_OPEN_Load_Coverage( HB_Coverage* c,
|
||||
HB_Error _HB_OPEN_Load_Coverage( HB_Coverage* c,
|
||||
FT_Stream input );
|
||||
FT_Error _HB_OPEN_Load_ClassDefinition( HB_ClassDefinition* cd,
|
||||
HB_Error _HB_OPEN_Load_ClassDefinition( HB_ClassDefinition* cd,
|
||||
FT_UShort limit,
|
||||
FT_Stream input );
|
||||
FT_Error _HB_OPEN_Load_EmptyClassDefinition( HB_ClassDefinition* cd,
|
||||
HB_Error _HB_OPEN_Load_EmptyClassDefinition( HB_ClassDefinition* cd,
|
||||
FT_Stream input );
|
||||
FT_Error _HB_OPEN_Load_Device( HB_Device* d,
|
||||
HB_Error _HB_OPEN_Load_Device( HB_Device* d,
|
||||
FT_Stream input );
|
||||
|
||||
void _HB_OPEN_Free_ScriptList( HB_ScriptList* sl,
|
||||
|
@ -65,14 +65,14 @@ void _HB_OPEN_Free_Device( HB_Device* d,
|
|||
|
||||
|
||||
|
||||
FT_Error _HB_OPEN_Coverage_Index( HB_Coverage* c,
|
||||
HB_Error _HB_OPEN_Coverage_Index( HB_Coverage* c,
|
||||
FT_UShort glyphID,
|
||||
FT_UShort* index );
|
||||
FT_Error _HB_OPEN_Get_Class( HB_ClassDefinition* cd,
|
||||
HB_Error _HB_OPEN_Get_Class( HB_ClassDefinition* cd,
|
||||
FT_UShort glyphID,
|
||||
FT_UShort* class,
|
||||
FT_UShort* index );
|
||||
FT_Error _HB_OPEN_Get_Device( HB_Device* d,
|
||||
HB_Error _HB_OPEN_Get_Device( HB_Device* d,
|
||||
FT_UShort size,
|
||||
FT_Short* value );
|
||||
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
|
||||
/* LangSys */
|
||||
|
||||
static FT_Error Load_LangSys( HB_LangSys* ls,
|
||||
static HB_Error Load_LangSys( HB_LangSys* ls,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
FT_UShort n, count;
|
||||
FT_UShort* fi;
|
||||
|
@ -57,7 +57,7 @@ static FT_Error Load_LangSys( HB_LangSys* ls,
|
|||
|
||||
FORGET_Frame();
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
|
@ -70,10 +70,10 @@ static void Free_LangSys( HB_LangSys* ls,
|
|||
|
||||
/* Script */
|
||||
|
||||
static FT_Error Load_Script( HB_Script* s,
|
||||
static HB_Error Load_Script( HB_Script* s,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
FT_UShort n, m, count;
|
||||
FT_ULong cur_offset, new_offset, base_offset;
|
||||
|
@ -95,7 +95,7 @@ static FT_Error Load_Script( HB_Script* s,
|
|||
cur_offset = FILE_Pos();
|
||||
if ( FILE_Seek( new_offset ) ||
|
||||
( error = Load_LangSys( &s->DefaultLangSys,
|
||||
stream ) ) != FT_Err_Ok )
|
||||
stream ) ) != HB_Err_Ok )
|
||||
return error;
|
||||
(void)FILE_Seek( cur_offset );
|
||||
}
|
||||
|
@ -144,12 +144,12 @@ static FT_Error Load_Script( HB_Script* s,
|
|||
|
||||
cur_offset = FILE_Pos();
|
||||
if ( FILE_Seek( new_offset ) ||
|
||||
( error = Load_LangSys( &lsr[n].LangSys, stream ) ) != FT_Err_Ok )
|
||||
( error = Load_LangSys( &lsr[n].LangSys, stream ) ) != HB_Err_Ok )
|
||||
goto Fail1;
|
||||
(void)FILE_Seek( cur_offset );
|
||||
}
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
|
||||
Fail1:
|
||||
for ( m = 0; m < n; m++ )
|
||||
|
@ -188,10 +188,10 @@ static void Free_Script( HB_Script* s,
|
|||
|
||||
/* ScriptList */
|
||||
|
||||
FT_Error _HB_OPEN_Load_ScriptList( HB_ScriptList* sl,
|
||||
HB_Error _HB_OPEN_Load_ScriptList( HB_ScriptList* sl,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, script_count;
|
||||
|
@ -233,7 +233,7 @@ FT_Error _HB_OPEN_Load_ScriptList( HB_ScriptList* sl,
|
|||
goto Fail;
|
||||
|
||||
error = Load_Script( &sr[sl->ScriptCount].Script, stream );
|
||||
if ( error == FT_Err_Ok )
|
||||
if ( error == HB_Err_Ok )
|
||||
sl->ScriptCount += 1;
|
||||
else if ( error != HB_Err_Empty_Script )
|
||||
goto Fail;
|
||||
|
@ -247,12 +247,12 @@ FT_Error _HB_OPEN_Load_ScriptList( HB_ScriptList* sl,
|
|||
#if 0
|
||||
if ( sl->ScriptCount == 0 )
|
||||
{
|
||||
error = HB_Err_Invalid_SubTable;
|
||||
error = _hb_err(HB_Err_Invalid_SubTable);
|
||||
goto Fail;
|
||||
}
|
||||
#endif
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
|
||||
Fail:
|
||||
for ( n = 0; n < sl->ScriptCount; n++ )
|
||||
|
@ -292,10 +292,10 @@ void _HB_OPEN_Free_ScriptList( HB_ScriptList* sl,
|
|||
|
||||
/* Feature */
|
||||
|
||||
static FT_Error Load_Feature( HB_Feature* f,
|
||||
static HB_Error Load_Feature( HB_Feature* f,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, count;
|
||||
|
@ -329,7 +329,7 @@ static FT_Error Load_Feature( HB_Feature* f,
|
|||
|
||||
FORGET_Frame();
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
|
@ -342,10 +342,10 @@ static void Free_Feature( HB_Feature* f,
|
|||
|
||||
/* FeatureList */
|
||||
|
||||
FT_Error _HB_OPEN_Load_FeatureList( HB_FeatureList* fl,
|
||||
HB_Error _HB_OPEN_Load_FeatureList( HB_FeatureList* fl,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, m, count;
|
||||
|
@ -386,12 +386,12 @@ FT_Error _HB_OPEN_Load_FeatureList( HB_FeatureList* fl,
|
|||
|
||||
cur_offset = FILE_Pos();
|
||||
if ( FILE_Seek( new_offset ) ||
|
||||
( error = Load_Feature( &fr[n].Feature, stream ) ) != FT_Err_Ok )
|
||||
( error = Load_Feature( &fr[n].Feature, stream ) ) != HB_Err_Ok )
|
||||
goto Fail1;
|
||||
(void)FILE_Seek( cur_offset );
|
||||
}
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
|
||||
Fail1:
|
||||
for ( m = 0; m < n; m++ )
|
||||
|
@ -440,7 +440,7 @@ void _HB_OPEN_Free_FeatureList( HB_FeatureList* fl,
|
|||
|
||||
/* SubTable */
|
||||
|
||||
static FT_Error Load_SubTable( HB_SubTable* st,
|
||||
static HB_Error Load_SubTable( HB_SubTable* st,
|
||||
FT_Stream stream,
|
||||
HB_Type table_type,
|
||||
FT_UShort lookup_type )
|
||||
|
@ -466,11 +466,11 @@ static void Free_SubTable( HB_SubTable* st,
|
|||
|
||||
/* Lookup */
|
||||
|
||||
static FT_Error Load_Lookup( HB_Lookup* l,
|
||||
static HB_Error Load_Lookup( HB_Lookup* l,
|
||||
FT_Stream stream,
|
||||
HB_Type type )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, m, count;
|
||||
|
@ -530,12 +530,12 @@ static FT_Error Load_Lookup( HB_Lookup* l,
|
|||
|
||||
if ( FILE_Seek( new_offset ) ||
|
||||
( error = Load_SubTable( &st[n], stream,
|
||||
type, l->LookupType ) ) != FT_Err_Ok )
|
||||
type, l->LookupType ) ) != HB_Err_Ok )
|
||||
goto Fail;
|
||||
(void)FILE_Seek( cur_offset );
|
||||
}
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
|
||||
Fail:
|
||||
for ( m = 0; m < n; m++ )
|
||||
|
@ -570,11 +570,11 @@ static void Free_Lookup( HB_Lookup* l,
|
|||
|
||||
/* LookupList */
|
||||
|
||||
FT_Error _HB_OPEN_Load_LookupList( HB_LookupList* ll,
|
||||
HB_Error _HB_OPEN_Load_LookupList( HB_LookupList* ll,
|
||||
FT_Stream stream,
|
||||
HB_Type type )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, m, count;
|
||||
|
@ -612,12 +612,12 @@ FT_Error _HB_OPEN_Load_LookupList( HB_LookupList* ll,
|
|||
|
||||
cur_offset = FILE_Pos();
|
||||
if ( FILE_Seek( new_offset ) ||
|
||||
( error = Load_Lookup( &l[n], stream, type ) ) != FT_Err_Ok )
|
||||
( error = Load_Lookup( &l[n], stream, type ) ) != HB_Err_Ok )
|
||||
goto Fail1;
|
||||
(void)FILE_Seek( cur_offset );
|
||||
}
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
|
||||
Fail1:
|
||||
FREE( ll->Properties );
|
||||
|
@ -663,10 +663,10 @@ void _HB_OPEN_Free_LookupList( HB_LookupList* ll,
|
|||
|
||||
/* CoverageFormat1 */
|
||||
|
||||
static FT_Error Load_Coverage1( HB_CoverageFormat1* cf1,
|
||||
static HB_Error Load_Coverage1( HB_CoverageFormat1* cf1,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, count;
|
||||
|
@ -699,7 +699,7 @@ static FT_Error Load_Coverage1( HB_CoverageFormat1* cf1,
|
|||
|
||||
FORGET_Frame();
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
|
@ -712,10 +712,10 @@ static void Free_Coverage1( HB_CoverageFormat1* cf1,
|
|||
|
||||
/* CoverageFormat2 */
|
||||
|
||||
static FT_Error Load_Coverage2( HB_CoverageFormat2* cf2,
|
||||
static HB_Error Load_Coverage2( HB_CoverageFormat2* cf2,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, count;
|
||||
|
@ -751,14 +751,14 @@ static FT_Error Load_Coverage2( HB_CoverageFormat2* cf2,
|
|||
( rr[n].End - rr[n].Start + (long)rr[n].StartCoverageIndex ) >=
|
||||
0x10000L )
|
||||
{
|
||||
error = HB_Err_Invalid_SubTable;
|
||||
error = _hb_err(HB_Err_Invalid_SubTable);
|
||||
goto Fail;
|
||||
}
|
||||
}
|
||||
|
||||
FORGET_Frame();
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
|
||||
Fail:
|
||||
FREE( cf2->RangeRecord );
|
||||
|
@ -773,10 +773,10 @@ static void Free_Coverage2( HB_CoverageFormat2* cf2,
|
|||
}
|
||||
|
||||
|
||||
FT_Error _HB_OPEN_Load_Coverage( HB_Coverage* c,
|
||||
HB_Error _HB_OPEN_Load_Coverage( HB_Coverage* c,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
|
||||
if ( ACCESS_Frame( 2L ) )
|
||||
return error;
|
||||
|
@ -787,17 +787,12 @@ FT_Error _HB_OPEN_Load_Coverage( HB_Coverage* c,
|
|||
|
||||
switch ( c->CoverageFormat )
|
||||
{
|
||||
case 1:
|
||||
return Load_Coverage1( &c->cf.cf1, stream );
|
||||
|
||||
case 2:
|
||||
return Load_Coverage2( &c->cf.cf2, stream );
|
||||
|
||||
default:
|
||||
return HB_Err_Invalid_SubTable_Format;
|
||||
case 1: return Load_Coverage1( &c->cf.cf1, stream );
|
||||
case 2: return Load_Coverage2( &c->cf.cf2, stream );
|
||||
default: return _hb_err(HB_Err_Invalid_SubTable_Format);
|
||||
}
|
||||
|
||||
return FT_Err_Ok; /* never reached */
|
||||
return HB_Err_Ok; /* never reached */
|
||||
}
|
||||
|
||||
|
||||
|
@ -806,18 +801,14 @@ void _HB_OPEN_Free_Coverage( HB_Coverage* c,
|
|||
{
|
||||
switch ( c->CoverageFormat )
|
||||
{
|
||||
case 1:
|
||||
Free_Coverage1( &c->cf.cf1, memory );
|
||||
break;
|
||||
|
||||
case 2:
|
||||
Free_Coverage2( &c->cf.cf2, memory );
|
||||
break;
|
||||
case 1: Free_Coverage1( &c->cf.cf1, memory ); break;
|
||||
case 2: Free_Coverage2( &c->cf.cf2, memory ); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static FT_Error Coverage_Index1( HB_CoverageFormat1* cf1,
|
||||
static HB_Error Coverage_Index1( HB_CoverageFormat1* cf1,
|
||||
FT_UShort glyphID,
|
||||
FT_UShort* index )
|
||||
{
|
||||
|
@ -847,7 +838,7 @@ static FT_Error Coverage_Index1( HB_CoverageFormat1* cf1,
|
|||
if ( glyphID == array[middle] )
|
||||
{
|
||||
*index = middle;
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
else if ( glyphID < array[middle] )
|
||||
{
|
||||
|
@ -867,7 +858,7 @@ static FT_Error Coverage_Index1( HB_CoverageFormat1* cf1,
|
|||
}
|
||||
|
||||
|
||||
static FT_Error Coverage_Index2( HB_CoverageFormat2* cf2,
|
||||
static HB_Error Coverage_Index2( HB_CoverageFormat2* cf2,
|
||||
FT_UShort glyphID,
|
||||
FT_UShort* index )
|
||||
{
|
||||
|
@ -897,7 +888,7 @@ static FT_Error Coverage_Index2( HB_CoverageFormat2* cf2,
|
|||
if ( glyphID >= rr[middle].Start && glyphID <= rr[middle].End )
|
||||
{
|
||||
*index = rr[middle].StartCoverageIndex + glyphID - rr[middle].Start;
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
else if ( glyphID < rr[middle].Start )
|
||||
{
|
||||
|
@ -917,23 +908,18 @@ static FT_Error Coverage_Index2( HB_CoverageFormat2* cf2,
|
|||
}
|
||||
|
||||
|
||||
FT_Error _HB_OPEN_Coverage_Index( HB_Coverage* c,
|
||||
HB_Error _HB_OPEN_Coverage_Index( HB_Coverage* c,
|
||||
FT_UShort glyphID,
|
||||
FT_UShort* index )
|
||||
{
|
||||
switch ( c->CoverageFormat )
|
||||
{
|
||||
case 1:
|
||||
return Coverage_Index1( &c->cf.cf1, glyphID, index );
|
||||
|
||||
case 2:
|
||||
return Coverage_Index2( &c->cf.cf2, glyphID, index );
|
||||
|
||||
default:
|
||||
return HB_Err_Invalid_SubTable_Format;
|
||||
case 1: return Coverage_Index1( &c->cf.cf1, glyphID, index );
|
||||
case 2: return Coverage_Index2( &c->cf.cf2, glyphID, index );
|
||||
default: return _hb_err(HB_Err_Invalid_SubTable_Format);
|
||||
}
|
||||
|
||||
return FT_Err_Ok; /* never reached */
|
||||
return HB_Err_Ok; /* never reached */
|
||||
}
|
||||
|
||||
|
||||
|
@ -945,11 +931,11 @@ FT_Error _HB_OPEN_Coverage_Index( HB_Coverage* c,
|
|||
|
||||
/* ClassDefFormat1 */
|
||||
|
||||
static FT_Error Load_ClassDef1( HB_ClassDefinition* cd,
|
||||
static HB_Error Load_ClassDef1( HB_ClassDefinition* cd,
|
||||
FT_UShort limit,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, count;
|
||||
|
@ -973,7 +959,7 @@ static FT_Error Load_ClassDef1( HB_ClassDefinition* cd,
|
|||
/* sanity check; we are limited to 16bit integers */
|
||||
|
||||
if ( cdf1->StartGlyph + (long)count >= 0x10000L )
|
||||
return HB_Err_Invalid_SubTable;
|
||||
return _hb_err(HB_Err_Invalid_SubTable);
|
||||
|
||||
cdf1->ClassValueArray = NULL;
|
||||
|
||||
|
@ -991,7 +977,7 @@ static FT_Error Load_ClassDef1( HB_ClassDefinition* cd,
|
|||
cva[n] = GET_UShort();
|
||||
if ( cva[n] >= limit )
|
||||
{
|
||||
error = HB_Err_Invalid_SubTable;
|
||||
error = _hb_err(HB_Err_Invalid_SubTable);
|
||||
goto Fail;
|
||||
}
|
||||
d[cva[n]] = TRUE;
|
||||
|
@ -999,7 +985,7 @@ static FT_Error Load_ClassDef1( HB_ClassDefinition* cd,
|
|||
|
||||
FORGET_Frame();
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
|
||||
Fail:
|
||||
FREE( cva );
|
||||
|
@ -1017,11 +1003,11 @@ static void Free_ClassDef1( HB_ClassDefFormat1* cdf1,
|
|||
|
||||
/* ClassDefFormat2 */
|
||||
|
||||
static FT_Error Load_ClassDef2( HB_ClassDefinition* cd,
|
||||
static HB_Error Load_ClassDef2( HB_ClassDefinition* cd,
|
||||
FT_UShort limit,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, count;
|
||||
|
@ -1037,7 +1023,8 @@ static FT_Error Load_ClassDef2( HB_ClassDefinition* cd,
|
|||
if ( ACCESS_Frame( 2L ) )
|
||||
return error;
|
||||
|
||||
count = cdf2->ClassRangeCount = GET_UShort();
|
||||
count = GET_UShort();
|
||||
cdf2->ClassRangeCount = 0; /* zero for now. we fill with the number of good entries later */
|
||||
|
||||
FORGET_Frame();
|
||||
|
||||
|
@ -1063,15 +1050,22 @@ static FT_Error Load_ClassDef2( HB_ClassDefinition* cd,
|
|||
if ( crr[n].Start > crr[n].End ||
|
||||
crr[n].Class >= limit )
|
||||
{
|
||||
error = HB_Err_Invalid_SubTable;
|
||||
goto Fail;
|
||||
/* XXX
|
||||
* Corrupt entry. Skip it.
|
||||
* This is hit by Nafees Nastaliq font for example
|
||||
*/
|
||||
n--;
|
||||
count--;
|
||||
}
|
||||
d[crr[n].Class] = TRUE;
|
||||
else
|
||||
d[crr[n].Class] = TRUE;
|
||||
}
|
||||
|
||||
FORGET_Frame();
|
||||
|
||||
return FT_Err_Ok;
|
||||
cdf2->ClassRangeCount = count;
|
||||
|
||||
return HB_Err_Ok;
|
||||
|
||||
Fail:
|
||||
FREE( crr );
|
||||
|
@ -1089,11 +1083,11 @@ static void Free_ClassDef2( HB_ClassDefFormat2* cdf2,
|
|||
|
||||
/* ClassDefinition */
|
||||
|
||||
FT_Error _HB_OPEN_Load_ClassDefinition( HB_ClassDefinition* cd,
|
||||
HB_Error _HB_OPEN_Load_ClassDefinition( HB_ClassDefinition* cd,
|
||||
FT_UShort limit,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
|
||||
|
@ -1109,17 +1103,9 @@ FT_Error _HB_OPEN_Load_ClassDefinition( HB_ClassDefinition* cd,
|
|||
|
||||
switch ( cd->ClassFormat )
|
||||
{
|
||||
case 1:
|
||||
error = Load_ClassDef1( cd, limit, stream );
|
||||
break;
|
||||
|
||||
case 2:
|
||||
error = Load_ClassDef2( cd, limit, stream );
|
||||
break;
|
||||
|
||||
default:
|
||||
error = HB_Err_Invalid_SubTable_Format;
|
||||
break;
|
||||
case 1: error = Load_ClassDef1( cd, limit, stream ); break;
|
||||
case 2: error = Load_ClassDef2( cd, limit, stream ); break;
|
||||
default: error = _hb_err(HB_Err_Invalid_SubTable_Format); break;
|
||||
}
|
||||
|
||||
if ( error )
|
||||
|
@ -1127,7 +1113,7 @@ FT_Error _HB_OPEN_Load_ClassDefinition( HB_ClassDefinition* cd,
|
|||
|
||||
cd->loaded = TRUE;
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
|
||||
Fail:
|
||||
FREE( cd->Defined );
|
||||
|
@ -1135,10 +1121,10 @@ Fail:
|
|||
}
|
||||
|
||||
|
||||
FT_Error _HB_OPEN_Load_EmptyClassDefinition( HB_ClassDefinition* cd,
|
||||
HB_Error _HB_OPEN_Load_EmptyClassDefinition( HB_ClassDefinition* cd,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
|
||||
|
@ -1151,7 +1137,7 @@ FT_Error _HB_OPEN_Load_EmptyClassDefinition( HB_ClassDefinition* cd,
|
|||
if ( ALLOC_ARRAY( cd->cd.cd1.ClassValueArray, 1, FT_UShort ) )
|
||||
goto Fail;
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
|
||||
Fail:
|
||||
FREE( cd->Defined );
|
||||
|
@ -1168,18 +1154,14 @@ void _HB_OPEN_Free_ClassDefinition( HB_ClassDefinition* cd,
|
|||
|
||||
switch ( cd->ClassFormat )
|
||||
{
|
||||
case 1:
|
||||
Free_ClassDef1( &cd->cd.cd1, memory );
|
||||
break;
|
||||
|
||||
case 2:
|
||||
Free_ClassDef2( &cd->cd.cd2, memory );
|
||||
break;
|
||||
case 1: Free_ClassDef1( &cd->cd.cd1, memory ); break;
|
||||
case 2: Free_ClassDef2( &cd->cd.cd2, memory ); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static FT_Error Get_Class1( HB_ClassDefFormat1* cdf1,
|
||||
static HB_Error Get_Class1( HB_ClassDefFormat1* cdf1,
|
||||
FT_UShort glyphID,
|
||||
FT_UShort* class,
|
||||
FT_UShort* index )
|
||||
|
@ -1194,7 +1176,7 @@ static FT_Error Get_Class1( HB_ClassDefFormat1* cdf1,
|
|||
glyphID < cdf1->StartGlyph + cdf1->GlyphCount )
|
||||
{
|
||||
*class = cva[glyphID - cdf1->StartGlyph];
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1207,12 +1189,12 @@ static FT_Error Get_Class1( HB_ClassDefFormat1* cdf1,
|
|||
/* we need the index value of the last searched class range record
|
||||
in case of failure for constructed GDEF tables */
|
||||
|
||||
static FT_Error Get_Class2( HB_ClassDefFormat2* cdf2,
|
||||
static HB_Error Get_Class2( HB_ClassDefFormat2* cdf2,
|
||||
FT_UShort glyphID,
|
||||
FT_UShort* class,
|
||||
FT_UShort* index )
|
||||
{
|
||||
FT_Error error = FT_Err_Ok;
|
||||
HB_Error error = HB_Err_Ok;
|
||||
FT_UShort min, max, new_min, new_max, middle;
|
||||
|
||||
HB_ClassRangeRecord* crr = cdf2->ClassRangeRecord;
|
||||
|
@ -1245,7 +1227,7 @@ static FT_Error Get_Class2( HB_ClassDefFormat2* cdf2,
|
|||
if ( glyphID >= crr[middle].Start && glyphID <= crr[middle].End )
|
||||
{
|
||||
*class = crr[middle].Class;
|
||||
error = FT_Err_Ok;
|
||||
error = HB_Err_Ok;
|
||||
break;
|
||||
}
|
||||
else if ( glyphID < crr[middle].Start )
|
||||
|
@ -1277,24 +1259,19 @@ static FT_Error Get_Class2( HB_ClassDefFormat2* cdf2,
|
|||
}
|
||||
|
||||
|
||||
FT_Error _HB_OPEN_Get_Class( HB_ClassDefinition* cd,
|
||||
HB_Error _HB_OPEN_Get_Class( HB_ClassDefinition* cd,
|
||||
FT_UShort glyphID,
|
||||
FT_UShort* class,
|
||||
FT_UShort* index )
|
||||
{
|
||||
switch ( cd->ClassFormat )
|
||||
{
|
||||
case 1:
|
||||
return Get_Class1( &cd->cd.cd1, glyphID, class, index );
|
||||
|
||||
case 2:
|
||||
return Get_Class2( &cd->cd.cd2, glyphID, class, index );
|
||||
|
||||
default:
|
||||
return HB_Err_Invalid_SubTable_Format;
|
||||
case 1: return Get_Class1( &cd->cd.cd1, glyphID, class, index );
|
||||
case 2: return Get_Class2( &cd->cd.cd2, glyphID, class, index );
|
||||
default: return _hb_err(HB_Err_Invalid_SubTable_Format);
|
||||
}
|
||||
|
||||
return FT_Err_Ok; /* never reached */
|
||||
return HB_Err_Ok; /* never reached */
|
||||
}
|
||||
|
||||
|
||||
|
@ -1304,10 +1281,10 @@ FT_Error _HB_OPEN_Get_Class( HB_ClassDefinition* cd,
|
|||
***************************/
|
||||
|
||||
|
||||
FT_Error _HB_OPEN_Load_Device( HB_Device* d,
|
||||
HB_Error _HB_OPEN_Load_Device( HB_Device* d,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Error error;
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, count;
|
||||
|
@ -1324,11 +1301,18 @@ FT_Error _HB_OPEN_Load_Device( HB_Device* d,
|
|||
|
||||
FORGET_Frame();
|
||||
|
||||
d->DeltaValue = NULL;
|
||||
|
||||
if ( d->StartSize > d->EndSize ||
|
||||
d->DeltaFormat == 0 || d->DeltaFormat > 3 )
|
||||
return HB_Err_Invalid_SubTable;
|
||||
|
||||
d->DeltaValue = NULL;
|
||||
{
|
||||
/* XXX
|
||||
* I've seen fontforge generate DeltaFormat == 0.
|
||||
* Just return Ok and let the NULL DeltaValue disable
|
||||
* this table.
|
||||
*/
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
|
||||
count = ( ( d->EndSize - d->StartSize + 1 ) >>
|
||||
( 4 - d->DeltaFormat ) ) + 1;
|
||||
|
@ -1349,7 +1333,7 @@ FT_Error _HB_OPEN_Load_Device( HB_Device* d,
|
|||
|
||||
FORGET_Frame();
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1395,7 +1379,7 @@ void _HB_OPEN_Free_Device( HB_Device* d,
|
|||
|
||||
mask = 0x00FF */
|
||||
|
||||
FT_Error _HB_OPEN_Get_Device( HB_Device* d,
|
||||
HB_Error _HB_OPEN_Get_Device( HB_Device* d,
|
||||
FT_UShort size,
|
||||
FT_Short* value )
|
||||
{
|
||||
|
@ -1418,7 +1402,7 @@ FT_Error _HB_OPEN_Get_Device( HB_Device* d,
|
|||
if ( *value >= ( ( mask + 1 ) >> 1 ) )
|
||||
*value -= mask + 1;
|
||||
|
||||
return FT_Err_Ok;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -25,12 +25,21 @@ FT_BEGIN_HEADER
|
|||
|
||||
#define HB_MAX_NESTING_LEVEL 100
|
||||
|
||||
typedef FT_Error HB_Error;
|
||||
|
||||
#define HB_Err_Invalid_Argument FT_Err_Invalid_Argument
|
||||
#define HB_Err_Invalid_Face_Handle FT_Err_Invalid_Face_Handle
|
||||
#define HB_Err_Invalid_Stream_Operation FT_Err_Invalid_Stream_Operation
|
||||
#define HB_Err_Empty_Script 0x1005
|
||||
|
||||
#define HB_Err_Ok FT_Err_Ok
|
||||
#define HB_Err_Not_Covered 0x1002
|
||||
#define HB_Err_Out_Of_Memory FT_Err_Out_Of_Memory
|
||||
#define HB_Err_Table_Missing FT_Err_Table_Missing
|
||||
#define HB_Err_Invalid_SubTable_Format 0x1000
|
||||
#define HB_Err_Invalid_SubTable 0x1001
|
||||
#define HB_Err_Not_Covered 0x1002
|
||||
#define HB_Err_Too_Many_Nested_Contexts 0x1003
|
||||
#define HB_Err_No_MM_Interpreter 0x1004
|
||||
#define HB_Err_Empty_Script 0x1005
|
||||
|
||||
|
||||
/* Script list related structures */
|
||||
|
|
Loading…
Reference in New Issue