#include <freetype/freetype.h>
#include <freetype/ftadvanc.h>
#include "afglobal.h"
#include "aftypes.h"
#include "afshaper.h"
#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
#undef FT_COMPONENT
#define FT_COMPONENT …
#undef COVERAGE
#define COVERAGE( name, NAME, description, \
tag1, tag2, tag3, tag4 ) …
#include "afcover.h"
#undef COVERAGE
#define COVERAGE( name, NAME, description, \
tag1, tag2, tag3, tag4 ) …
static const hb_tag_t* coverages[] = …;
#undef SCRIPT
#define SCRIPT( s, S, d, h, H, ss ) …
static const hb_script_t scripts[] = …;
FT_Error
af_shaper_get_coverage( AF_FaceGlobals globals,
AF_StyleClass style_class,
FT_UShort* gstyles,
FT_Bool default_script )
{ … }
#undef COVERAGE
#define COVERAGE( name, NAME, description, \
tag1, tag2, tag3, tag4 ) …
#include "afcover.h"
#undef COVERAGE
#define COVERAGE( name, NAME, description, \
tag1, tag2, tag3, tag4 ) …
static const hb_feature_t* features[] = …;
void*
af_shaper_buf_create( FT_Face face )
{ … }
void
af_shaper_buf_destroy( FT_Face face,
void* buf )
{ … }
const char*
af_shaper_get_cluster( const char* p,
AF_StyleMetrics metrics,
void* buf_,
unsigned int* count )
{ … }
FT_ULong
af_shaper_get_elem( AF_StyleMetrics metrics,
void* buf_,
unsigned int idx,
FT_Long* advance,
FT_Long* y_offset )
{ … }
#else
FT_Error
af_shaper_get_coverage( AF_FaceGlobals globals,
AF_StyleClass style_class,
FT_UShort* gstyles,
FT_Bool default_script )
{
FT_UNUSED( globals );
FT_UNUSED( style_class );
FT_UNUSED( gstyles );
FT_UNUSED( default_script );
return FT_Err_Ok;
}
void*
af_shaper_buf_create( FT_Face face )
{
FT_UNUSED( face );
return NULL;
}
void
af_shaper_buf_destroy( FT_Face face,
void* buf )
{
FT_UNUSED( face );
FT_UNUSED( buf );
}
const char*
af_shaper_get_cluster( const char* p,
AF_StyleMetrics metrics,
void* buf_,
unsigned int* count )
{
FT_Face face = metrics->globals->face;
FT_ULong ch, dummy = 0;
FT_ULong* buf = (FT_ULong*)buf_;
while ( *p == ' ' )
p++;
GET_UTF8_CHAR( ch, p );
while ( !( *p == ' ' || *p == '\0' ) )
GET_UTF8_CHAR( dummy, p );
if ( dummy )
{
*buf = 0;
*count = 0;
}
else
{
*buf = FT_Get_Char_Index( face, ch );
*count = 1;
}
return p;
}
FT_ULong
af_shaper_get_elem( AF_StyleMetrics metrics,
void* buf_,
unsigned int idx,
FT_Long* advance,
FT_Long* y_offset )
{
FT_Face face = metrics->globals->face;
FT_ULong glyph_index = *(FT_ULong*)buf_;
FT_UNUSED( idx );
if ( advance )
FT_Get_Advance( face,
glyph_index,
FT_LOAD_NO_SCALE |
FT_LOAD_NO_HINTING |
FT_LOAD_IGNORE_TRANSFORM,
advance );
if ( y_offset )
*y_offset = 0;
return glyph_index;
}
#endif