* 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:
Werner Lemberg 2003-06-12 04:59:07 +00:00
parent 6e9b3186b0
commit fdc042b8a9
9 changed files with 184 additions and 97 deletions

View File

@ -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>
* src/truetype/ttinterp.c (SetSuperRound) <0x30>: Follow Apple's

View File

@ -115,6 +115,10 @@
object = (FT_Byte*)&cid->font_info;
break;
case T1_FIELD_LOCATION_BBOX:
object = (FT_Byte*)&cid->font_bbox;
break;
default:
{
CID_FaceDict dict;
@ -156,6 +160,7 @@
}
#if 0
FT_CALLBACK_DEF( FT_Error )
parse_font_bbox( CID_Face face,
CID_Parser* parser )
@ -171,8 +176,9 @@
bbox->yMax = FT_RoundFix( temp[3] );
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 )
@ -273,9 +279,12 @@
#include "cidtoken.h"
#if 0
T1_FIELD_CALLBACK( "FontBBox", parse_font_bbox )
#endif
T1_FIELD_CALLBACK( "FDArray", parse_fd_array )
T1_FIELD_CALLBACK( "FontMatrix", parse_font_matrix )
{ 0, T1_FIELD_LOCATION_CID_INFO, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0 }
};

View File

@ -19,8 +19,10 @@
#include <ft2build.h>
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_STREAM_H
#include "cidgload.h"
#include "cidload.h"
#include FT_INTERNAL_POSTSCRIPT_NAMES_H
#include FT_INTERNAL_POSTSCRIPT_AUX_H
#include FT_INTERNAL_POSTSCRIPT_HINTS_H
@ -331,83 +333,108 @@
goto Exit;
}
/* Now, load the font program into the face object */
/* now load the font program into the face object */
/* initialize the face object fields */
/* set up root face fields */
{
/* Init the face object fields */
/* Now set up root face fields */
FT_Face root = (FT_Face)&face->root;
CID_FaceInfo cid = &face->cid;
PS_FontInfo info = &cid->font_info;
root->num_glyphs = cid->cid_count;
root->num_charmaps = 0;
root->face_index = face_index;
root->face_flags = FT_FACE_FLAG_SCALABLE;
root->face_flags |= FT_FACE_FLAG_HORIZONTAL;
if ( info->is_fixed_pitch && *info->is_fixed_pitch )
root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
/* XXX: TODO: add kerning with .afm support */
/* get style name -- be careful, some broken fonts only */
/* have a /FontName dictionary entry! */
root->family_name = info->family_name;
/* assume "Regular" style if we don't know better */
root->style_name = (char *)"Regular";
if ( root->family_name )
{
FT_Face root = (FT_Face)&face->root;
CID_FaceInfo cid = &face->cid;
PS_FontInfo info = &cid->font_info;
char* full = info->full_name;
char* family = root->family_name;
root->num_glyphs = cid->cid_count;
root->num_charmaps = 0;
root->face_index = face_index;
root->face_flags = FT_FACE_FLAG_SCALABLE;
root->face_flags |= FT_FACE_FLAG_HORIZONTAL;
if ( info->is_fixed_pitch && *info->is_fixed_pitch )
root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
/* XXX: TODO: add kerning with .afm support */
/* get style name -- be careful, some broken fonts only */
/* have a /FontName dictionary entry! */
root->family_name = info->family_name;
if ( root->family_name )
if ( full )
{
char* full = info->full_name;
char* family = root->family_name;
while ( *family && *full == *family )
while ( *full )
{
family++;
full++;
}
if ( *full == ' ' || *full == '-' )
root->style_name = full + 1;
else
root->style_name = (char *)"Regular";
}
else
{
/* do we have a `/FontName'? */
if ( cid->cid_font_name )
{
root->family_name = cid->cid_font_name;
root->style_name = (char *)"Regular";
if ( *full == *family )
{
family++;
full++;
}
else
{
if ( *full == ' ' || *full == '-' )
full++;
else if ( *family == ' ' || *family == '-' )
family++;
else
{
if ( !*family )
root->style_name = full;
break;
}
}
}
}
/* no embedded bitmap support */
root->num_fixed_sizes = 0;
root->available_sizes = 0;
root->bbox.xMin = cid->font_bbox.xMin >> 16;
root->bbox.yMin = cid->font_bbox.yMin >> 16;
root->bbox.xMax = ( cid->font_bbox.xMax + 0xFFFFU ) >> 16;
root->bbox.yMax = ( cid->font_bbox.yMax + 0xFFFFU ) >> 16;
if ( !root->units_per_EM )
root->units_per_EM = 1000;
root->ascender = (FT_Short)( root->bbox.yMax );
root->descender = (FT_Short)( root->bbox.yMin );
root->height = (FT_Short)(
( ( root->ascender + root->descender ) * 12 ) / 10 );
if ( info->underline_position )
root->underline_position = *info->underline_position >> 16;
if ( info->underline_thickness )
root->underline_thickness = *info->underline_thickness >> 16;
root->internal->max_points = 0;
root->internal->max_contours = 0;
}
else
{
/* do we have a `/FontName'? */
if ( cid->cid_font_name )
root->family_name = cid->cid_font_name;
}
/* 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 */
root->num_fixed_sizes = 0;
root->available_sizes = 0;
root->bbox.xMin = cid->font_bbox.xMin >> 16;
root->bbox.yMin = cid->font_bbox.yMin >> 16;
root->bbox.xMax = ( cid->font_bbox.xMax + 0xFFFFU ) >> 16;
root->bbox.yMax = ( cid->font_bbox.yMax + 0xFFFFU ) >> 16;
if ( !root->units_per_EM )
root->units_per_EM = 1000;
root->ascender = (FT_Short)( root->bbox.yMax );
root->descender = (FT_Short)( root->bbox.yMin );
root->height = (FT_Short)(
( ( root->ascender - root->descender ) * 12 ) / 10 );
if ( info->underline_position )
root->underline_position = *info->underline_position >> 16;
if ( info->underline_thickness )
root->underline_thickness = *info->underline_thickness >> 16;
root->internal->max_points = 0;
root->internal->max_contours = 0;
}
Exit:

