* src/truetype/ttinterp.c (CUR_Func_move_orig): New macro. (Direct_Move_Orig, Direct_Move_Orig_X, Direct_Move_Orig_Y): New functions. Similar to Direct_Move, Direct_Move_X, and Direct_Move_Y but without touching. (Compute_Funcs): Use new functions. (Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid, Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45): Fix rounding of value zero. (DO_DIV): Don't use TT_MULDIV. (Ins_SHC): This instruction actually touches the points. (Ins_MSIRP): Fix undocumented behaviour. * src/truetype/ttinterp.h (TT_ExecContextRec): Updated. * docs/VERSION.DLL: Updated. * src/base/ftobjs.c (FT_Set_Char_Size): Make metrics->x_scale and metrics->y_scale really precise. (FT_Load_Glyph): Update computation of linearHoriAdvance and linearVertAdvance. * src/true/type/ttinterp.c (Update_Max): Use FT_REALLOC.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542
diff --git a/ChangeLog b/ChangeLog
index 84fbdea..3bdce81 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,41 @@
-2003-11-22 David Turner <david@freetype.org>
+2003-11-22 Rogier van Dalen <R.C.van.Dalen@umail.leidenuniv.nl>
- * src/autofit/*: more updates
+ * src/truetype/ttinterp.c (CUR_Func_move_orig): New macro.
+ (Direct_Move_Orig, Direct_Move_Orig_X, Direct_Move_Orig_Y): New
+ functions. Similar to Direct_Move, Direct_Move_X, and
+ Direct_Move_Y but without touching.
+ (Compute_Funcs): Use new functions.
+
+ (Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
+ Round_Up_To_Grid, Round_To_Double_Grid, Round_Super,
+ Round_Super_45): Fix rounding of value zero.
+
+ (DO_DIV): Don't use TT_MULDIV.
+
+ (Ins_SHC): This instruction actually touches the points.
+ (Ins_MSIRP): Fix undocumented behaviour.
+
+ * src/truetype/ttinterp.h (TT_ExecContextRec): Updated.
+
+2003-11-22 Werner Lemberg <wl@gnu.org>
+
+ * docs/VERSION.DLL: Updated.
+
+ * src/base/ftobjs.c (FT_Set_Char_Size): Make metrics->x_scale and
+ metrics->y_scale really precise.
+
+ (FT_Load_Glyph): Update computation of linearHoriAdvance and
+ linearVertAdvance.
+
+ * src/true/type/ttinterp.c (Update_Max): Use FT_REALLOC.
+
+2003-11-22 David Turner <david@freetype.org>
+
+ * src/autofit/*: More updates.
+
+ * include/freetype/freetype.h (FREETYPE_PATCH): Set to 8.
+ * builds/unix/configure.ac (version_info): Set to 9:6:3.
+ * README: Updated.
2003-11-13 John A. Boyd Jr. <jaboydjr@netwalk.com>
diff --git a/docs/VERSION.DLL b/docs/VERSION.DLL
index 9bdd643..5b178bd 100644
--- a/docs/VERSION.DLL
+++ b/docs/VERSION.DLL
@@ -91,20 +91,19 @@ other release numbers.
old_CPPFLAGS="$CPPFLAGS"
CPPFLAGS=`freetype-config --cflags`
AC_TRY_CPP([
+
#include <ft2build.h>
#include FT_FREETYPE_H
#if (FREETYPE_MAJOR*1000 + FREETYPE_MINOR)*1000 + FREETYPE_PATCH < 2000009
#error Freetype version too low.
#endif
- ],[
- AC_MSG_RESULT(yes)
- FREETYPE_LIBS=`freetype-config --libs`
- AC_SUBST(FREETYPE_LIBS)
- AC_DEFINE(HAVE_FREETYPE,1,[Define if you have the FreeType2 library])
- CPPFLAGS="$old_CPPFLAGS"
- ],[
- AC_MSG_ERROR([Need FreeType library version 2.0.9 or higher])
- ])
+ ],
+ [AC_MSG_RESULT(yes)
+ FREETYPE_LIBS=`freetype-config --libs`
+ AC_SUBST(FREETYPE_LIBS)
+ AC_DEFINE(HAVE_FREETYPE,1,[Define if you have the FreeType2 library])
+ CPPFLAGS="$old_CPPFLAGS"],
+ [AC_MSG_ERROR([Need FreeType library version 2.0.9 or higher])])
--- end of VERSION.DLL ---
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 67e491b..69f74c0 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -575,15 +575,14 @@
if ( ( load_flags & FT_LOAD_LINEAR_DESIGN ) == 0 &&
( face->face_flags & FT_FACE_FLAG_SCALABLE ) )
{
- FT_UInt EM = face->units_per_EM;
FT_Size_Metrics* metrics = &face->size->metrics;
slot->linearHoriAdvance = FT_MulDiv( slot->linearHoriAdvance,
- (FT_Long)metrics->x_ppem << 16, EM );
+ metrics->x_scale, 64 );
slot->linearVertAdvance = FT_MulDiv( slot->linearVertAdvance,
- (FT_Long)metrics->y_ppem << 16, EM );
+ metrics->y_scale, 64 );
}
if ( ( load_flags & FT_LOAD_IGNORE_TRANSFORM ) == 0 )
@@ -2042,11 +2041,11 @@
char_height = 1 * 64;
/* Compute pixel sizes in 26.6 units with rounding */
- dim_x = ( ( char_width * horz_resolution + (36+32*72) ) / 72 ) & -64;
- dim_y = ( ( char_height * vert_resolution + (36+32*72) ) / 72 ) & -64;
+ dim_x = ( char_width * horz_resolution + 36 ) / 72;
+ dim_y = ( char_height * vert_resolution + 36 ) / 72;
- metrics->x_ppem = (FT_UShort)( dim_x >> 6 );
- metrics->y_ppem = (FT_UShort)( dim_y >> 6 );
+ metrics->x_ppem = (FT_UShort)( ( dim_x + 32 ) >> 6 );
+ metrics->y_ppem = (FT_UShort)( ( dim_y + 32 ) >> 6 );
metrics->x_scale = 0x10000L;
metrics->y_scale = 0x10000L;
diff --git a/src/pfr/pfrdrivr.c b/src/pfr/pfrdrivr.c
index f25c732..6a72d09 100644
--- a/src/pfr/pfrdrivr.c
+++ b/src/pfr/pfrdrivr.c
@@ -26,6 +26,7 @@
#include "pfrerror.h"
+
static FT_Error
pfr_get_kerning( PFR_Face face,
FT_UInt left,
@@ -52,15 +53,16 @@
return PFR_Err_Ok;
}
+
/*
* PFR METRICS SERVICE
*
*/
static FT_Error
- pfr_get_advance( PFR_Face face,
- FT_UInt gindex,
- FT_Pos *aadvance )
+ pfr_get_advance( PFR_Face face,
+ FT_UInt gindex,
+ FT_Pos *aadvance )
{
FT_Error error = PFR_Err_Bad_Argument;
@@ -68,12 +70,12 @@
*aadvance = 0;
if ( face )
{
- PFR_PhyFont phys = &face->phy_font;
+ PFR_PhyFont phys = &face->phy_font;
if ( gindex < phys->num_chars )
{
- *aadvance = phys->chars[ gindex ].advance;
+ *aadvance = phys->chars[gindex].advance;
error = 0;
}
}
@@ -89,7 +91,7 @@
FT_Fixed *ametrics_x_scale,
FT_Fixed *ametrics_y_scale )
{
- PFR_PhyFont phys = &face->phy_font;
+ PFR_PhyFont phys = &face->phy_font;
FT_Fixed x_scale, y_scale;
FT_Size size = face->root.size;
@@ -118,7 +120,7 @@
if ( ametrics_y_scale )
*ametrics_y_scale = y_scale;
- return 0;
+ return PFR_Err_Ok;
}
@@ -130,6 +132,7 @@
(FT_PFR_GetAdvanceFunc)pfr_get_advance
};
+
/*
* SERVICE LIST
*
@@ -137,7 +140,7 @@
static const FT_ServiceDescRec pfr_services[] =
{
- { FT_SERVICE_ID_PFR_METRICS, & pfr_metrics_service_rec },
+ { FT_SERVICE_ID_PFR_METRICS, &pfr_metrics_service_rec },
{ FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_PFR },
{ NULL, NULL }
};
@@ -177,20 +180,20 @@
sizeof( PFR_SizeRec ),
sizeof( PFR_SlotRec ),
- (FT_Face_InitFunc) pfr_face_init,
- (FT_Face_DoneFunc) pfr_face_done,
- (FT_Size_InitFunc) NULL,
- (FT_Size_DoneFunc) NULL,
- (FT_Slot_InitFunc) pfr_slot_init,
- (FT_Slot_DoneFunc) pfr_slot_done,
+ (FT_Face_InitFunc) pfr_face_init,
+ (FT_Face_DoneFunc) pfr_face_done,
+ (FT_Size_InitFunc) NULL,
+ (FT_Size_DoneFunc) NULL,
+ (FT_Slot_InitFunc) pfr_slot_init,
+ (FT_Slot_DoneFunc) pfr_slot_done,
- (FT_Size_ResetPointsFunc) NULL,
- (FT_Size_ResetPixelsFunc) NULL,
- (FT_Slot_LoadFunc) pfr_slot_load,
+ (FT_Size_ResetPointsFunc)NULL,
+ (FT_Size_ResetPixelsFunc)NULL,
+ (FT_Slot_LoadFunc) pfr_slot_load,
- (FT_Face_GetKerningFunc) pfr_get_kerning,
- (FT_Face_AttachFunc) 0,
- (FT_Face_GetAdvancesFunc) 0
+ (FT_Face_GetKerningFunc) pfr_get_kerning,
+ (FT_Face_AttachFunc) 0,
+ (FT_Face_GetAdvancesFunc)0
};
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index 2dca6a2..d996a5d 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -162,6 +162,9 @@
#define CUR_Func_move( z, p, d ) \
CUR.func_move( EXEC_ARG_ z, p, d )
+#define CUR_Func_move_orig( z, p, d ) \
+ CUR.func_move_orig( EXEC_ARG_ z, p, d )
+
#define CUR_Func_dualproj( x, y ) \
CUR.func_dualproj( EXEC_ARG_ x, y )
@@ -515,8 +518,7 @@
if ( *size < new_max )
{
- FT_FREE( *buff );
- if ( FT_ALLOC( *buff, new_max * multiplier ) )
+ if ( FT_REALLOC( *buff, *size, new_max * multiplier ) )
return error;
*size = new_max;
}
@@ -1566,7 +1568,6 @@
if ( v != 0 )
{
-
zone->cur[point].x += TT_MULDIV( distance,
v * 0x10000L,
CUR.F_dot_P );
@@ -1578,7 +1579,6 @@
if ( v != 0 )
{
-
zone->cur[point].y += TT_MULDIV( distance,
v * 0x10000L,
CUR.F_dot_P );
@@ -1590,6 +1590,51 @@
/*************************************************************************/
/* */
+ /* <Function> */
+ /* Direct_Move_Orig */
+ /* */
+ /* <Description> */
+ /* Moves a point by a given distance along the freedom vector. The */
+ /* point will not be `touched'. */
+ /* */
+ /* <Input> */
+ /* point :: The index of the point to move. */
+ /* */
+ /* distance :: The distance to apply. */
+ /* */
+ /* <InOut> */
+ /* zone :: The affected glyph zone. */
+ /* */
+ static void
+ Direct_Move_Orig( EXEC_OP_ TT_GlyphZone zone,
+ FT_UShort point,
+ FT_F26Dot6 distance )
+ {
+ FT_F26Dot6 v;
+
+
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
+ FT_ASSERT( !CUR.face->unpatented_hinting );
+#endif
+
+ v = CUR.GS.freeVector.x;
+
+ if ( v != 0 )
+ zone->org[point].x += TT_MULDIV( distance,
+ v * 0x10000L,
+ CUR.F_dot_P );
+
+ v = CUR.GS.freeVector.y;
+
+ if ( v != 0 )
+ zone->org[point].y += TT_MULDIV( distance,
+ v * 0x10000L,
+ CUR.F_dot_P );
+ }
+
+
+ /*************************************************************************/
+ /* */
/* Special versions of Direct_Move() */
/* */
/* The following versions are used whenever both vectors are both */
@@ -1624,6 +1669,38 @@
/*************************************************************************/
/* */
+ /* Special versions of Direct_Move_Orig() */
+ /* */
+ /* The following versions are used whenever both vectors are both */
+ /* along one of the coordinate unit vectors, i.e. in 90% of the cases. */
+ /* */
+ /*************************************************************************/
+
+
+ static void
+ Direct_Move_Orig_X( EXEC_OP_ TT_GlyphZone zone,
+ FT_UShort point,
+ FT_F26Dot6 distance )
+ {
+ FT_UNUSED_EXEC;
+
+ zone->org[point].x += distance;
+ }
+
+
+ static void
+ Direct_Move_Orig_Y( EXEC_OP_ TT_GlyphZone zone,
+ FT_UShort point,
+ FT_F26Dot6 distance )
+ {
+ FT_UNUSED_EXEC;
+
+ zone->org[point].y += distance;
+ }
+
+
+ /*************************************************************************/
+ /* */
/* <Function> */
/* Round_None */
/* */
@@ -1656,7 +1733,7 @@
if ( distance >= 0 )
{
val = distance + compensation;
- if ( val < 0 )
+ if ( distance && val < 0 )
val = 0;
}
else {
@@ -1696,7 +1773,7 @@
if ( distance >= 0 )
{
val = distance + compensation + 32;
- if ( val > 0 )
+ if ( distance && val > 0 )
val &= ~63;
else
val = 0;
@@ -1740,7 +1817,7 @@
if ( distance >= 0 )
{
val = ( ( distance + compensation ) & -64 ) + 32;
- if ( val < 0 )
+ if ( distance && val < 0 )
val = 0;
}
else
@@ -1782,7 +1859,7 @@
if ( distance >= 0 )
{
val = distance + compensation;
- if ( val > 0 )
+ if ( distance && val > 0 )
val &= ~63;
else
val = 0;
@@ -1826,7 +1903,7 @@
if ( distance >= 0 )
{
val = distance + compensation + 63;
- if ( val > 0 )
+ if ( distance && val > 0 )
val &= ~63;
else
val = 0;
@@ -1870,7 +1947,7 @@
if ( distance >= 0 )
{
val = distance + compensation + 16;
- if ( val > 0 )
+ if ( distance && val > 0 )
val &= ~31;
else
val = 0;
@@ -1919,7 +1996,7 @@
{
val = ( distance - CUR.phase + CUR.threshold + compensation ) &
-CUR.period;
- if ( val < 0 )
+ if ( distance && val < 0 )
val = 0;
val += CUR.phase;
}
@@ -1967,7 +2044,7 @@
{
val = ( ( distance - CUR.phase + CUR.threshold + compensation ) /
CUR.period ) * CUR.period;
- if ( val < 0 )
+ if ( distance && val < 0 )
val = 0;
val += CUR.phase;
}
@@ -2243,13 +2320,15 @@
if ( CUR.GS.both_x_axis )
{
- CUR.func_project = Project_x;
- CUR.func_move = Direct_Move_X;
+ CUR.func_project = Project_x;
+ CUR.func_move = Direct_Move_X;
+ CUR.func_move_orig = Direct_Move_Orig_X;
}
else
{
- CUR.func_project = Project_y;
- CUR.func_move = Direct_Move_Y;
+ CUR.func_project = Project_y;
+ CUR.func_move = Direct_Move_Y;
+ CUR.func_move_orig = Direct_Move_Orig_Y;
}
if ( CUR.GS.dualVector.x == 0x4000 )
@@ -2300,16 +2379,23 @@
CUR.func_dualproj = (TT_Project_Func)Dual_Project;
}
- CUR.func_move = (TT_Move_Func)Direct_Move;
+ CUR.func_move = (TT_Move_Func)Direct_Move;
+ CUR.func_move_orig = (TT_Move_Func)Direct_Move_Orig;
if ( CUR.F_dot_P == 0x40000000L )
{
if ( CUR.GS.freeVector.x == 0x4000 )
- CUR.func_move = (TT_Move_Func)Direct_Move_X;
+ {
+ CUR.func_move = (TT_Move_Func)Direct_Move_X;
+ CUR.func_move_orig = (TT_Move_Func)Direct_Move_Orig_X;
+ }
else
{
if ( CUR.GS.freeVector.y == 0x4000 )
- CUR.func_move = (TT_Move_Func)Direct_Move_Y;
+ {
+ CUR.func_move = (TT_Move_Func)Direct_Move_Y;
+ CUR.func_move_orig = (TT_Move_Func)Direct_Move_Orig_Y;
+ }
}
}
@@ -2891,7 +2977,8 @@
if ( args[1] == 0 ) \
CUR.error = TT_Err_Divide_By_Zero; \
else \
- args[0] = TT_MULDIV( args[0], 64L, args[1] );
+/* Should args[0] be cast to FT_Int64 first? */ \
+ args[0] = ( args[0] * 64L ) / args[1];
#define DO_MUL \
@@ -5359,11 +5446,11 @@
last_point = 0;
}
- /* XXX: UNDOCUMENTED! SHC doesn't touch the points */
+ /* XXX: UNDOCUMENTED! SHC does touch the points */
for ( i = first_point; i <= last_point; i++ )
{
if ( zp.cur != CUR.zp2.cur || refp != i )
- MOVE_Zp2_Point( i, dx, dy, FALSE );
+ MOVE_Zp2_Point( i, dx, dy, TRUE );
}
}
@@ -5498,9 +5585,11 @@
}
/* XXX: UNDOCUMENTED! behaviour */
- if ( CUR.GS.gep0 == 0 ) /* if in twilight zone */
+ if ( CUR.GS.gep1 == 0 ) /* if the point that is to be moved */
+ /* is in twilight zone */
{
CUR.zp1.org[point] = CUR.zp0.org[CUR.GS.rp0];
+ CUR_Func_move_orig( &CUR.zp1, point, args[1] );
CUR.zp1.cur[point] = CUR.zp1.org[point];
}
diff --git a/src/truetype/ttinterp.h b/src/truetype/ttinterp.h
index e750963..eb0bb0b 100644
--- a/src/truetype/ttinterp.h
+++ b/src/truetype/ttinterp.h
@@ -4,7 +4,7 @@
/* */
/* TrueType bytecode interpreter (specification). */
/* */
-/* 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, */
@@ -210,6 +210,7 @@ FT_BEGIN_HEADER
func_freeProj; /* current freedom proj. func */
TT_Move_Func func_move; /* current point move function */
+ TT_Move_Func func_move_orig; /* move original position function */
TT_Get_CVT_Func func_read_cvt; /* read a cvt entry */
TT_Set_CVT_Func func_write_cvt; /* write a cvt entry (in pixels) */