20 #include FT_FREETYPE_H 21 #include FT_ADVANCES_H 26 #ifdef FT_CONFIG_OPTION_USE_HARFBUZZ 36 #define FT_COMPONENT trace_afshaper 61 #define COVERAGE( name, NAME, description, \ 62 tag1, tag2, tag3, tag4 ) \ 63 static const hb_tag_t name ## _coverage[] = \ 65 HB_TAG( tag1, tag2, tag3, tag4 ), \ 75 #define COVERAGE( name, NAME, description, \ 76 tag1, tag2, tag3, tag4 ) \ 80 static const hb_tag_t* coverages[] =
90 #define SCRIPT( s, S, d, h, H, ss ) h, 93 static const hb_script_t scripts[] =
107 hb_set_t* gsub_lookups =
NULL;
108 hb_set_t* gsub_glyphs =
NULL;
109 hb_set_t* gpos_lookups =
NULL;
110 hb_set_t* gpos_glyphs =
NULL;
113 const hb_tag_t* coverage_tags;
114 hb_tag_t script_tags[] = { HB_TAG_NONE,
120 #ifdef FT_DEBUG_LEVEL_TRACE 125 if ( !globals || !style_class || !gstyles )
126 return FT_THROW( Invalid_Argument );
128 face = hb_font_get_face( globals->hb_font );
130 coverage_tags = coverages[style_class->
coverage];
136 hb_ot_tags_from_script(
script,
143 if ( default_script )
145 if ( script_tags[0] == HB_TAG_NONE )
146 script_tags[0] = HB_OT_TAG_DEFAULT_SCRIPT;
149 if ( script_tags[1] == HB_TAG_NONE )
150 script_tags[1] = HB_OT_TAG_DEFAULT_SCRIPT;
151 else if ( script_tags[1] != HB_OT_TAG_DEFAULT_SCRIPT )
152 script_tags[2] = HB_OT_TAG_DEFAULT_SCRIPT;
159 if ( script_tags[0] == HB_OT_TAG_DEFAULT_SCRIPT )
162 if ( script_tags[1] == HB_OT_TAG_DEFAULT_SCRIPT )
163 script_tags[1] = HB_TAG_NONE;
166 gsub_lookups = hb_set_create();
167 hb_ot_layout_collect_lookups(
face,
174 if ( hb_set_is_empty( gsub_lookups ) )
177 FT_TRACE4((
"GSUB lookups (style `%s'):\n" 179 af_style_names[style_class->
style] ));
181 #ifdef FT_DEBUG_LEVEL_TRACE 185 gsub_glyphs = hb_set_create();
186 for (
idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_lookups, &
idx ); )
188 #ifdef FT_DEBUG_LEVEL_TRACE 194 hb_ot_layout_lookup_collect_glyphs(
face,
203 #ifdef FT_DEBUG_LEVEL_TRACE 209 FT_TRACE4((
"GPOS lookups (style `%s'):\n" 211 af_style_names[style_class->
style] ));
213 gpos_lookups = hb_set_create();
214 hb_ot_layout_collect_lookups(
face,
221 #ifdef FT_DEBUG_LEVEL_TRACE 225 gpos_glyphs = hb_set_create();
226 for (
idx = HB_SET_VALUE_INVALID; hb_set_next( gpos_lookups, &
idx ); )
228 #ifdef FT_DEBUG_LEVEL_TRACE 234 hb_ot_layout_lookup_collect_glyphs(
face,
243 #ifdef FT_DEBUG_LEVEL_TRACE 255 if ( style_class->
coverage != AF_COVERAGE_DEFAULT )
275 for (
idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_lookups,
281 if ( hb_ot_layout_lookup_would_substitute(
face,
idx,
293 FT_TRACE4((
" no blue characters found; style skipped\n" ));
345 if ( style_class->
coverage != AF_COVERAGE_DEFAULT )
346 hb_set_subtract( gsub_glyphs, gpos_glyphs );
348 #ifdef FT_DEBUG_LEVEL_TRACE 349 FT_TRACE4((
" glyphs without GPOS data (`*' means already assigned)" ));
353 for (
idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_glyphs, &
idx ); )
355 #ifdef FT_DEBUG_LEVEL_TRACE 356 if ( !(
count % 10 ) )
378 #ifdef FT_DEBUG_LEVEL_TRACE 386 hb_set_destroy( gsub_lookups );
387 hb_set_destroy( gsub_glyphs );
388 hb_set_destroy( gpos_lookups );
389 hb_set_destroy( gpos_glyphs );
397 #define COVERAGE( name, NAME, description, \ 398 tag1, tag2, tag3, tag4 ) \ 399 static const hb_feature_t name ## _feature[] = \ 402 HB_TAG( tag1, tag2, tag3, tag4 ), \ 403 1, 0, (unsigned int)-1 \ 413 #define COVERAGE( name, NAME, description, \ 414 tag1, tag2, tag3, tag4 ) \ 418 static const hb_feature_t* features[] =
431 return (
void*)hb_buffer_create();
441 hb_buffer_destroy( (hb_buffer_t*)
buf );
449 unsigned int*
count )
457 hb_buffer_t*
buf = (hb_buffer_t*)buf_;
459 hb_codepoint_t
dummy;
463 style_class =
metrics->style_class;
469 hb_font_set_scale(
font, upem, upem );
476 while ( !( *
q ==
' ' || *
q ==
'\0' ) )
481 hb_buffer_clear_contents(
buf );
485 hb_buffer_guess_segment_properties(
buf );
493 hb_buffer_t* hb_buf =
metrics->globals->hb_buf;
496 hb_glyph_info_t* ginfo;
498 unsigned int hb_gcount;
499 hb_glyph_info_t* hb_ginfo;
506 hb_buffer_clear_contents( hb_buf );
507 hb_buffer_add_utf8( hb_buf,
p,
len, 0,
len );
508 hb_buffer_guess_segment_properties( hb_buf );
511 ginfo = hb_buffer_get_glyph_infos(
buf, &gcount );
512 hb_ginfo = hb_buffer_get_glyph_infos( hb_buf, &hb_gcount );
514 if ( gcount == hb_gcount )
519 for (
i = 0;
i < gcount;
i++ )
520 if ( ginfo[
i].codepoint != hb_ginfo[
i].codepoint )
526 hb_buffer_clear_contents(
buf );
531 *
count = hb_buffer_get_length(
buf );
533 #ifdef FT_DEBUG_LEVEL_TRACE 536 " input character mapped to multiple glyphs\n" ));
550 hb_buffer_t*
buf = (hb_buffer_t*)buf_;
551 hb_glyph_info_t* ginfo;
552 hb_glyph_position_t* gpos;
558 ginfo = hb_buffer_get_glyph_infos(
buf, &gcount );
559 gpos = hb_buffer_get_glyph_positions(
buf, &gcount );
567 *y_offset = gpos[
idx].y_offset;
569 return ginfo[
idx].codepoint;
620 unsigned int*
count )
634 while ( !( *
p ==
' ' || *
p ==
'\0' ) )
INTERNETFEATURELIST feature
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
GLuint GLuint GLsizei count
#define FT_LOAD_NO_HINTING
const char * af_shaper_get_cluster(const char *p, AF_StyleMetrics metrics, void *buf_, unsigned int *count)
static char memory[1024 *256]
FT_BEGIN_HEADER typedef unsigned char FT_Bool
GLenum GLuint GLenum GLsizei const GLchar * buf
#define FT_TRACE1(varformat)
#define FT_TRACE4(varformat)
FT_Get_Advance(FT_Face face, FT_UInt gindex, FT_Int32 load_flags, FT_Fixed *padvance)
FT_Get_Char_Index(FT_Face face, FT_ULong charcode)
#define FT_DEBUG_LEVEL_TRACE
FT_Error af_shaper_get_coverage(AF_FaceGlobals globals, AF_StyleClass style_class, FT_UShort *gstyles, FT_Bool default_script)
GLdouble GLdouble GLdouble GLdouble q
#define GET_UTF8_CHAR(ch, p)
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
_STLP_MOVE_TO_STD_NAMESPACE void _STLP_CALL advance(_InputIterator &__i, _Distance __n)
enum AF_Blue_Stringset_ AF_Blue_Stringset
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
void af_shaper_buf_destroy(FT_Face face, void *buf)
#define FT_MEM_ALLOC(ptr, size)
#define AF_STYLE_UNASSIGNED
void * af_shaper_buf_create(FT_Face face)
#define FT_LOAD_IGNORE_TRANSFORM
static struct msdos_boot_sector bs
FT_ULong af_shaper_get_elem(AF_StyleMetrics metrics, void *buf_, unsigned int idx, FT_Long *advance, FT_Long *y_offset)
GLenum GLuint GLint GLenum face
AF_Blue_Stringset blue_stringset
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *