< prev index next >

src/java.desktop/share/native/libfreetype/src/truetype/ttobjs.c

Print this page




 131          FT_NEW_ARRAY( zone->tags,     maxPoints   ) ||
 132          FT_NEW_ARRAY( zone->contours, maxContours ) )
 133     {
 134       tt_glyphzone_done( zone );
 135     }
 136     else
 137     {
 138       zone->max_points   = maxPoints;
 139       zone->max_contours = maxContours;
 140     }
 141 
 142     return error;
 143   }
 144 #endif /* TT_USE_BYTECODE_INTERPRETER */
 145 
 146 
 147   /* Compare the face with a list of well-known `tricky' fonts. */
 148   /* This list shall be expanded as we find more of them.       */
 149 
 150   static FT_Bool
 151   tt_check_trickyness_family( FT_String*  name )
 152   {
 153 
 154 #define TRICK_NAMES_MAX_CHARACTERS  19
 155 #define TRICK_NAMES_COUNT           26
 156 
 157     static const char trick_names[TRICK_NAMES_COUNT]
 158                                  [TRICK_NAMES_MAX_CHARACTERS + 1] =
 159     {
 160       /*
 161          PostScript names are given in brackets if they differ from the
 162          family name.  The version numbers, together with the copyright or
 163          release year data, are taken from fonts available to the
 164          developers.
 165 
 166          Note that later versions of the fonts might be no longer tricky;
 167          for example, `MingLiU' version 7.00 (file `mingliu.ttc' from
 168          Windows 7) is an ordinary TTC with non-tricky subfonts.
 169        */
 170 
 171       "cpop",               /* dftt-p7.ttf; version 1.00, 1992 [DLJGyShoMedium] */


 920    * @Description:
 921    *   Run the control value program.
 922    *
 923    * @Input:
 924    *   size ::
 925    *     A handle to the size object.
 926    *
 927    *   pedantic ::
 928    *     Set if bytecode execution should be pedantic.
 929    *
 930    * @Return:
 931    *   FreeType error code.  0 means success.
 932    */
 933   FT_LOCAL_DEF( FT_Error )
 934   tt_size_run_prep( TT_Size  size,
 935                     FT_Bool  pedantic )
 936   {
 937     TT_Face         face = (TT_Face)size->root.face;
 938     TT_ExecContext  exec;
 939     FT_Error        error;





 940 










 941 
 942     exec = size->context;
 943 
 944     error = TT_Load_Context( exec, face, size );
 945     if ( error )
 946       return error;
 947 
 948     exec->callTop = 0;
 949     exec->top     = 0;
 950 
 951     exec->instruction_trap = FALSE;
 952 
 953     exec->pedantic_hinting = pedantic;
 954 
 955     TT_Set_CodeRange( exec,
 956                       tt_coderange_cvt,
 957                       face->cvt_program,
 958                       (FT_Long)face->cvt_program_size );
 959 
 960     TT_Clear_CodeRange( exec, tt_coderange_glyph );


1077     size->max_function_defs    = maxp->maxFunctionDefs;
1078     size->max_instruction_defs = maxp->maxInstructionDefs;
1079 
1080     size->num_function_defs    = 0;
1081     size->num_instruction_defs = 0;
1082 
1083     size->max_func = 0;
1084     size->max_ins  = 0;
1085 
1086     size->cvt_size     = face->cvt_size;
1087     size->storage_size = maxp->maxStorage;
1088 
1089     /* Set default metrics */
1090     {
1091       TT_Size_Metrics*  tt_metrics = &size->ttmetrics;
1092 
1093 
1094       tt_metrics->rotated   = FALSE;
1095       tt_metrics->stretched = FALSE;
1096 
1097       /* set default engine compensation */






1098       tt_metrics->compensations[0] = 0;   /* gray     */
1099       tt_metrics->compensations[1] = 0;   /* black    */
1100       tt_metrics->compensations[2] = 0;   /* white    */
1101       tt_metrics->compensations[3] = 0;   /* reserved */
1102     }
1103 
1104     /* allocate function defs, instruction defs, cvt, and storage area */
1105     if ( FT_NEW_ARRAY( size->function_defs,    size->max_function_defs    ) ||
1106          FT_NEW_ARRAY( size->instruction_defs, size->max_instruction_defs ) ||
1107          FT_NEW_ARRAY( size->cvt,              size->cvt_size             ) ||
1108          FT_NEW_ARRAY( size->storage,          size->storage_size         ) )
1109       goto Exit;
1110 
1111     /* reserve twilight zone */
1112     n_twilight = maxp->maxTwilightPoints;
1113 
1114     /* there are 4 phantom points (do we need this?) */
1115     n_twilight += 4;
1116 
1117     error = tt_glyphzone_new( memory, n_twilight, 0, &size->twilight );
1118     if ( error )
1119       goto Exit;
1120 
1121     size->twilight.n_points = n_twilight;


1154 
1155   FT_LOCAL_DEF( FT_Error )
1156   tt_size_ready_bytecode( TT_Size  size,
1157                           FT_Bool  pedantic )
1158   {
1159     FT_Error  error = FT_Err_Ok;
1160 
1161 
1162     if ( size->bytecode_ready < 0 )
1163       error = tt_size_init_bytecode( (FT_Size)size, pedantic );
1164     else
1165       error = size->bytecode_ready;
1166 
1167     if ( error )
1168       goto Exit;
1169 
1170     /* rescale CVT when needed */
1171     if ( size->cvt_ready < 0 )
1172     {
1173       FT_UInt  i;
1174       TT_Face  face = (TT_Face)size->root.face;
1175 
1176 
1177       /* Scale the cvt values to the new ppem.            */
1178       /* By default, we use the y ppem value for scaling. */
1179       FT_TRACE6(( "CVT values:\n" ));
1180       for ( i = 0; i < size->cvt_size; i++ )
1181       {
1182         size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale );
1183         FT_TRACE6(( "  %3d: %d (%f)\n",
1184                     i, face->cvt[i], size->cvt[i] / 64.0 ));
1185       }
1186       FT_TRACE6(( "\n" ));
1187 
1188       /* all twilight points are originally zero */
1189       for ( i = 0; i < (FT_UInt)size->twilight.n_points; i++ )
1190       {
1191         size->twilight.org[i].x = 0;
1192         size->twilight.org[i].y = 0;
1193         size->twilight.cur[i].x = 0;
1194         size->twilight.cur[i].y = 0;
1195       }
1196 
1197       /* clear storage area */
1198       for ( i = 0; i < (FT_UInt)size->storage_size; i++ )
1199         size->storage[i] = 0;
1200 
1201       size->GS = tt_default_graphics_state;
1202 
1203       error = tt_size_run_prep( size, pedantic );
1204     }
1205     else
1206       error = size->cvt_ready;




 131          FT_NEW_ARRAY( zone->tags,     maxPoints   ) ||
 132          FT_NEW_ARRAY( zone->contours, maxContours ) )
 133     {
 134       tt_glyphzone_done( zone );
 135     }
 136     else
 137     {
 138       zone->max_points   = maxPoints;
 139       zone->max_contours = maxContours;
 140     }
 141 
 142     return error;
 143   }
 144 #endif /* TT_USE_BYTECODE_INTERPRETER */
 145 
 146 
 147   /* Compare the face with a list of well-known `tricky' fonts. */
 148   /* This list shall be expanded as we find more of them.       */
 149 
 150   static FT_Bool
 151   tt_check_trickyness_family( const FT_String*  name )
 152   {
 153 
 154 #define TRICK_NAMES_MAX_CHARACTERS  19
 155 #define TRICK_NAMES_COUNT           26
 156 
 157     static const char trick_names[TRICK_NAMES_COUNT]
 158                                  [TRICK_NAMES_MAX_CHARACTERS + 1] =
 159     {
 160       /*
 161          PostScript names are given in brackets if they differ from the
 162          family name.  The version numbers, together with the copyright or
 163          release year data, are taken from fonts available to the
 164          developers.
 165 
 166          Note that later versions of the fonts might be no longer tricky;
 167          for example, `MingLiU' version 7.00 (file `mingliu.ttc' from
 168          Windows 7) is an ordinary TTC with non-tricky subfonts.
 169        */
 170 
 171       "cpop",               /* dftt-p7.ttf; version 1.00, 1992 [DLJGyShoMedium] */


 920    * @Description:
 921    *   Run the control value program.
 922    *
 923    * @Input:
 924    *   size ::
 925    *     A handle to the size object.
 926    *
 927    *   pedantic ::
 928    *     Set if bytecode execution should be pedantic.
 929    *
 930    * @Return:
 931    *   FreeType error code.  0 means success.
 932    */
 933   FT_LOCAL_DEF( FT_Error )
 934   tt_size_run_prep( TT_Size  size,
 935                     FT_Bool  pedantic )
 936   {
 937     TT_Face         face = (TT_Face)size->root.face;
 938     TT_ExecContext  exec;
 939     FT_Error        error;
 940     FT_UInt         i;
 941 
 942     /* unscaled CVT values are already stored in 26.6 format */
 943     FT_Fixed  scale = size->ttmetrics.scale >> 6;
 944 
 945 
 946     /* Scale the cvt values to the new ppem.            */
 947     /* By default, we use the y ppem value for scaling. */
 948     FT_TRACE6(( "CVT values:\n" ));
 949     for ( i = 0; i < size->cvt_size; i++ )
 950     {
 951       size->cvt[i] = FT_MulFix( face->cvt[i], scale );
 952       FT_TRACE6(( "  %3d: %f (%f)\n",
 953                   i, face->cvt[i] / 64.0, size->cvt[i] / 64.0 ));
 954     }
 955     FT_TRACE6(( "\n" ));
 956 
 957     exec = size->context;
 958 
 959     error = TT_Load_Context( exec, face, size );
 960     if ( error )
 961       return error;
 962 
 963     exec->callTop = 0;
 964     exec->top     = 0;
 965 
 966     exec->instruction_trap = FALSE;
 967 
 968     exec->pedantic_hinting = pedantic;
 969 
 970     TT_Set_CodeRange( exec,
 971                       tt_coderange_cvt,
 972                       face->cvt_program,
 973                       (FT_Long)face->cvt_program_size );
 974 
 975     TT_Clear_CodeRange( exec, tt_coderange_glyph );


1092     size->max_function_defs    = maxp->maxFunctionDefs;
1093     size->max_instruction_defs = maxp->maxInstructionDefs;
1094 
1095     size->num_function_defs    = 0;
1096     size->num_instruction_defs = 0;
1097 
1098     size->max_func = 0;
1099     size->max_ins  = 0;
1100 
1101     size->cvt_size     = face->cvt_size;
1102     size->storage_size = maxp->maxStorage;
1103 
1104     /* Set default metrics */
1105     {
1106       TT_Size_Metrics*  tt_metrics = &size->ttmetrics;
1107 
1108 
1109       tt_metrics->rotated   = FALSE;
1110       tt_metrics->stretched = FALSE;
1111 
1112       /* Set default engine compensation.  Value 3 is not described */
1113       /* in the OpenType specification (as of Mai 2019), but Greg   */
1114       /* says that MS handles it the same as `gray'.                */
1115       /*                                                            */
1116       /* The Apple specification says that the compensation for     */
1117       /* `gray' is always zero.  FreeType doesn't do any            */
1118       /* compensation at all.                                       */
1119       tt_metrics->compensations[0] = 0;   /* gray             */
1120       tt_metrics->compensations[1] = 0;   /* black            */
1121       tt_metrics->compensations[2] = 0;   /* white            */
1122       tt_metrics->compensations[3] = 0;   /* the same as gray */
1123     }
1124 
1125     /* allocate function defs, instruction defs, cvt, and storage area */
1126     if ( FT_NEW_ARRAY( size->function_defs,    size->max_function_defs    ) ||
1127          FT_NEW_ARRAY( size->instruction_defs, size->max_instruction_defs ) ||
1128          FT_NEW_ARRAY( size->cvt,              size->cvt_size             ) ||
1129          FT_NEW_ARRAY( size->storage,          size->storage_size         ) )
1130       goto Exit;
1131 
1132     /* reserve twilight zone */
1133     n_twilight = maxp->maxTwilightPoints;
1134 
1135     /* there are 4 phantom points (do we need this?) */
1136     n_twilight += 4;
1137 
1138     error = tt_glyphzone_new( memory, n_twilight, 0, &size->twilight );
1139     if ( error )
1140       goto Exit;
1141 
1142     size->twilight.n_points = n_twilight;


1175 
1176   FT_LOCAL_DEF( FT_Error )
1177   tt_size_ready_bytecode( TT_Size  size,
1178                           FT_Bool  pedantic )
1179   {
1180     FT_Error  error = FT_Err_Ok;
1181 
1182 
1183     if ( size->bytecode_ready < 0 )
1184       error = tt_size_init_bytecode( (FT_Size)size, pedantic );
1185     else
1186       error = size->bytecode_ready;
1187 
1188     if ( error )
1189       goto Exit;
1190 
1191     /* rescale CVT when needed */
1192     if ( size->cvt_ready < 0 )
1193     {
1194       FT_UInt  i;


1195 










1196 
1197       /* all twilight points are originally zero */
1198       for ( i = 0; i < (FT_UInt)size->twilight.n_points; i++ )
1199       {
1200         size->twilight.org[i].x = 0;
1201         size->twilight.org[i].y = 0;
1202         size->twilight.cur[i].x = 0;
1203         size->twilight.cur[i].y = 0;
1204       }
1205 
1206       /* clear storage area */
1207       for ( i = 0; i < (FT_UInt)size->storage_size; i++ )
1208         size->storage[i] = 0;
1209 
1210       size->GS = tt_default_graphics_state;
1211 
1212       error = tt_size_run_prep( size, pedantic );
1213     }
1214     else
1215       error = size->cvt_ready;


< prev index next >