22#include FT_FONT_FORMATS_H
24#include FT_INTERNAL_VALIDATE_H
25#include FT_INTERNAL_OBJECTS_H
26#include FT_INTERNAL_DEBUG_H
27#include FT_INTERNAL_RFORK_H
28#include FT_INTERNAL_STREAM_H
29#include FT_INTERNAL_SFNT_H
30#include FT_INTERNAL_POSTSCRIPT_AUX_H
32#include FT_TRUETYPE_TABLES_H
33#include FT_TRUETYPE_TAGS_H
34#include FT_TRUETYPE_IDS_H
36#include FT_SERVICE_PROPERTIES_H
37#include FT_SERVICE_SFNT_H
38#include FT_SERVICE_POSTSCRIPT_NAME_H
39#include FT_SERVICE_GLYPH_DICT_H
40#include FT_SERVICE_TT_CMAP_H
41#include FT_SERVICE_KERNING_H
42#include FT_SERVICE_TRUETYPE_ENGINE_H
46#ifdef FT_CONFIG_OPTION_MAC_FONTS
51#ifdef FT_DEBUG_LEVEL_TRACE
55#if defined( _MSC_VER )
60#pragma warning( push )
61#pragma warning( disable : 4244 )
68#define MD5_u32plus FT_MD5_u32plus
69#define MD5_CTX FT_MD5_CTX
70#define MD5_Init FT_MD5_Init
71#define MD5_Update FT_MD5_Update
72#define MD5_Final FT_MD5_Final
78#if defined( _MSC_VER )
85#define GRID_FIT_METRICS
99 const char* service_id )
105 if (
desc && service_id )
190 return FT_THROW( Invalid_Library_Handle );
193 return FT_THROW( Invalid_Argument );
210#ifndef FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT
269#define FT_COMPONENT trace_objs
322 slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
363 cbox.
xMin += x_shift;
364 cbox.
yMin += y_shift;
365 cbox.
xMax += x_shift;
366 cbox.
yMax += y_shift;
428 x_left = cbox.
xMin >> 6;
429 y_top = cbox.
yMax >> 6;
434 switch ( pixel_mode )
437 pitch = ( (
width + 15 ) >> 4 ) << 1;
457 bitmap->pixel_mode = (
unsigned char)pixel_mode;
505 slot->bitmap.width = 0;
506 slot->bitmap.rows = 0;
507 slot->bitmap.pitch = 0;
508 slot->bitmap.pixel_mode = 0;
511 slot->bitmap_left = 0;
512 slot->bitmap_top = 0;
513 slot->num_subglyphs = 0;
516 slot->control_len = 0;
518 slot->format = FT_GLYPH_FORMAT_NONE;
520 slot->linearHoriAdvance = 0;
521 slot->linearVertAdvance = 0;
542 if (
slot->internal )
570 return FT_THROW( Invalid_Face_Handle );
573 return FT_THROW( Invalid_Argument );
579 FT_TRACE4((
"FT_New_GlyphSlot: Creating new slot object\n" ));
636 if (
slot->generic.finalizer )
669 internal->transform_matrix.xx = 0x10000L;
672 internal->transform_matrix.yy = 0x10000L;
696 if ( delta->x | delta->y )
705#ifdef GRID_FIT_METRICS
762 FT_Int32 load_flags )
774 return FT_THROW( Invalid_Face_Handle );
797 load_flags &= ~FT_LOAD_RENDER;
801 load_flags &= ~FT_LOAD_RENDER;
832 (
face->internal->transform_matrix.yx == 0 &&
833 face->internal->transform_matrix.xx != 0 ) ||
834 (
face->internal->transform_matrix.xx == 0 &&
835 face->internal->transform_matrix.yx != 0 ) ) )
861 !is_light_type1 ) ) ||
888 if ( !
error &&
slot->format == FT_GLYPH_FORMAT_BITMAP )
906 glyph_index, load_flags );
908 internal->transform_flags = transform_flags;
927#ifdef GRID_FIT_METRICS
940 slot->advance.y =
slot->metrics.vertAdvance;
944 slot->advance.x =
slot->metrics.horiAdvance;
983 if (
internal->transform_flags & 1 )
987 if (
internal->transform_flags & 2 )
1001 slot->format != FT_GLYPH_FORMAT_BITMAP &&
1002 slot->format != FT_GLYPH_FORMAT_COMPOSITE )
1017 FT_TRACE5((
"FT_Load_Glyph: index %d, flags %x\n",
1018 glyph_index, load_flags ));
1022 slot->linearHoriAdvance / 65536.0 ));
1024 slot->linearVertAdvance / 65536.0 ));
1026 slot->bitmap.width,
slot->bitmap.rows,
1027 slot->bitmap.pixel_mode ));
1039 FT_Int32 load_flags )
1045 return FT_THROW( Invalid_Face_Handle );
1047 glyph_index = (
FT_UInt)char_code;
1048 if (
face->charmap )
1062 if (
size->generic.finalizer )
1066 if (
driver->clazz->done_size )
1088 for (
n = 0;
n <
face->num_charmaps;
n++ )
1099 face->num_charmaps = 0;
1113 if (
face->autohint.finalizer )
1114 face->autohint.finalizer(
face->autohint.data );
1118 while (
face->glyph )
1129 if (
face->generic.finalizer )
1147 if (
face->internal )
1192 return FT_THROW( Invalid_CharMap_Handle );
1254 return FT_THROW( Invalid_CharMap_Handle );
1331 face->stream = *astream;
1334 if ( external_stream )
1342#ifdef FT_CONFIG_OPTION_INCREMENTAL
1347 face->internal->incremental_interface =
NULL;
1348 for (
i = 0;
i < num_params && !
face->internal->incremental_interface;
1351 face->internal->incremental_interface =
1356 face->internal->random_seed = -1;
1364 *astream =
face->stream;
1416 return FT_THROW( Invalid_Argument );
1442 return FT_THROW( Invalid_Argument );
1445 args.memory_base = file_base;
1453#ifdef FT_CONFIG_OPTION_MAC_FONTS
1514 return FT_THROW( Invalid_Library_Handle );
1517 return FT_THROW( Invalid_Argument );
1542 const char* driver_name,
1554 memory_stream_close,
1576 if ( face_index > 0 )
1577 face_index &= 0x7FFF0000L;
1583 (*aface)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM;
1623 *is_sfnt_cid =
FALSE;
1631 return FT_THROW( Unknown_File_Format );
1639 *is_sfnt_cid =
FALSE;
1641 for (
i = 0;
i < numTables;
i++ )
1652 *is_sfnt_cid =
TRUE;
1653 if ( face_index < 0 )
1661 *is_sfnt_cid =
FALSE;
1662 if ( face_index < 0 )
1665 if ( face_index >= 0 && pstable_index == face_index )
1693 if ( face_index > 0 )
1694 face_index &= 0xFFFFL;
1708 FT_TRACE2((
"open_face_PS_from_sfnt_stream: invalid table offset\n" ));
1714 FT_TRACE2((
"open_face_PS_from_sfnt_stream: invalid table length\n" ));
1737 is_sfnt_cid ?
"cid" :
"type1",
1778 FT_ULong pfb_len, pfb_pos, pfb_lenpos;
1782 if ( face_index == -1 )
1784 if ( face_index != 0 )
1790 for (
i = 0;
i < resource_cnt;
i++ )
1801 FT_TRACE4((
" POST fragment #%d: length=0x%08x"
1802 " total pfb_len=0x%08x\n",
1805 if ( FT_MAC_RFORK_MAX_LEN <
temp ||
1806 FT_MAC_RFORK_MAX_LEN -
temp < pfb_len + 6 )
1808 FT_TRACE2((
" MacOS resource length cannot exceed"
1810 FT_MAC_RFORK_MAX_LEN ));
1816 pfb_len +=
temp + 6;
1819 FT_TRACE2((
" total buffer size to concatenate"
1820 " %d POST fragments: 0x%08x\n",
1821 resource_cnt, pfb_len + 2 ));
1823 if ( pfb_len + 2 < 6 )
1825 FT_TRACE2((
" too long fragment length makes"
1826 " pfb_len confused: pfb_len=0x%08x\n",
1848 for (
i = 0;
i < resource_cnt;
i++ )
1859 if ( 0x7FFFFFFFUL < rlen )
1869 " offsets=0x%08x, rlen=0x%08x, flags=0x%04x\n",
1877 if ( (
flags >> 8 ) == 0 )
1879 FT_TRACE3((
" Skip POST fragment #%d because it is a comment\n",
1895 FT_TRACE3((
" Write POST fragment #%d header (4-byte) to buffer"
1897 i, pfb_data, pfb_lenpos ));
1899 if ( pfb_lenpos + 3 > pfb_len + 2 )
1903 pfb_data[pfb_lenpos + 1] = (
FT_Byte)(
len >> 8 );
1904 pfb_data[pfb_lenpos + 2] = (
FT_Byte)(
len >> 16 );
1905 pfb_data[pfb_lenpos + 3] = (
FT_Byte)(
len >> 24 );
1907 if ( (
flags >> 8 ) == 5 )
1910 FT_TRACE3((
" Write POST fragment #%d header (6-byte) to buffer"
1912 i, pfb_data, pfb_pos ));
1914 if ( pfb_pos + 6 > pfb_len + 2 )
1917 pfb_data[pfb_pos++] = 0x80;
1923 pfb_lenpos = pfb_pos;
1924 pfb_data[pfb_pos++] = 0;
1925 pfb_data[pfb_pos++] = 0;
1926 pfb_data[pfb_pos++] = 0;
1927 pfb_data[pfb_pos++] = 0;
1930 if ( pfb_pos > pfb_len || pfb_pos + rlen > pfb_len )
1933 FT_TRACE3((
" Load POST fragment #%d (%d byte) to buffer"
1935 i, rlen, pfb_data, pfb_pos ));
1946 if ( pfb_pos + 2 > pfb_len + 2 )
1948 pfb_data[pfb_pos++] = 0x80;
1949 pfb_data[pfb_pos++] = 3;
1951 if ( pfb_lenpos + 3 > pfb_len + 2 )
1954 pfb_data[pfb_lenpos + 1] = (
FT_Byte)(
len >> 8 );
1955 pfb_data[pfb_lenpos + 2] = (
FT_Byte)(
len >> 16 );
1956 pfb_data[pfb_lenpos + 3] = (
FT_Byte)(
len >> 24 );
1958 return open_face_from_buffer(
library,
1967 FT_TRACE2((
" Abort due to too-short buffer to store"
1968 " all POST fragments\n" ));
1970 FT_TRACE2((
" Abort due to invalid offset in a POST fragment\n" ));
2000 FT_Long face_index_in_resource = 0;
2003 if ( face_index < 0 )
2004 face_index = -face_index - 1;
2005 if ( face_index >= resource_cnt )
2006 return FT_THROW( Cannot_Open_Resource );
2016 return FT_THROW( Cannot_Open_Resource );
2017 if ( (
FT_ULong)rlen > FT_MAC_RFORK_MAX_LEN )
2041 is_cff = rlen > 4 && !
ft_memcmp( sfnt_data,
"OTTO", 4 );
2045 face_index_in_resource,
2046 is_cff ?
"cff" :
"truetype",
2068 FT_Long map_offset, rdata_pos;
2074 &map_offset, &rdata_pos );
2080 map_offset, rdata_pos,
2082 &data_offsets, &
count );
2086 face_index, aface );
2090 (*aface)->num_faces = 1;
2097 map_offset, rdata_pos,
2099 &data_offsets, &
count );
2106 face_index_internal, aface );
2109 (*aface)->num_faces =
count;
2125 unsigned char header[128];
2131 return FT_THROW( Invalid_Stream_Operation );
2149 return FT_THROW( Unknown_File_Format );
2151 dlen = (
header[0x53] << 24 ) |
2156 rlen = (
header[0x57] << 24 ) |
2161 offset = 128 + ( ( dlen + 127 ) & ~127 );
2179#define FT_COMPONENT trace_raccess
2199 is_darwin_vfs = ft_raccess_rule_by_darwin_vfs(
library,
i );
2200 if ( is_darwin_vfs && vfs_rfork_has_no_font )
2202 FT_TRACE3((
"Skip rule %d: darwin vfs resource fork"
2203 " is already checked and"
2204 " no font is found\n",
2211 FT_TRACE3((
"Error 0x%x has occurred in rule %d\n",
2219 FT_TRACE3((
"Try rule %d: %s (offset=%d) ...",
2224 vfs_rfork_has_no_font =
TRUE;
2233 face_index, aface );
2240 else if ( is_darwin_vfs )
2241 vfs_rfork_has_no_font =
TRUE;
2246 if ( file_names[
i] )
2257#define FT_COMPONENT trace_objs
2285#define FT_COMPONENT trace_raccess
2287#ifdef FT_DEBUG_LEVEL_TRACE
2298#define FT_COMPONENT trace_objs
2306 face_index, aface,
args );
2343#ifndef FT_CONFIG_OPTION_MAC_FONTS
2348#ifdef FT_DEBUG_LEVEL_TRACE
2350 if ( face_index < 0 )
2351 FT_TRACE3((
"Requesting number of faces and named instances\n"));
2354 FT_TRACE3((
"Requesting face %ld", face_index & 0xFFFFL ));
2355 if ( face_index & 0x7FFF0000L )
2356 FT_TRACE3((
", named instance %ld", face_index >> 16 ));
2363 if ( ( !aface && face_index >= 0 ) || !
args )
2364 return FT_THROW( Invalid_Argument );
2391 num_params =
args->num_params;
2427 num_params =
args->num_params;
2436#ifdef FT_CONFIG_OPTION_MAC_FONTS
2437 if ( test_mac_fonts &&
2438 ft_strcmp(
cur[0]->clazz->module_name,
"truetype" ) == 0 &&
2474#if !defined( FT_MACINTOSH ) && defined( FT_CONFIG_OPTION_MAC_FONTS )
2475 if ( test_mac_fonts )
2504 FT_TRACE4((
"FT_Open_Face: New face object, adding to list\n" ));
2516 FT_TRACE4((
"FT_Open_Face: Creating glyph slot\n" ));
2518 if ( face_index >= 0 )
2529 FT_TRACE4((
"FT_Open_Face: Creating size object\n" ));
2543 if (
face->height < 0 )
2555 for (
i = 0;
i <
face->num_fixed_sizes;
i++ )
2571 " Invalid bitmap dimensions for strike %d,"
2572 " now disabled\n",
i ));
2587 internal->transform_matrix.xx = 0x10000L;
2590 internal->transform_matrix.yy = 0x10000L;
2599#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
2619#ifdef FT_DEBUG_LEVEL_TRACE
2620 if ( !
error && face_index < 0 )
2622 FT_TRACE3((
"FT_Open_Face: The font has %ld face%s\n"
2623 " and %ld named instance%s for face %ld\n",
2625 face->num_faces == 1 ?
"" :
"s",
2626 face->style_flags >> 16,
2627 (
face->style_flags >> 16 ) == 1 ?
"" :
"s",
2642 const char* filepathname )
2649 if ( !filepathname )
2650 return FT_THROW( Invalid_Argument );
2654 open.pathname = (
char*)filepathname;
2676 return FT_THROW( Invalid_Face_Handle );
2680 return FT_THROW( Invalid_Driver_Handle );
2696 (
FT_Bool)( parameters->stream &&
2710 return FT_THROW( Invalid_Face_Handle );
2712 face->internal->refcount++;
2732 face->internal->refcount--;
2733 if (
face->internal->refcount > 0 )
2777 return FT_THROW( Invalid_Face_Handle );
2780 return FT_THROW( Invalid_Argument );
2782 if ( !
face->driver )
2783 return FT_THROW( Invalid_Driver_Handle );
2837 return FT_THROW( Invalid_Size_Handle );
2841 return FT_THROW( Invalid_Face_Handle );
2845 return FT_THROW( Invalid_Driver_Handle );
2859 if (
face->sizes_list.head )
2885 return FT_THROW( Invalid_Face_Handle );
2889 return FT_THROW( Unimplemented_Feature );
2894 if ( req->width && !req->height )
2896 else if ( !req->width && req->height )
2903 return FT_THROW( Invalid_Pixel_Size );
2905 for (
i = 0;
i <
face->num_fixed_sizes;
i++ )
2915 FT_TRACE3((
"FT_Match_Size: bitmap strike %d matches\n",
i ));
2924 FT_TRACE3((
"FT_Match_Size: no matching bitmap strike\n" ));
2926 return FT_THROW( Invalid_Pixel_Size );
2940 if (
metrics->horiBearingY < 0 )
2942 if ( height < metrics->horiBearingY )
2945 else if (
metrics->horiBearingY > 0 )
2964#ifdef GRID_FIT_METRICS
3001 bsize =
face->available_sizes + strike_index;
3009 face->units_per_EM );
3011 face->units_per_EM );
3038 FT_Long w = 0,
h = 0, scaled_w = 0, scaled_h = 0;
3041 switch ( req->type )
3044 w =
h =
face->units_per_EM;
3057 w =
face->max_advance_width;
3068 goto Calculate_Ppem;
3146 return FT_THROW( Invalid_Face_Handle );
3148 if ( strike_index < 0 || strike_index >=
face->num_fixed_sizes )
3149 return FT_THROW( Invalid_Argument );
3151 clazz =
face->driver->clazz;
3157 FT_TRACE5((
"FT_Select_Size (%s driver):\n",
3158 face->driver->root.clazz->module_name ));
3167#ifdef FT_DEBUG_LEVEL_TRACE
3201 return FT_THROW( Invalid_Face_Handle );
3203 if ( !req || req->width < 0 || req->height < 0 ||
3205 return FT_THROW( Invalid_Argument );
3209 face->size->internal->autohint_metrics.x_scale = 0;
3211 clazz =
face->driver->clazz;
3217 FT_TRACE5((
"FT_Request_Size (%s driver):\n",
3218 face->driver->root.clazz->module_name ));
3242#ifdef FT_DEBUG_LEVEL_TRACE
3279 char_width = char_height;
3280 else if ( !char_height )
3281 char_height = char_width;
3283 if ( !horz_resolution )
3284 horz_resolution = vert_resolution;
3285 else if ( !vert_resolution )
3286 vert_resolution = horz_resolution;
3288 if ( char_width < 1 * 64 )
3289 char_width = 1 * 64;
3290 if ( char_height < 1 * 64 )
3291 char_height = 1 * 64;
3293 if ( !horz_resolution )
3294 horz_resolution = vert_resolution = 72;
3297 req.
width = char_width;
3298 req.
height = char_height;
3318 if ( pixel_width == 0 )
3319 pixel_width = pixel_height;
3320 else if ( pixel_height == 0 )
3321 pixel_height = pixel_width;
3323 if ( pixel_width < 1 )
3325 if ( pixel_height < 1 )
3329 if ( pixel_width >= 0xFFFFU )
3330 pixel_width = 0xFFFFU;
3331 if ( pixel_height >= 0xFFFFU )
3332 pixel_height = 0xFFFFU;
3358 return FT_THROW( Invalid_Face_Handle );
3361 return FT_THROW( Invalid_Argument );
3368 if (
driver->clazz->get_kerning )
3378 akerning->x =
FT_MulFix( akerning->x,
face->size->metrics.x_scale );
3379 akerning->y =
FT_MulFix( akerning->y,
face->size->metrics.y_scale );
3383 FT_Pos orig_x = akerning->x;
3384 FT_Pos orig_y = akerning->y;
3390 if (
face->size->metrics.x_ppem < 25 )
3392 face->size->metrics.x_ppem, 25 );
3393 if (
face->size->metrics.y_ppem < 25 )
3395 face->size->metrics.y_ppem, 25 );
3400#ifdef FT_DEBUG_LEVEL_TRACE
3406 if ( akerning->x != orig_x_rounded ||
3407 akerning->y != orig_y_rounded )
3408 FT_TRACE5((
"FT_Get_Kerning: horizontal kerning"
3409 " (%d, %d) scaled down to (%d, %d) pixels\n",
3410 orig_x_rounded / 64, orig_y_rounded / 64,
3411 akerning->x / 64, akerning->y / 64 ));
3431 FT_Service_Kerning service;
3436 return FT_THROW( Invalid_Face_Handle );
3439 return FT_THROW( Invalid_Argument );
3443 return FT_THROW( Unimplemented_Feature );
3465 return FT_THROW( Invalid_Face_Handle );
3467 if (
encoding == FT_ENCODING_NONE )
3468 return FT_THROW( Invalid_Argument );
3474 if (
encoding == FT_ENCODING_UNICODE )
3479 return FT_THROW( Invalid_CharMap_Handle );
3492 return FT_THROW( Invalid_Argument );
3507 return FT_THROW( Invalid_Face_Handle );
3510 if ( !
cur || !charmap )
3511 return FT_THROW( Invalid_CharMap_Handle );
3514 return FT_THROW( Invalid_Argument );
3520 if (
cur[0] == charmap )
3527 return FT_THROW( Invalid_Argument );
3539 if ( !charmap || !charmap->face )
3542 for (
i = 0;
i < charmap->face->num_charmaps;
i++ )
3543 if ( charmap->face->charmaps[
i] == charmap )
3561 clazz->
done( cmap );
3578 for (
i = 0;
i <
face->num_charmaps;
i++ )
3587 face->num_charmaps - 1 ) )
3591 for (
j =
i + 1;
j <
face->num_charmaps;
j++ )
3593 if (
j ==
face->num_charmaps - 1 )
3594 face->charmaps[
j - 1] = last_charmap;
3599 face->num_charmaps--;
3625 if ( !clazz || !charmap || !charmap->face )
3626 return FT_THROW( Invalid_Argument );
3628 face = charmap->face;
3631 if ( !
FT_ALLOC( cmap, clazz->size ) )
3634 cmap->
clazz = clazz;
3638 error = clazz->init( cmap, init_data );
3646 face->num_charmaps + 1 ) )
3679 if ( charcode > 0xFFFFFFFFUL )
3681 FT_TRACE1((
"FT_Get_Char_Index: too large charcode" ));
3682 FT_TRACE1((
" 0x%x is truncated\n", charcode ));
3732 FT_UInt32
code = (FT_UInt32)charcode;
3762 if ( num_properties > 0 && !properties )
3768 for ( ; num_properties > 0; num_properties-- )
3772 if ( properties->data )
3775 face->internal->no_stem_darkening =
FALSE;
3777 face->internal->no_stem_darkening =
TRUE;
3782 face->internal->no_stem_darkening = -1;
3787#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
3788 if ( properties->data )
3793 face->internal->lcd_filter_func = ft_lcd_filter_fir;
3802 if ( properties->data )
3804 face->internal->random_seed = *( (FT_Int32*)properties->data );
3805 if (
face->internal->random_seed < 0 )
3806 face->internal->random_seed = 0;
3811 face->internal->random_seed = -1;
3843 face->charmap->encoding == FT_ENCODING_UNICODE )
3854 if ( charcode > 0xFFFFFFFFUL )
3856 FT_TRACE1((
"FT_Face_GetCharVariantIndex:"
3857 " too large charcode" ));
3858 FT_TRACE1((
" 0x%x is truncated\n", charcode ));
3860 if ( variantSelector > 0xFFFFFFFFUL )
3862 FT_TRACE1((
"FT_Face_GetCharVariantIndex:"
3863 " too large variantSelector" ));
3864 FT_TRACE1((
" 0x%x is truncated\n", variantSelector ));
3868 (FT_UInt32)charcode,
3869 (FT_UInt32)variantSelector );
3897 if ( charcode > 0xFFFFFFFFUL )
3899 FT_TRACE1((
"FT_Face_GetCharVariantIsDefault:"
3900 " too large charcode" ));
3901 FT_TRACE1((
" 0x%x is truncated\n", charcode ));
3903 if ( variantSelector > 0xFFFFFFFFUL )
3905 FT_TRACE1((
"FT_Face_GetCharVariantIsDefault:"
3906 " too large variantSelector" ));
3907 FT_TRACE1((
" 0x%x is truncated\n", variantSelector ));
3911 (FT_UInt32)charcode,
3912 (FT_UInt32)variantSelector );
3967 if ( charcode > 0xFFFFFFFFUL )
3969 FT_TRACE1((
"FT_Face_GetVariantsOfChar: too large charcode" ));
3970 FT_TRACE1((
" 0x%x is truncated\n", charcode ));
3974 (FT_UInt32)charcode );
4001 if ( variantSelector > 0xFFFFFFFFUL )
4003 FT_TRACE1((
"FT_Get_Char_Index: too large variantSelector" ));
4004 FT_TRACE1((
" 0x%x is truncated\n", variantSelector ));
4008 (FT_UInt32)variantSelector );
4029 FT_Service_GlyphDict service;
4036 if ( service && service->name_index )
4037 result = service->name_index(
face, glyph_name );
4053 FT_Service_GlyphDict service;
4057 return FT_THROW( Invalid_Face_Handle );
4059 if ( !
buffer || buffer_max == 0 )
4060 return FT_THROW( Invalid_Argument );
4066 return FT_THROW( Invalid_Glyph_Index );
4069 return FT_THROW( Invalid_Argument );
4072 if ( service && service->get_name )
4094 FT_Service_PsFontName service;
4099 POSTSCRIPT_FONT_NAME );
4101 if ( service && service->get_ps_font_name )
4117 FT_Service_SFNT_Table service;
4140 FT_Service_SFNT_Table service;
4144 return FT_THROW( Invalid_Face_Handle );
4148 return FT_THROW( Unimplemented_Feature );
4162 FT_Service_SFNT_Table service;
4169 return FT_THROW( Invalid_Face_Handle );
4173 return FT_THROW( Unimplemented_Feature );
4184 FT_Service_TTCMaps service;
4189 if ( !charmap || !charmap->face )
4192 face = charmap->face;
4196 if ( service->get_cmap_info( charmap, &
cmap_info ))
4208 FT_Service_TTCMaps service;
4213 if ( !charmap || !charmap->face )
4216 face = charmap->face;
4220 if ( service->get_cmap_info( charmap, &
cmap_info ))
4236 return FT_THROW( Invalid_Size_Handle );
4240 return FT_THROW( Invalid_Face_Handle );
4280 cur = (*node)->next;
4402 render->clazz->raster_class->raster_done(
render->raster );
4451 if ( num_params > 0 && !parameters )
4471 for ( ; num_params > 0; num_params-- )
4473 error = set_mode( renderer, parameters->tag, parameters->data );
4494 switch (
slot->format )
4496 case FT_GLYPH_FORMAT_BITMAP:
4532#ifdef FT_DEBUG_LEVEL_TRACE
4535#define FT_COMPONENT trace_bitmap
4546 ft_trace_levels[trace_bitmap] >= 3 &&
4547 slot->bitmap.buffer )
4561 unsigned char md5[16];
4562 unsigned long coverage = 0;
4565 int pitch =
bitmap.pitch;
4568 FT_TRACE3((
"FT_Render_Glyph: bitmap %dx%d, mode %d\n",
4569 rows, pitch,
slot->bitmap.pixel_mode ));
4571 for (
i = 0;
i < rows;
i++ )
4572 for (
j = 0;
j < pitch;
j++ )
4573 coverage +=
bitmap.buffer[
i * pitch +
j];
4575 FT_TRACE3((
" Total coverage: %lu\n", coverage ));
4580 (
unsigned long)rows * (
unsigned long)pitch );
4584 for (
i = 0;
i < 16;
i++ )
4598 ft_trace_levels[trace_bitmap] >= 7 &&
4599 slot->bitmap.rows < 128U &&
4600 slot->bitmap.width < 128U &&
4601 slot->bitmap.buffer )
4603 int rows = (
int)
slot->bitmap.rows;
4605 int pitch =
slot->bitmap.pitch;
4607 unsigned char* topleft =
slot->bitmap.buffer;
4610 topleft -= pitch * ( rows - 1 );
4613 switch (
slot->bitmap.pixel_mode )
4617 for (
i = 0;
i < rows;
i++ )
4620 for (
m = 128;
m > 0 && j < width; m >>= 1,
j++ )
4621 FT_TRACE7((
" %d", ( topleft[
i * pitch +
j / 8] &
m ) != 0 ));
4628 for (
i = 0;
i < rows;
i++ )
4639#define FT_COMPONENT trace_objs
4657 return FT_THROW( Invalid_Argument );
4733#define FREETYPE_VER_FIXED ( ( (FT_Long)FREETYPE_MAJOR << 16 ) | \
4737 return FT_THROW( Invalid_Library_Handle );
4740 return FT_THROW( Invalid_Argument );
4744 return FT_THROW( Invalid_Version );
4750 if (
ft_strcmp(
module->clazz->module_name, clazz->module_name ) == 0 )
4753 if ( clazz->module_version <=
module->clazz->module_version )
4754 return FT_THROW( Lower_Module_Version );
4804 if ( clazz->module_init )
4823 if ( renderer->
clazz &&
4866 const char* mod_name )
4881 const char* service_id,
4892 if (
module->clazz->get_interface )
4909 if (
cur[0]->clazz->get_interface )
4911 result =
cur[0]->clazz->get_interface(
cur[0], service_id );
4933 return FT_THROW( Invalid_Library_Handle );