955 |
FT_Pos x, y; |
FT_Pos x, y; |
956 |
|
|
957 |
|
|
958 |
have_scale = ( subglyph->flags & ( WE_HAVE_A_SCALE | |
have_scale = subglyph->flags & ( WE_HAVE_A_SCALE | |
959 |
WE_HAVE_AN_XY_SCALE | |
WE_HAVE_AN_XY_SCALE | |
960 |
WE_HAVE_A_2X2 ) ); |
WE_HAVE_A_2X2 ); |
961 |
|
|
962 |
/* perform the transform required for this subglyph */ |
/* perform the transform required for this subglyph */ |
963 |
if ( have_scale ) |
if ( have_scale ) |
964 |
{ |
{ |
965 |
FT_UInt i; |
FT_UInt i; |
966 |
|
|
967 |
|
|
968 |
for ( i = num_base_points; i < num_points; i++ ) |
for ( i = num_base_points; i < num_points; i++ ) |
978 |
FT_Vector* p2; |
FT_Vector* p2; |
979 |
|
|
980 |
|
|
981 |
/* match l-th point of the newly loaded component to the k-th point of */ |
/* match l-th point of the newly loaded component to the k-th point */ |
982 |
/* the previously loaded components. */ |
/* of the previously loaded components. */ |
983 |
|
|
984 |
/* change to the point numbers used by our outline */ |
/* change to the point numbers used by our outline */ |
985 |
k += start_point; |
k += start_point; |
986 |
l += num_base_points; |
l += num_base_points; |
987 |
if ( k >= (FT_UInt)num_base_points || |
if ( k >= num_base_points || |
988 |
l >= (FT_UInt)num_points ) |
l >= num_points ) |
|
{ |
|
989 |
return TT_Err_Invalid_Composite; |
return TT_Err_Invalid_Composite; |
|
} |
|
990 |
|
|
991 |
p1 = gloader->base.outline.points + k; |
p1 = gloader->base.outline.points + k; |
992 |
p2 = gloader->base.outline.points + l; |
p2 = gloader->base.outline.points + l; |
1002 |
if ( !x && !y ) |
if ( !x && !y ) |
1003 |
return TT_Err_Ok; |
return TT_Err_Ok; |
1004 |
|
|
1005 |
/* Use a default value dependent on */ |
/* Use a default value dependent on */ |
1006 |
/* TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED. This is useful for old TT */ |
/* TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED. This is useful for old TT */ |
1007 |
/* fonts which don't set the xxx_COMPONENT_OFFSET bit. */ |
/* fonts which don't set the xxx_COMPONENT_OFFSET bit. */ |
1008 |
|
|
1009 |
if ( have_scale && |
if ( have_scale && |
1010 |
#ifdef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED |
#ifdef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED |
1015 |
{ |
{ |
1016 |
#if 0 |
#if 0 |
1017 |
|
|
1018 |
/*************************************************************************/ |
/*************************************************************************/ |
1019 |
/* */ |
/* */ |
1020 |
/* This algorithm is what Apple documents. But it doesn't work. */ |
/* This algorithm is what Apple documents. But it doesn't work. */ |
1021 |
/* */ |
/* */ |
1022 |
int a = subglyph->transform.xx > 0 ? subglyph->transform.xx |
int a = subglyph->transform.xx > 0 ? subglyph->transform.xx |
1023 |
: -subglyph->transform.xx; |
: -subglyph->transform.xx; |
1024 |
int b = subglyph->transform.yx > 0 ? subglyph->transform.yx |
int b = subglyph->transform.yx > 0 ? subglyph->transform.yx |
1040 |
|
|
1041 |
#else /* 0 */ |
#else /* 0 */ |
1042 |
|
|
1043 |
/*************************************************************************/ |
/*************************************************************************/ |
1044 |
/* */ |
/* */ |
1045 |
/* This algorithm is a guess and works much better than the above. */ |
/* This algorithm is a guess and works much better than the above. */ |
1046 |
/* */ |
/* */ |
1047 |
FT_Fixed mac_xscale = FT_SqrtFixed( |
FT_Fixed mac_xscale = FT_SqrtFixed( |
1048 |
FT_MulFix( subglyph->transform.xx, |
FT_MulFix( subglyph->transform.xx, |
1049 |
subglyph->transform.xx ) + |
subglyph->transform.xx ) + |
1065 |
|
|
1066 |
if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) ) |
if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) ) |
1067 |
{ |
{ |
1068 |
FT_Fixed x_scale = ((TT_Size)loader->size)->metrics.x_scale; |
FT_Fixed x_scale = ((TT_Size)loader->size)->metrics.x_scale; |
1069 |
FT_Fixed y_scale = ((TT_Size)loader->size)->metrics.y_scale; |
FT_Fixed y_scale = ((TT_Size)loader->size)->metrics.y_scale; |
1070 |
|
|
1071 |
|
|
1072 |
x = FT_MulFix( x, x_scale ); |
x = FT_MulFix( x, x_scale ); |
1111 |
outline = &loader->gloader->base.outline; |
outline = &loader->gloader->base.outline; |
1112 |
|
|
1113 |
/* make room for phantom points */ |
/* make room for phantom points */ |
1114 |
error = FT_GlyphLoader_CheckPoints( loader->gloader, outline->n_points + 4, 0 ); |
error = FT_GlyphLoader_CheckPoints( loader->gloader, |
1115 |
|
outline->n_points + 4, |
1116 |
|
0 ); |
1117 |
if ( error ) |
if ( error ) |
1118 |
return error; |
return error; |
1119 |
|
|
1137 |
/* TT_Load_Composite_Glyph only gives us the offset of instructions */ |
/* TT_Load_Composite_Glyph only gives us the offset of instructions */ |
1138 |
/* so we read them here */ |
/* so we read them here */ |
1139 |
if ( FT_STREAM_SEEK( loader->ins_pos ) || |
if ( FT_STREAM_SEEK( loader->ins_pos ) || |
1140 |
FT_READ_USHORT( n_ins ) ) |
FT_READ_USHORT( n_ins ) ) |
1141 |
return error; |
return error; |
1142 |
|
|
1143 |
FT_TRACE5(( " Instructions size = %d\n", n_ins )); |
FT_TRACE5(( " Instructions size = %d\n", n_ins )); |
1161 |
|
|
1162 |
#endif |
#endif |
1163 |
|
|
1164 |
tt_prepare_zone( &loader->zone, &loader->gloader->base, start_point, start_contour ); |
tt_prepare_zone( &loader->zone, &loader->gloader->base, |
1165 |
|
start_point, start_contour ); |
1166 |
loader->zone.n_points += 4; |
loader->zone.n_points += 4; |
1167 |
|
|
1168 |
return TT_Hint_Glyph( loader, 1 ); |
return TT_Hint_Glyph( loader, 1 ); |
1284 |
goto Exit; |
goto Exit; |
1285 |
left_bearing = (FT_Short)metrics.bearing_x; |
left_bearing = (FT_Short)metrics.bearing_x; |
1286 |
advance_width = (FT_UShort)metrics.advance; |
advance_width = (FT_UShort)metrics.advance; |
1287 |
|
|
1288 |
# if 0 |
# if 0 |
1289 |
|
|
1290 |
/* GWW: Do I do the same for vertical metrics ??? */ |
/* GWW: Do I do the same for vertical metrics ??? */ |
1291 |
metrics.bearing_x = 0; |
metrics.bearing_x = 0; |
1292 |
metrics.bearing_y = top_bearing; |
metrics.bearing_y = top_bearing; |
1293 |
metrics.advance = advance_height; |
metrics.advance = advance_height; |
1318 |
} |
} |
1319 |
|
|
1320 |
/* Set `offset' to the start of the glyph relative to the start of */ |
/* Set `offset' to the start of the glyph relative to the start of */ |
1321 |
/* the 'glyf' table, and `byte_len' to the length of the glyph in */ |
/* the `glyf' table, and `byte_len' to the length of the glyph in */ |
1322 |
/* bytes. */ |
/* bytes. */ |
1323 |
|
|
1324 |
#ifdef FT_CONFIG_OPTION_INCREMENTAL |
#ifdef FT_CONFIG_OPTION_INCREMENTAL |
1348 |
|
|
1349 |
#endif /* FT_CONFIG_OPTION_INCREMENTAL */ |
#endif /* FT_CONFIG_OPTION_INCREMENTAL */ |
1350 |
|
|
1351 |
offset = tt_face_get_location( face, glyph_index, (FT_UInt*)&loader->byte_len ); |
offset = tt_face_get_location( face, glyph_index, |
1352 |
|
(FT_UInt*)&loader->byte_len ); |
1353 |
|
|
1354 |
if ( loader->byte_len == 0 ) |
if ( loader->byte_len == 0 ) |
1355 |
{ |
{ |
1528 |
/*********************************************************************/ |
/*********************************************************************/ |
1529 |
|
|
1530 |
{ |
{ |
1531 |
FT_Int n, num_base_points; |
FT_UInt n, num_base_points; |
1532 |
FT_SubGlyph subglyph = 0; |
FT_SubGlyph subglyph = 0; |
1533 |
|
|
1534 |
FT_UInt num_points = start_point; |
FT_UInt num_points = start_point; |
1539 |
FT_GlyphLoader_Add( gloader ); |
FT_GlyphLoader_Add( gloader ); |
1540 |
|
|
1541 |
/* read each subglyph independently */ |
/* read each subglyph independently */ |
1542 |
for ( n = 0; n < (FT_Int)num_subglyphs; n++ ) |
for ( n = 0; n < num_subglyphs; n++ ) |
1543 |
{ |
{ |
1544 |
FT_Vector pp[4]; |
FT_Vector pp[4]; |
1545 |
|
|
1818 |
|
|
1819 |
|
|
1820 |
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS |
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS |
1821 |
|
|
1822 |
static FT_Error |
static FT_Error |
1823 |
load_sbit_image( TT_Size size, |
load_sbit_image( TT_Size size, |
1824 |
TT_GlyphSlot glyph, |
TT_GlyphSlot glyph, |
1831 |
FT_Error error; |
FT_Error error; |
1832 |
TT_SBit_MetricsRec metrics; |
TT_SBit_MetricsRec metrics; |
1833 |
|
|
1834 |
|
|
1835 |
face = (TT_Face)glyph->face; |
face = (TT_Face)glyph->face; |
1836 |
sfnt = (SFNT_Service)face->sfnt; |
sfnt = (SFNT_Service)face->sfnt; |
1837 |
stream = face->root.stream; |
stream = face->root.stream; |
1874 |
|
|
1875 |
return error; |
return error; |
1876 |
} |
} |
1877 |
#endif |
|
1878 |
|
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ |
1879 |
|
|
1880 |
|
|
1881 |
static FT_Error |
static FT_Error |
1884 |
TT_GlyphSlot glyph, |
TT_GlyphSlot glyph, |
1885 |
FT_Int32 load_flags ) |
FT_Int32 load_flags ) |
1886 |
{ |
{ |
1887 |
TT_Face face; |
TT_Face face; |
1888 |
FT_Stream stream; |
FT_Stream stream; |
1889 |
|
|
1890 |
|
|
1891 |
face = (TT_Face)glyph->face; |
face = (TT_Face)glyph->face; |
1892 |
stream = face->root.stream; |
stream = face->root.stream; |
1893 |
|
|
1894 |
FT_MEM_ZERO( loader, sizeof ( TT_LoaderRec ) ); |
FT_MEM_ZERO( loader, sizeof ( TT_LoaderRec ) ); |
1940 |
|
|
1941 |
{ |
{ |
1942 |
FT_Error error = face->goto_table( face, TTAG_glyf, stream, 0 ); |
FT_Error error = face->goto_table( face, TTAG_glyf, stream, 0 ); |
1943 |
|
|
1944 |
|
|
1945 |
if ( error ) |
if ( error ) |
1946 |
{ |
{ |
1947 |
FT_ERROR(( "TT_Load_Glyph: could not access glyph table\n" )); |
FT_ERROR(( "TT_Load_Glyph: could not access glyph table\n" )); |
1954 |
{ |
{ |
1955 |
FT_GlyphLoader gloader = glyph->internal->loader; |
FT_GlyphLoader gloader = glyph->internal->loader; |
1956 |
|
|
1957 |
|
|
1958 |
FT_GlyphLoader_Rewind( gloader ); |
FT_GlyphLoader_Rewind( gloader ); |
1959 |
loader->gloader = gloader; |
loader->gloader = gloader; |
1960 |
} |
} |
2019 |
/* */ |
/* */ |
2020 |
/* XXX: The convention should be emphasized in */ |
/* XXX: The convention should be emphasized in */ |
2021 |
/* the documents because it can be confusing. */ |
/* the documents because it can be confusing. */ |
2022 |
if ( size->strike_index != 0xFFFFU && |
if ( size->strike_index != 0xFFFFU && |
2023 |
( load_flags & FT_LOAD_NO_BITMAP ) == 0 ) |
( load_flags & FT_LOAD_NO_BITMAP ) == 0 ) |
2024 |
{ |
{ |
2025 |
error = load_sbit_image( size, glyph, glyph_index, load_flags ); |
error = load_sbit_image( size, glyph, glyph_index, load_flags ); |
2051 |
} |
} |
2052 |
else |
else |
2053 |
{ |
{ |
2054 |
glyph->outline = loader.gloader->base.outline; |
glyph->outline = loader.gloader->base.outline; |
2055 |
glyph->outline.flags &= ~FT_OUTLINE_SINGLE_PASS; |
glyph->outline.flags &= ~FT_OUTLINE_SINGLE_PASS; |
2056 |
|
|
2057 |
/* translate array so that (0,0) is the glyph's origin */ |
/* translate array so that (0,0) is the glyph's origin */ |