forked from minhngoc25a/freetype2
* src/cid/cidobjs.c: Apply change 2003-05-31 from <Ron.Dev@gmx.de>.
Compute style flags. Fix computation of root->height. * src/cid/cidtoken.h: Handle FontBBox. * src/cid/cidload.c (cid_load_keyword): Handle T1_FIELD_LOCATION_BBOX. (parse_font_bbox): Commented out. (cid_field_record): Comment out element for parsing FontBBox. * src/type42/t42parse.c (t42_parse_font_bbox): Commented out. (t42_keywords): Handle FontBBox with T1_FIELD_BBOX, not with T1_FIELD_CALLBACK. (t42_parse_font_bbox): Commented out. (t42_load_keyword): Handle T1_FIELD_LOCATION_BBOX. * src/type42/t42objs.c (T42_Face_Init): Apply change 2003-05-31 from <Ron.Dev@gmx.de>.
This commit is contained in:
parent
6e9b3186b0
commit
fdc042b8a9
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,22 @@
|
||||||
|
2003-06-11 Werner Lemberg <wl@gnu.org>
|
||||||
|
|
||||||
|
* src/cid/cidobjs.c: Apply change 2003-05-31 from <Ron.Dev@gmx.de>.
|
||||||
|
Compute style flags.
|
||||||
|
Fix computation of root->height.
|
||||||
|
* src/cid/cidtoken.h: Handle FontBBox.
|
||||||
|
* src/cid/cidload.c (cid_load_keyword): Handle
|
||||||
|
T1_FIELD_LOCATION_BBOX.
|
||||||
|
(parse_font_bbox): Commented out.
|
||||||
|
(cid_field_record): Comment out element for parsing FontBBox.
|
||||||
|
|
||||||
|
* src/type42/t42parse.c (t42_parse_font_bbox): Commented out.
|
||||||
|
(t42_keywords): Handle FontBBox with T1_FIELD_BBOX, not with
|
||||||
|
T1_FIELD_CALLBACK.
|
||||||
|
(t42_parse_font_bbox): Commented out.
|
||||||
|
(t42_load_keyword): Handle T1_FIELD_LOCATION_BBOX.
|
||||||
|
* src/type42/t42objs.c (T42_Face_Init): Apply change 2003-05-31
|
||||||
|
from <Ron.Dev@gmx.de>.
|
||||||
|
|
||||||
2003-06-09 George Williams <gww@silcom.com>
|
2003-06-09 George Williams <gww@silcom.com>
|
||||||
|
|
||||||
* src/truetype/ttinterp.c (SetSuperRound) <0x30>: Follow Apple's
|
* src/truetype/ttinterp.c (SetSuperRound) <0x30>: Follow Apple's
|
||||||
|
|
|
@ -115,6 +115,10 @@
|
||||||
object = (FT_Byte*)&cid->font_info;
|
object = (FT_Byte*)&cid->font_info;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case T1_FIELD_LOCATION_BBOX:
|
||||||
|
object = (FT_Byte*)&cid->font_bbox;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
CID_FaceDict dict;
|
CID_FaceDict dict;
|
||||||
|
@ -156,6 +160,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
FT_CALLBACK_DEF( FT_Error )
|
FT_CALLBACK_DEF( FT_Error )
|
||||||
parse_font_bbox( CID_Face face,
|
parse_font_bbox( CID_Face face,
|
||||||
CID_Parser* parser )
|
CID_Parser* parser )
|
||||||
|
@ -173,6 +178,7 @@
|
||||||
return CID_Err_Ok; /* this is a callback function; */
|
return CID_Err_Ok; /* this is a callback function; */
|
||||||
/* we must return an error code */
|
/* we must return an error code */
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
FT_CALLBACK_DEF( FT_Error )
|
FT_CALLBACK_DEF( FT_Error )
|
||||||
|
@ -273,9 +279,12 @@
|
||||||
|
|
||||||
#include "cidtoken.h"
|
#include "cidtoken.h"
|
||||||
|
|
||||||
|
#if 0
|
||||||
T1_FIELD_CALLBACK( "FontBBox", parse_font_bbox )
|
T1_FIELD_CALLBACK( "FontBBox", parse_font_bbox )
|
||||||
|
#endif
|
||||||
T1_FIELD_CALLBACK( "FDArray", parse_fd_array )
|
T1_FIELD_CALLBACK( "FDArray", parse_fd_array )
|
||||||
T1_FIELD_CALLBACK( "FontMatrix", parse_font_matrix )
|
T1_FIELD_CALLBACK( "FontMatrix", parse_font_matrix )
|
||||||
|
|
||||||
{ 0, T1_FIELD_LOCATION_CID_INFO, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0 }
|
{ 0, T1_FIELD_LOCATION_CID_INFO, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,10 @@
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
#include FT_INTERNAL_DEBUG_H
|
#include FT_INTERNAL_DEBUG_H
|
||||||
#include FT_INTERNAL_STREAM_H
|
#include FT_INTERNAL_STREAM_H
|
||||||
|
|
||||||
#include "cidgload.h"
|
#include "cidgload.h"
|
||||||
#include "cidload.h"
|
#include "cidload.h"
|
||||||
|
|
||||||
#include FT_INTERNAL_POSTSCRIPT_NAMES_H
|
#include FT_INTERNAL_POSTSCRIPT_NAMES_H
|
||||||
#include FT_INTERNAL_POSTSCRIPT_AUX_H
|
#include FT_INTERNAL_POSTSCRIPT_AUX_H
|
||||||
#include FT_INTERNAL_POSTSCRIPT_HINTS_H
|
#include FT_INTERNAL_POSTSCRIPT_HINTS_H
|
||||||
|
@ -331,10 +333,11 @@
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now, load the font program into the face object */
|
/* now load the font program into the face object */
|
||||||
{
|
|
||||||
/* Init the face object fields */
|
/* initialize the face object fields */
|
||||||
/* Now set up root face fields */
|
|
||||||
|
/* set up root face fields */
|
||||||
{
|
{
|
||||||
FT_Face root = (FT_Face)&face->root;
|
FT_Face root = (FT_Face)&face->root;
|
||||||
CID_FaceInfo cid = &face->cid;
|
CID_FaceInfo cid = &face->cid;
|
||||||
|
@ -357,30 +360,55 @@
|
||||||
/* get style name -- be careful, some broken fonts only */
|
/* get style name -- be careful, some broken fonts only */
|
||||||
/* have a /FontName dictionary entry! */
|
/* have a /FontName dictionary entry! */
|
||||||
root->family_name = info->family_name;
|
root->family_name = info->family_name;
|
||||||
|
/* assume "Regular" style if we don't know better */
|
||||||
|
root->style_name = (char *)"Regular";
|
||||||
if ( root->family_name )
|
if ( root->family_name )
|
||||||
{
|
{
|
||||||
char* full = info->full_name;
|
char* full = info->full_name;
|
||||||
char* family = root->family_name;
|
char* family = root->family_name;
|
||||||
|
|
||||||
while ( *family && *full == *family )
|
|
||||||
|
if ( full )
|
||||||
|
{
|
||||||
|
while ( *full )
|
||||||
|
{
|
||||||
|
if ( *full == *family )
|
||||||
{
|
{
|
||||||
family++;
|
family++;
|
||||||
full++;
|
full++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( *full == ' ' || *full == '-' )
|
|
||||||
root->style_name = full + 1;
|
|
||||||
else
|
else
|
||||||
root->style_name = (char *)"Regular";
|
{
|
||||||
|
if ( *full == ' ' || *full == '-' )
|
||||||
|
full++;
|
||||||
|
else if ( *family == ' ' || *family == '-' )
|
||||||
|
family++;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( !*family )
|
||||||
|
root->style_name = full;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* do we have a `/FontName'? */
|
/* do we have a `/FontName'? */
|
||||||
if ( cid->cid_font_name )
|
if ( cid->cid_font_name )
|
||||||
{
|
|
||||||
root->family_name = cid->cid_font_name;
|
root->family_name = cid->cid_font_name;
|
||||||
root->style_name = (char *)"Regular";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* compute style flags */
|
||||||
|
root->style_flags = 0;
|
||||||
|
if ( info->italic_angle && *info->italic_angle )
|
||||||
|
root->style_flags |= FT_STYLE_FLAG_ITALIC;
|
||||||
|
if ( info->weight )
|
||||||
|
{
|
||||||
|
if ( !ft_strcmp( info->weight, "Bold" ) ||
|
||||||
|
!ft_strcmp( info->weight, "Black" ) )
|
||||||
|
root->style_flags |= FT_STYLE_FLAG_BOLD;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* no embedded bitmap support */
|
/* no embedded bitmap support */
|
||||||
|
@ -398,7 +426,7 @@
|
||||||
root->ascender = (FT_Short)( root->bbox.yMax );
|
root->ascender = (FT_Short)( root->bbox.yMax );
|
||||||
root->descender = (FT_Short)( root->bbox.yMin );
|
root->descender = (FT_Short)( root->bbox.yMin );
|
||||||
root->height = (FT_Short)(
|
root->height = (FT_Short)(
|
||||||
( ( root->ascender + root->descender ) * 12 ) / 10 );
|
( ( root->ascender - root->descender ) * 12 ) / 10 );
|
||||||
|
|
||||||
if ( info->underline_position )
|
if ( info->underline_position )
|
||||||
root->underline_position = *info->underline_position >> 16;
|
root->underline_position = *info->underline_position >> 16;
|
||||||
|
@ -408,7 +436,6 @@
|
||||||
root->internal->max_points = 0;
|
root->internal->max_points = 0;
|
||||||
root->internal->max_contours = 0;
|
root->internal->max_contours = 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
return error;
|
return error;
|
||||||
|
|
|
@ -92,5 +92,12 @@
|
||||||
T1_FIELD_NUM_TABLE ( "StemSnapH", snap_widths, 12 )
|
T1_FIELD_NUM_TABLE ( "StemSnapH", snap_widths, 12 )
|
||||||
T1_FIELD_NUM_TABLE ( "StemSnapV", snap_heights, 12 )
|
T1_FIELD_NUM_TABLE ( "StemSnapV", snap_heights, 12 )
|
||||||
|
|
||||||
|
#undef FT_STRUCTURE
|
||||||
|
#define FT_STRUCTURE FT_BBox
|
||||||
|
#undef T1CODE
|
||||||
|
#define T1CODE T1_FIELD_LOCATION_BBOX
|
||||||
|
|
||||||
|
T1_FIELD_BBOX( "FontBBox", xMin )
|
||||||
|
|
||||||
|
|
||||||
/* END */
|
/* END */
|
||||||
|
|
|
@ -227,8 +227,6 @@
|
||||||
#endif /* T1_CONFIG_OPTION_NO_AFM */
|
#endif /* T1_CONFIG_OPTION_NO_AFM */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FT_CALLBACK_TABLE_DEF
|
FT_CALLBACK_TABLE_DEF
|
||||||
const FT_Driver_ClassRec t1_driver_class =
|
const FT_Driver_ClassRec t1_driver_class =
|
||||||
{
|
{
|
||||||
|
|
|
@ -695,7 +695,7 @@
|
||||||
static FT_Error
|
static FT_Error
|
||||||
t1_load_keyword( T1_Face face,
|
t1_load_keyword( T1_Face face,
|
||||||
T1_Loader loader,
|
T1_Loader loader,
|
||||||
T1_Field field )
|
const T1_Field field )
|
||||||
{
|
{
|
||||||
FT_Error error;
|
FT_Error error;
|
||||||
void* dummy_object;
|
void* dummy_object;
|
||||||
|
|
|
@ -308,7 +308,7 @@
|
||||||
face->pshinter = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),
|
face->pshinter = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),
|
||||||
"pshinter" );
|
"pshinter" );
|
||||||
|
|
||||||
/* open the tokenizer, this will also check the font format */
|
/* open the tokenizer; this will also check the font format */
|
||||||
error = T1_Open_Face( face );
|
error = T1_Open_Face( face );
|
||||||
if ( error )
|
if ( error )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
@ -325,10 +325,11 @@
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now, load the font program into the face object */
|
/* now load the font program into the face object */
|
||||||
|
|
||||||
/* Init the face object fields */
|
/* initialize the face object fields */
|
||||||
/* Now set up root face fields */
|
|
||||||
|
/* set up root face fields */
|
||||||
{
|
{
|
||||||
FT_Face root = (FT_Face)&face->root;
|
FT_Face root = (FT_Face)&face->root;
|
||||||
|
|
||||||
|
|
|
@ -211,6 +211,8 @@
|
||||||
/* get style name -- be careful, some broken fonts only */
|
/* get style name -- be careful, some broken fonts only */
|
||||||
/* have a `/FontName' dictionary entry! */
|
/* have a `/FontName' dictionary entry! */
|
||||||
root->family_name = info->family_name;
|
root->family_name = info->family_name;
|
||||||
|
/* assume "Regular" style if we don't know better */
|
||||||
|
root->style_name = (char *)"Regular";
|
||||||
if ( root->family_name )
|
if ( root->family_name )
|
||||||
{
|
{
|
||||||
char* full = info->full_name;
|
char* full = info->full_name;
|
||||||
|
@ -219,28 +221,34 @@
|
||||||
|
|
||||||
if ( full )
|
if ( full )
|
||||||
{
|
{
|
||||||
while ( *family && *full == *family )
|
while ( *full )
|
||||||
|
{
|
||||||
|
if ( *full == *family )
|
||||||
{
|
{
|
||||||
family++;
|
family++;
|
||||||
full++;
|
full++;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if ( *full == ' ' || *full == '-' )
|
if ( *full == ' ' || *full == '-' )
|
||||||
root->style_name = full + 1;
|
full++;
|
||||||
|
else if ( *family == ' ' || *family == '-' )
|
||||||
|
family++;
|
||||||
else
|
else
|
||||||
root->style_name = (char *)"Regular";
|
{
|
||||||
|
if ( !*family )
|
||||||
|
root->style_name = full;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
root->style_name = (char *)"Regular";
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* do we have a `/FontName'? */
|
/* do we have a `/FontName'? */
|
||||||
if ( type1->font_name )
|
if ( type1->font_name )
|
||||||
{
|
|
||||||
root->family_name = type1->font_name;
|
root->family_name = type1->font_name;
|
||||||
root->style_name = (char *)"Regular";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* no embedded bitmap support */
|
/* no embedded bitmap support */
|
||||||
|
|
|
@ -37,9 +37,11 @@
|
||||||
t42_parse_font_name( T42_Face face,
|
t42_parse_font_name( T42_Face face,
|
||||||
T42_Loader loader );
|
T42_Loader loader );
|
||||||
|
|
||||||
|
#if 0
|
||||||
static void
|
static void
|
||||||
t42_parse_font_bbox( T42_Face face,
|
t42_parse_font_bbox( T42_Face face,
|
||||||
T42_Loader loader );
|
T42_Loader loader );
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
t42_parse_font_matrix( T42_Face face,
|
t42_parse_font_matrix( T42_Face face,
|
||||||
|
@ -84,8 +86,17 @@
|
||||||
T1_FIELD_NUM ( "FontType", font_type )
|
T1_FIELD_NUM ( "FontType", font_type )
|
||||||
T1_FIELD_FIXED_P( "StrokeWidth", stroke_width )
|
T1_FIELD_FIXED_P( "StrokeWidth", stroke_width )
|
||||||
|
|
||||||
|
#undef FT_STRUCTURE
|
||||||
|
#define FT_STRUCTURE FT_BBox
|
||||||
|
#undef T1CODE
|
||||||
|
#define T1CODE T1_FIELD_LOCATION_BBOX
|
||||||
|
|
||||||
|
T1_FIELD_BBOX("FontBBox", xMin )
|
||||||
|
|
||||||
T1_FIELD_CALLBACK( "FontName", t42_parse_font_name )
|
T1_FIELD_CALLBACK( "FontName", t42_parse_font_name )
|
||||||
|
#if 0
|
||||||
T1_FIELD_CALLBACK( "FontBBox", t42_parse_font_bbox )
|
T1_FIELD_CALLBACK( "FontBBox", t42_parse_font_bbox )
|
||||||
|
#endif
|
||||||
T1_FIELD_CALLBACK( "FontMatrix", t42_parse_font_matrix )
|
T1_FIELD_CALLBACK( "FontMatrix", t42_parse_font_matrix )
|
||||||
T1_FIELD_CALLBACK( "Encoding", t42_parse_encoding )
|
T1_FIELD_CALLBACK( "Encoding", t42_parse_encoding )
|
||||||
T1_FIELD_CALLBACK( "CharStrings", t42_parse_charstrings )
|
T1_FIELD_CALLBACK( "CharStrings", t42_parse_charstrings )
|
||||||
|
@ -290,6 +301,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
static void
|
static void
|
||||||
t42_parse_font_bbox( T42_Face face,
|
t42_parse_font_bbox( T42_Face face,
|
||||||
T42_Loader loader )
|
T42_Loader loader )
|
||||||
|
@ -297,11 +309,13 @@
|
||||||
T42_Parser parser = &loader->parser;
|
T42_Parser parser = &loader->parser;
|
||||||
FT_BBox* bbox = &face->type1.font_bbox;
|
FT_BBox* bbox = &face->type1.font_bbox;
|
||||||
|
|
||||||
|
|
||||||
bbox->xMin = T1_ToInt( parser );
|
bbox->xMin = T1_ToInt( parser );
|
||||||
bbox->yMin = T1_ToInt( parser );
|
bbox->yMin = T1_ToInt( parser );
|
||||||
bbox->xMax = T1_ToInt( parser );
|
bbox->xMax = T1_ToInt( parser );
|
||||||
bbox->yMax = T1_ToInt( parser );
|
bbox->yMax = T1_ToInt( parser );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -837,14 +851,18 @@
|
||||||
{
|
{
|
||||||
case T1_FIELD_LOCATION_FONT_INFO:
|
case T1_FIELD_LOCATION_FONT_INFO:
|
||||||
dummy_object = &face->type1.font_info;
|
dummy_object = &face->type1.font_info;
|
||||||
objects = &dummy_object;
|
break;
|
||||||
|
|
||||||
|
case T1_FIELD_LOCATION_BBOX:
|
||||||
|
dummy_object = &face->type1.font_bbox;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
dummy_object = &face->type1;
|
dummy_object = &face->type1;
|
||||||
objects = &dummy_object;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
objects = &dummy_object;
|
||||||
|
|
||||||
if ( field->type == T1_FIELD_TYPE_INTEGER_ARRAY ||
|
if ( field->type == T1_FIELD_TYPE_INTEGER_ARRAY ||
|
||||||
field->type == T1_FIELD_TYPE_FIXED_ARRAY )
|
field->type == T1_FIELD_TYPE_FIXED_ARRAY )
|
||||||
error = T1_Load_Field_Table( &loader->parser, field,
|
error = T1_Load_Field_Table( &loader->parser, field,
|
||||||
|
|
Loading…
Reference in New Issue