From bf7c8321f253d7e040fb4e2dca56a163fd6ad63c Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 6 Jun 2003 05:07:53 +0000 Subject: [PATCH] * include/freetype/internal/psaux.h (T1_FieldType): Add T1_FIELD_TYPE_FIXED_1000 and T1_FIELD_TYPE_FIXED_1000_P. (T1_FIELD_FIXED_1000, T1_FIELD_FIXED_1000_P): New macros. * src/psaux/psobjs.c (ps_parser_load_field): Handle T1_FIELD_TYPE_FIXED_1000 and T1_FIELD_TYPE_FIXED_1000_P. * src/cff/cffparse.c (cff_kind_fixed_thousand): New enumeration. (CFF_FIELD_FIXED_1000): New macro. (cff_parser_run): Handle cff_kind_fixed_thousand. * src/cff/cfftoken.h: Use CFF_FIELD_FIXED_1000 for blue_scale. * src/cff/cffload (cff_subfont_load): Fix default values of expansion_factor and blue_scale. * src/cif/cidtoken.h, src/type1/t1tokens.h: Use T1_FIELD_FIXED_1000 for blue_scale. * src/pshinter/pshglob.c (psh_globals_new): Fix default value of blue_scale. --- ChangeLog | 21 ++++++++++++++++ include/freetype/internal/psaux.h | 8 +++++++ src/cff/cffload.c | 4 ++-- src/cff/cffparse.c | 9 ++++++- src/cff/cfftoken.h | 40 +++++++++++++++---------------- src/cid/cidload.c | 5 ++-- src/cid/cidtoken.h | 2 +- src/psaux/psobjs.c | 10 +++++++- src/pshinter/pshglob.c | 2 +- src/type1/t1tokens.h | 2 +- 10 files changed, 74 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8fad44ea9..2e6b1db88 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2003-06-05 Werner Lemberg + + * include/freetype/internal/psaux.h (T1_FieldType): Add + T1_FIELD_TYPE_FIXED_1000 and T1_FIELD_TYPE_FIXED_1000_P. + (T1_FIELD_FIXED_1000, T1_FIELD_FIXED_1000_P): New macros. + * src/psaux/psobjs.c (ps_parser_load_field): Handle + T1_FIELD_TYPE_FIXED_1000 and T1_FIELD_TYPE_FIXED_1000_P. + + * src/cff/cffparse.c (cff_kind_fixed_thousand): New enumeration. + (CFF_FIELD_FIXED_1000): New macro. + (cff_parser_run): Handle cff_kind_fixed_thousand. + * src/cff/cfftoken.h: Use CFF_FIELD_FIXED_1000 for blue_scale. + * src/cff/cffload (cff_subfont_load): Fix default values of + expansion_factor and blue_scale. + + * src/cif/cidtoken.h, src/type1/t1tokens.h: Use T1_FIELD_FIXED_1000 + for blue_scale. + + * src/pshinter/pshglob.c (psh_globals_new): Fix default value of + blue_scale. + 2003-06-04 Wolfgang Domröse * include/freetype/internal/ftdriver.h, diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index 680b4385c..77cbab6ef 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -180,6 +180,8 @@ FT_BEGIN_HEADER T1_FIELD_TYPE_INTEGER_P, T1_FIELD_TYPE_FIXED, T1_FIELD_TYPE_FIXED_P, + T1_FIELD_TYPE_FIXED_1000, + T1_FIELD_TYPE_FIXED_1000_P, T1_FIELD_TYPE_STRING, T1_FIELD_TYPE_BBOX, T1_FIELD_TYPE_INTEGER_ARRAY, @@ -282,6 +284,12 @@ FT_BEGIN_HEADER #define T1_FIELD_FIXED_P( _ident, _fname ) \ T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_P, _fname ) +#define T1_FIELD_FIXED_1000( _ident, _fname ) \ + T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_1000, _fname ) + +#define T1_FIELD_FIXED_1000_P( _ident, _fname ) \ + T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_1000_P, _fname ) + #define T1_FIELD_STRING( _ident, _fname ) \ T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_STRING, _fname ) diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 1882a8ab3..4fa3d04d2 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1990,8 +1990,8 @@ priv->blue_shift = 7; priv->blue_fuzz = 1; priv->lenIV = -1; - priv->expansion_factor = (FT_Fixed)0.06 * 0x10000L; - priv->blue_scale = (FT_Fixed)0.039625 * 0x10000L; + priv->expansion_factor = (FT_Fixed)( 0.06 * 0x10000L ); + priv->blue_scale = (FT_Fixed)( 0.039625 * 0x10000L * 1000 ); cff_parser_init( &parser, CFF_CODE_PRIVATE, priv ); diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index 3e1f8408e..a44e43e20 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -4,7 +4,7 @@ /* */ /* CFF token stream parser (body) */ /* */ -/* Copyright 1996-2001, 2002 by */ +/* Copyright 1996-2001, 2002, 2003 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -38,6 +38,7 @@ cff_kind_none = 0, cff_kind_num, cff_kind_fixed, + cff_kind_fixed_thousand, cff_kind_string, cff_kind_bool, cff_kind_delta, @@ -429,6 +430,8 @@ CFF_FIELD( code, name, cff_kind_num ) #define CFF_FIELD_FIXED( code, name ) \ CFF_FIELD( code, name, cff_kind_fixed ) +#define CFF_FIELD_FIXED_1000( code, name ) \ + CFF_FIELD( code, name, cff_kind_fixed_thousand ) #define CFF_FIELD_STRING( code, name ) \ CFF_FIELD( code, name, cff_kind_string ) #define CFF_FIELD_BOOL( code, name ) \ @@ -579,6 +582,10 @@ case cff_kind_fixed: val = cff_parse_fixed( parser->stack ); + goto Store_Number; + + case cff_kind_fixed_thousand: + val = cff_parse_fixed_thousand( parser->stack ); Store_Number: switch ( field->size ) diff --git a/src/cff/cfftoken.h b/src/cff/cfftoken.h index 212db74d5..65a84683e 100644 --- a/src/cff/cfftoken.h +++ b/src/cff/cfftoken.h @@ -72,26 +72,26 @@ #undef CFFCODE #define CFFCODE CFFCODE_PRIVATE - CFF_FIELD_DELTA( 6, blue_values, 14 ) - CFF_FIELD_DELTA( 7, other_blues, 10 ) - CFF_FIELD_DELTA( 8, family_blues, 14 ) - CFF_FIELD_DELTA( 9, family_other_blues, 10 ) - CFF_FIELD_FIXED( 0x109, blue_scale ) - CFF_FIELD_NUM ( 0x10A, blue_shift ) - CFF_FIELD_NUM ( 0x10B, blue_fuzz ) - CFF_FIELD_NUM ( 10, standard_width ) - CFF_FIELD_NUM ( 11, standard_height ) - CFF_FIELD_DELTA( 0x10C, snap_widths, 13 ) - CFF_FIELD_DELTA( 0x10D, snap_heights, 13 ) - CFF_FIELD_BOOL ( 0x10E, force_bold ) - CFF_FIELD_FIXED( 0x10F, force_bold_threshold ) - CFF_FIELD_NUM ( 0x110, lenIV ) - CFF_FIELD_NUM ( 0x111, language_group ) - CFF_FIELD_FIXED( 0x112, expansion_factor ) - CFF_FIELD_NUM ( 0x113, initial_random_seed ) - CFF_FIELD_NUM ( 19, local_subrs_offset ) - CFF_FIELD_NUM ( 20, default_width ) - CFF_FIELD_NUM ( 21, nominal_width ) + CFF_FIELD_DELTA ( 6, blue_values, 14 ) + CFF_FIELD_DELTA ( 7, other_blues, 10 ) + CFF_FIELD_DELTA ( 8, family_blues, 14 ) + CFF_FIELD_DELTA ( 9, family_other_blues, 10 ) + CFF_FIELD_FIXED_1000( 0x109, blue_scale ) + CFF_FIELD_NUM ( 0x10A, blue_shift ) + CFF_FIELD_NUM ( 0x10B, blue_fuzz ) + CFF_FIELD_NUM ( 10, standard_width ) + CFF_FIELD_NUM ( 11, standard_height ) + CFF_FIELD_DELTA ( 0x10C, snap_widths, 13 ) + CFF_FIELD_DELTA ( 0x10D, snap_heights, 13 ) + CFF_FIELD_BOOL ( 0x10E, force_bold ) + CFF_FIELD_FIXED ( 0x10F, force_bold_threshold ) + CFF_FIELD_NUM ( 0x110, lenIV ) + CFF_FIELD_NUM ( 0x111, language_group ) + CFF_FIELD_FIXED ( 0x112, expansion_factor ) + CFF_FIELD_NUM ( 0x113, initial_random_seed ) + CFF_FIELD_NUM ( 19, local_subrs_offset ) + CFF_FIELD_NUM ( 20, default_width ) + CFF_FIELD_NUM ( 21, nominal_width ) /* END */ diff --git a/src/cid/cidload.c b/src/cid/cidload.c index 866b2f02a..7dffd96c7 100644 --- a/src/cid/cidload.c +++ b/src/cid/cidload.c @@ -147,9 +147,10 @@ if ( keyword->type == T1_FIELD_TYPE_INTEGER_ARRAY || keyword->type == T1_FIELD_TYPE_FIXED_ARRAY ) error = cid_parser_load_field_table( &loader->parser, keyword, - &dummy_object ); + &dummy_object ); else - error = cid_parser_load_field( &loader->parser, keyword, &dummy_object ); + error = cid_parser_load_field( &loader->parser, + keyword, &dummy_object ); Exit: return error; } diff --git a/src/cid/cidtoken.h b/src/cid/cidtoken.h index e22809856..6d8d79737 100644 --- a/src/cid/cidtoken.h +++ b/src/cid/cidtoken.h @@ -76,7 +76,7 @@ T1_FIELD_NUM ( "LanguageGroup", language_group ) T1_FIELD_NUM ( "password", password ) - T1_FIELD_FIXED ( "BlueScale", blue_scale ) + T1_FIELD_FIXED_1000( "BlueScale", blue_scale ) T1_FIELD_NUM ( "BlueShift", blue_shift ) T1_FIELD_NUM ( "BlueFuzz", blue_fuzz ) diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index 7cf6b886a..fa1f74afc 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -907,10 +907,18 @@ goto Store_Integer_P; case T1_FIELD_TYPE_FIXED: - val = t1_tofixed( &cur, limit, 3 ); + val = t1_tofixed( &cur, limit, 0 ); goto Store_Integer; case T1_FIELD_TYPE_FIXED_P: + val = t1_tofixed( &cur, limit, 0 ); + goto Store_Integer_P; + + case T1_FIELD_TYPE_FIXED_1000: + val = t1_tofixed( &cur, limit, 3 ); + goto Store_Integer; + + case T1_FIELD_TYPE_FIXED_1000_P: val = t1_tofixed( &cur, limit, 3 ); goto Store_Integer_P; diff --git a/src/pshinter/pshglob.c b/src/pshinter/pshglob.c index 61a9b86a4..7c09ea425 100644 --- a/src/pshinter/pshglob.c +++ b/src/pshinter/pshglob.c @@ -677,7 +677,7 @@ globals->blues.blue_scale = priv->blue_scale ? priv->blue_scale - : 0x28937L; /* 0.039625 * 0x400000L */ + : 0x27A000L; /* 0.039625 * 0x10000 * 1000 */ globals->blues.blue_shift = priv->blue_shift ? priv->blue_shift diff --git a/src/type1/t1tokens.h b/src/type1/t1tokens.h index 5d445dfaf..411073f07 100644 --- a/src/type1/t1tokens.h +++ b/src/type1/t1tokens.h @@ -44,7 +44,7 @@ T1_FIELD_NUM ( "LanguageGroup", language_group ) T1_FIELD_NUM ( "password", password ) - T1_FIELD_FIXED ( "BlueScale", blue_scale ) + T1_FIELD_FIXED_1000( "BlueScale", blue_scale ) T1_FIELD_NUM ( "BlueShift", blue_shift ) T1_FIELD_NUM ( "BlueFuzz", blue_fuzz )