View File

@ -92,5 +92,12 @@
T1_FIELD_NUM_TABLE ( "StemSnapH", snap_widths, 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 */

View File

@ -227,8 +227,6 @@
#endif /* T1_CONFIG_OPTION_NO_AFM */
FT_CALLBACK_TABLE_DEF
const FT_Driver_ClassRec t1_driver_class =
{

View File

@ -693,9 +693,9 @@
static FT_Error
t1_load_keyword( T1_Face face,
T1_Loader loader,
T1_Field field )
t1_load_keyword( T1_Face face,
T1_Loader loader,
const T1_Field field )
{
FT_Error error;
void* dummy_object;

View File

@ -308,7 +308,7 @@
face->pshinter = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),
"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 );
if ( error )
goto Exit;
@ -325,10 +325,11 @@
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 */
/* Now set up root face fields */
/* initialize the face object fields */
/* set up root face fields */
{
FT_Face root = (FT_Face)&face->root;
@ -336,7 +337,7 @@
root->num_glyphs = type1->num_glyphs;
root->face_index = face_index;
root->face_flags = FT_FACE_FLAG_SCALABLE;
root->face_flags = FT_FACE_FLAG_SCALABLE;
root->face_flags |= FT_FACE_FLAG_HORIZONTAL;
root->face_flags |= FT_FACE_FLAG_GLYPH_NAMES;
@ -418,7 +419,7 @@
root->ascender = (FT_Short)( root->bbox.yMax );
root->descender = (FT_Short)( root->bbox.yMin );
root->height = (FT_Short)(
( ( root->ascender - root->descender ) * 12 ) / 10 );
( ( root->ascender - root->descender ) * 12 ) / 10 );
/* now compute the maximum advance width */
root->max_advance_width =

View File

@ -211,6 +211,8 @@
/* get style name -- be careful, some broken fonts only */
/* have a `/FontName' dictionary entry! */
root->family_name = info->family_name;
/* assume "Regular" style if we don't know better */
root->style_name = (char *)"Regular";
if ( root->family_name )
{
char* full = info->full_name;
@ -219,28 +221,34 @@
if ( full )
{
while ( *family && *full == *family )
while ( *full )
{
family++;
full++;
if ( *full == *family )
{
family++;
full++;
}
else
{
if ( *full == ' ' || *full == '-' )
full++;
else if ( *family == ' ' || *family == '-' )
family++;
else
{
if ( !*family )
root->style_name = full;
break;
}
}
}
if ( *full == ' ' || *full == '-' )
root->style_name = full + 1;
else
root->style_name = (char *)"Regular";
}
else
root->style_name = (char *)"Regular";
}
else
{
/* do we have a `/FontName'? */
if ( type1->font_name )
{
root->family_name = type1->font_name;
root->style_name = (char *)"Regular";
}
}
/* no embedded bitmap support */

View File

@ -36,10 +36,12 @@
static void
t42_parse_font_name( T42_Face face,
T42_Loader loader );
#if 0
static void
t42_parse_font_bbox( T42_Face face,
T42_Loader loader );
#endif
static void
t42_parse_font_matrix( T42_Face face,
@ -84,8 +86,17 @@
T1_FIELD_NUM ( "FontType", font_type )
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 )
#if 0
T1_FIELD_CALLBACK( "FontBBox", t42_parse_font_bbox )
#endif
T1_FIELD_CALLBACK( "FontMatrix", t42_parse_font_matrix )
T1_FIELD_CALLBACK( "Encoding", t42_parse_encoding )
T1_FIELD_CALLBACK( "CharStrings", t42_parse_charstrings )
@ -290,18 +301,21 @@
}
#if 0
static void
t42_parse_font_bbox( T42_Face face,
t42_parse_font_bbox( T42_Face face,
T42_Loader loader )
{
T42_Parser parser = &loader->parser;
FT_BBox* bbox = &face->type1.font_bbox;
bbox->xMin = T1_ToInt( parser );
bbox->yMin = T1_ToInt( parser );
bbox->xMax = T1_ToInt( parser );
bbox->yMax = T1_ToInt( parser );
}
#endif
static void
@ -837,14 +851,18 @@
{
case T1_FIELD_LOCATION_FONT_INFO:
dummy_object = &face->type1.font_info;
objects = &dummy_object;
break;
case T1_FIELD_LOCATION_BBOX:
dummy_object = &face->type1.font_bbox;
break;
default:
dummy_object = &face->type1;
objects = &dummy_object;
}
objects = &dummy_object;
if ( field->type == T1_FIELD_TYPE_INTEGER_ARRAY ||
field->type == T1_FIELD_TYPE_FIXED_ARRAY )
error = T1_Load_Field_Table( &loader->parser, field,