* src/base/ftcalc.c: Don't use `long long' but `FT_Int64'. Formatting
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
diff --git a/ChangeLog b/ChangeLog
index 04f8cac..117f4df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,14 +1,53 @@
+2006-11-03 Werner Lemberg <wl@gnu.org>
+
+ * src/base/ftcalc.c: Don't use `long long' but `FT_Int64'.
+
2006-11-02 David Turner <david@freetype.org>
- * src/autofit/aflatin.c: adding a few tweaks to better handle
- serif fonts (we now ignore vertical segments that are less than
- 1 pixels in height, which get rids of *many* corner cases with
- serifs)
+ Add a few tweaks to better handle serif fonts.
+ Add more debugging messages.
+
+ * src/autofit/aflatin.c (af_latin_hints_compute_edges): Ignore
+ segments that are less than 1.5 pixels high. This gets rid of
+ *many* corner cases with serifs.
+ (af_latin_align_linked_edge): Add logging message.
+ (af_latin_hint_edges): Use AF_HINTS_DO_BLUES.
+ Add logging messages.
+ Handle AF_EDGE_FLAG flag specially.
+
+ * src/autofit/afmodule.c [AF_DEBUG]: Add _af_debug,
+ _af_debug_disable_blue_hints, and _af_debug_hints variables.
+
+ * src/autofit/aftypes.h (AF_LOG) [AF_DEBUG]: Use _af_debug.
+ Update external declarations.
+ (af_corner_orientation, af_corner_is_flat): Replaced by...
+
+ * include/freetype/internal/ftcalc.h (ft_corner_orientation,
+ ft_corner_is_flat): These declarations.
+
+ * src/autofit/afangles.c (af_corner_orientation, af_corner_is_flat):
+ Comment out. Replaced by...
+
+ * src/base/ftcalc.h (ft_corner_orientation, ft_corner_is_flat):
+ These functions. Update all callers.
+ (FT_Add64) [!FT_LONG64]: Simplify.
+
+ * src/autofit/afhints.c: Include FT_INTERNAL_CALC_H.
+ (af_direction_compute): Add a missing FT_ABS call. This bug caused
+ production of garbage by missing lots of segments.
+
+ * src/autofit/afhints.h (AF_HINTS_DO_BLUES): New macro.
+
+ * src/autofit/afloader.c (af_loader_init, af_loader_done)
+ [AF_DEBUG]: Set _af_debug_hints.
+
+
+ * src/pshinter/pshalgo.c: Include FT_INTERNAL_CALC_H.
+ (psh_corner_is_flat, psh_corner_orientation): Use ft_corner_is_flat
+ and ft_corner_orientation.
+
- * src/autofit/afhints.c, src/autofit/afmodule.c,
- src/autofit/aftypes.h: adding more debug messages and fixing a small
- bug in af_compute_direction which produced garbage by missing lots of
- segments
+ * src/gzip/inftrees.c (huft_build): Remove compiler warning.
2006-10-24 Werner Lemberg <wl@gnu.org>
diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h
index fc1e3f9..c7e9901 100644
--- a/include/freetype/internal/ftcalc.h
+++ b/include/freetype/internal/ftcalc.h
@@ -110,17 +110,18 @@ FT_BEGIN_HEADER
#endif /* TT_USE_BYTECODE_INTERPRETER */
+
/*
* Return -1, 0, or +1, depending on the orientation of a given corner.
* We use the Cartesian coordinate system, with positive vertical values
- * going upwards. The function returns +1 when the corner turns to the
- * left, -1 to the right, and 0 for undecided.
+ * going upwards. The function returns +1 if the corner turns to the
+ * left, -1 to the right, and 0 for undecidable cases.
*/
FT_BASE( FT_Int )
- ft_corner_orientation( FT_Pos in_x,
- FT_Pos in_y,
- FT_Pos out_x,
- FT_Pos out_y );
+ ft_corner_orientation( FT_Pos in_x,
+ FT_Pos in_y,
+ FT_Pos out_x,
+ FT_Pos out_y );
/*
* Return TRUE if a corner is flat or nearly flat. This is equivalent to
@@ -128,10 +129,11 @@ FT_BEGIN_HEADER
* very small.
*/
FT_BASE( FT_Int )
- ft_corner_is_flat( FT_Pos in_x,
- FT_Pos in_y,
- FT_Pos out_x,
- FT_Pos out_y );
+ ft_corner_is_flat( FT_Pos in_x,
+ FT_Pos in_y,
+ FT_Pos out_x,
+ FT_Pos out_y );
+
#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) << 6 )
#define INT_TO_F2DOT14( x ) ( (FT_Long)(x) << 14 )
diff --git a/src/autofit/afangles.c b/src/autofit/afangles.c
index fac6dc3..e2360d1 100644
--- a/src/autofit/afangles.c
+++ b/src/autofit/afangles.c
@@ -19,7 +19,9 @@
#include "aftypes.h"
+
#if 0
+
FT_LOCAL_DEF( FT_Int )
af_corner_is_flat( FT_Pos x_in,
FT_Pos y_in,
@@ -74,8 +76,10 @@
else
return 1 - 2 * ( delta < 0 );
}
+
#endif
+
/*
* We are not using `af_angle_atan' anymore, but we keep the source
* code below just in case...
diff --git a/src/autofit/afhints.c b/src/autofit/afhints.c
index 043ca18..94692f5 100644
--- a/src/autofit/afhints.c
+++ b/src/autofit/afhints.c
@@ -20,6 +20,7 @@
#include "aferrors.h"
#include FT_INTERNAL_CALC_H
+
FT_LOCAL_DEF( FT_Error )
af_axis_hints_new_segment( AF_AxisHints axis,
FT_Memory memory,
diff --git a/src/autofit/afhints.h b/src/autofit/afhints.h
index 6e0e415..b6d8896 100644
--- a/src/autofit/afhints.h
+++ b/src/autofit/afhints.h
@@ -227,7 +227,7 @@ FT_BEGIN_HEADER
#define AF_HINTS_DO_ADVANCE( h ) \
!AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_ADVANCE )
-#define AF_HINTS_DO_BLUES( h ) ( !_af_debug_disable_blue_hints )
+#define AF_HINTS_DO_BLUES( h ) ( !_af_debug_disable_blue_hints )
#else /* !AF_DEBUG */
@@ -240,7 +240,7 @@ FT_BEGIN_HEADER
#define AF_HINTS_DO_ADVANCE( h ) \
!AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_ADVANCE )
-#define AF_HINTS_DO_BLUES( h ) 1
+#define AF_HINTS_DO_BLUES( h ) 1
#endif /* !AF_DEBUG */
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index 9d92db3..bb333ba 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -960,10 +960,10 @@
up_dir = ( dim == AF_DIMENSION_HORZ ) ? AF_DIR_UP
: AF_DIR_RIGHT;
- /* we want to ignore all segments that are less than 1.5
- * pixels in length, to avoid many problems with serif
- * fonts. we compute the corresponding threshold in font
- * units
+ /*
+ * We ignore all segments that are less than 1.5 pixels in length,
+ * to avoid many problems with serif fonts. We compute the
+ * corresponding threshold in font units.
*/
if ( dim == AF_DIMENSION_VERT )
segment_length_threshold = FT_DivFix( 64, hints->y_scale );
@@ -999,6 +999,7 @@
AF_Edge found = 0;
FT_Int ee;
+
if ( seg->max_coord - seg->min_coord < segment_length_threshold )
continue;
@@ -1119,10 +1120,11 @@
/* check for links -- if seg->serif is set, then seg->link must */
/* be ignored */
- is_serif = (FT_Bool)( seg->serif && seg->serif->edge &&
+ is_serif = (FT_Bool)( seg->serif &&
+ seg->serif->edge &&
seg->serif->edge != edge );
- if ( (seg->link && seg->link->edge != NULL) || is_serif )
+ if ( ( seg->link && seg->link->edge != NULL ) || is_serif )
{
AF_Edge edge2;
AF_Segment seg2;
@@ -1600,11 +1602,13 @@
(AF_Edge_Flags)base_edge->flags,
(AF_Edge_Flags)stem_edge->flags );
+
stem_edge->pos = base_edge->pos + fitted_width;
- AF_LOG(( "LINK: edge %d (opos=%.2f) linked to (%.2f), dist was %.2f now %.2f\n",
- stem_edge-hints->axis[dim].edges, stem_edge->opos/64.0,
- stem_edge->pos/64.0, dist/64., fitted_width/64. ));
+ AF_LOG(( "LINK: edge %d (opos=%.2f) linked to (%.2f), "
+ "dist was %.2f, now %.2f\n",
+ stem_edge-hints->axis[dim].edges, stem_edge->opos / 64.0,
+ stem_edge->pos / 64.0, dist / 64.0, fitted_width / 64.0 ));
}
@@ -1646,7 +1650,7 @@
/* we begin by aligning all stems relative to the blue zone */
/* if needed -- that's only for horizontal edges */
- if ( dim == AF_DIMENSION_VERT && AF_HINTS_DO_BLUES(hints) )
+ if ( dim == AF_DIMENSION_VERT && AF_HINTS_DO_BLUES( hints ) )
{
for ( edge = edges; edge < edge_limit; edge++ )
{
@@ -1675,8 +1679,11 @@
if ( !edge1 )
continue;
- AF_LOG(( "BLUE: edge %d (opos=%.2f) snapped to (%.2f) was (%.2f)\n",
- edge1-edges, edge1->opos/64., blue->fit/64., edge1->pos/64.0 ));
+ AF_LOG(( "BLUE: edge %d (opos=%.2f) snapped to (%.2f), "
+ "was (%.2f)\n",
+ edge1-edges, edge1->opos / 64.0, blue->fit / 64.0,
+ edge1->pos / 64.0 ));
+
edge1->pos = blue->fit;
edge1->flags |= AF_EDGE_DONE;
@@ -1714,7 +1721,8 @@
/* this should not happen, but it's better to be safe */
if ( edge2->blue_edge || edge2 < edge )
{
- AF_LOG(( "ASSERT FAILED for edge %d\n", edge2-edges ));
+ AF_LOG(( "ASSERTION FAILED for edge %d\n", edge2-edges ));
+
af_latin_align_linked_edge( hints, dim, edge2, edge );
edge->flags |= AF_EDGE_DONE;
continue;
@@ -1766,7 +1774,7 @@
edge->pos = FT_PIX_ROUND( edge->opos );
AF_LOG(( "ANCHOR: edge %d (opos=%.2f) snapped to (%.2f)\n",
- edge-edges, edge->opos/64., edge->pos/64. ));
+ edge-edges, edge->opos / 64.0, edge->pos / 64.0 ));
anchor = edge;
edge->flags |= AF_EDGE_DONE;
@@ -1789,9 +1797,8 @@
(AF_Edge_Flags)edge2->flags );
if ( edge2->flags & AF_EDGE_DONE )
- {
- edge->pos = edge2->pos - cur_len;
- }
+ edge->pos = edge2->pos - cur_len;
+
else if ( cur_len < 96 )
{
FT_Pos u_off, d_off;
@@ -1822,10 +1829,14 @@
edge->pos = cur_pos1 - cur_len / 2;
edge2->pos = cur_pos1 + cur_len / 2;
- AF_LOG(( "STEM: %d (opos=%.2f) to %d (opos=%.2f) snapped to (%.2f) and (%.2f)\n",
- edge-edges, edge->opos/64., edge2-edges, edge2->opos/64.,
- edge->pos/64., edge2->pos/64. ));
+
+ AF_LOG(( "STEM: %d (opos=%.2f) to %d (opos=%.2f) "
+ "snapped to (%.2f) and (%.2f)\n",
+ edge-edges, edge->opos / 64.0,
+ edge2-edges, edge2->opos / 64.0,
+ edge->pos / 64.0, edge2->pos / 64.0 ));
}
+
else
{
org_pos = anchor->pos + ( edge->opos - anchor->opos );
@@ -1850,9 +1861,11 @@
edge->pos = ( delta1 < delta2 ) ? cur_pos1 : cur_pos2;
edge2->pos = edge->pos + cur_len;
- AF_LOG(( "STEM: %d (opos=%.2f) to %d (opos=%.2f) snapped to (%.2f) and (%.2f)\n",
- edge-edges, edge->opos/64., edge2-edges, edge2->opos/64.,
- edge->pos/64., edge2->pos/64. ));
+ AF_LOG(( "STEM: %d (opos=%.2f) to %d (opos=%.2f) "
+ "snapped to (%.2f) and (%.2f)\n",
+ edge-edges, edge->opos / 64.0,
+ edge2-edges, edge2->opos / 64.0,
+ edge->pos / 64.0, edge2->pos / 64.0 ));
}
edge->flags |= AF_EDGE_DONE;
@@ -1860,8 +1873,8 @@
if ( edge > edges && edge->pos < edge[-1].pos )
{
- AF_LOG(( "BOUND: %d (pos=%.2f) to (%.2f)\n", edge-edges,
- edge->pos/64., edge[-1].pos/64. ));
+ AF_LOG(( "BOUND: %d (pos=%.2f) to (%.2f)\n",
+ edge-edges, edge->pos / 64.0, edge[-1].pos / 64.0 ));
edge->pos = edge[-1].pos;
}
}
diff --git a/src/autofit/afmodule.c b/src/autofit/afmodule.c
index 2d2f1a4..cd5e1cc 100644
--- a/src/autofit/afmodule.c
+++ b/src/autofit/afmodule.c
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter module implementation (body). */
/* */
-/* Copyright 2003, 2004, 2005 by */
+/* Copyright 2003, 2004, 2005, 2006 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -20,10 +20,10 @@
#include "afloader.h"
#ifdef AF_DEBUG
- int _af_debug;
- int _af_debug_disable_horz_hints;
- int _af_debug_disable_vert_hints;
- int _af_debug_disable_blue_hints;
+ int _af_debug;
+ int _af_debug_disable_horz_hints;
+ int _af_debug_disable_vert_hints;
+ int _af_debug_disable_blue_hints;
void* _af_debug_hints;
#endif
diff --git a/src/autofit/aftypes.h b/src/autofit/aftypes.h
index 8ece3ea..d1459a4 100644
--- a/src/autofit/aftypes.h
+++ b/src/autofit/aftypes.h
@@ -58,18 +58,18 @@ FT_BEGIN_HEADER
#ifdef AF_DEBUG
-# include <stdio.h>
-# define AF_LOG( x ) do { if (_af_debug) printf x ; } while (0)
+#include <stdio.h>
+#define AF_LOG( x ) do { if ( _af_debug ) printf x; } while ( 0 )
-extern int _af_debug;
-extern int _af_debug_disable_horz_hints;
-extern int _af_debug_disable_vert_hints;
-extern int _af_debug_disable_blue_hints;
+extern int _af_debug;
+extern int _af_debug_disable_horz_hints;
+extern int _af_debug_disable_vert_hints;
+extern int _af_debug_disable_blue_hints;
extern void* _af_debug_hints;
#else /* !AF_DEBUG */
-# define AF_LOG( x ) do ; while ( 0 ) /* nothing */
+#define AF_LOG( x ) do ; while ( 0 ) /* nothing */
#endif /* !AF_DEBUG */
diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c
index 8795ea1..95db279 100644
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -228,7 +228,7 @@
}
-#else /* FT_LONG64 */
+#else /* !FT_LONG64 */
static void
@@ -305,8 +305,8 @@
register FT_UInt32 lo, hi;
- lo = x->lo + y->lo;
- hi = x->hi + y->hi + ( lo < x->lo );
+ lo = x->lo + y->lo;
+ hi = x->hi + y->hi + ( lo < x->lo );
z->lo = lo;
z->hi = hi;
@@ -684,12 +684,13 @@
}
+ /* documentation is in ftcalc.h */
FT_BASE_DEF( FT_Int )
- ft_corner_orientation( FT_Pos in_x,
- FT_Pos in_y,
- FT_Pos out_x,
- FT_Pos out_y )
+ ft_corner_orientation( FT_Pos in_x,
+ FT_Pos in_y,
+ FT_Pos out_x,
+ FT_Pos out_y )
{
FT_Int result;
@@ -725,15 +726,21 @@
}
else /* general case */
{
+
#ifdef FT_LONG64
- FT_Int64 delta = (long long)in_x * out_y - (long long)in_y * out_x;
+
+ FT_Int64 delta = (FT_Int64)in_x * out_y - (FT_Int64)in_y * out_x;
+
if ( delta == 0 )
result = 0;
else
result = 1 - 2 * ( delta < 0 );
+
#else
- FT_Int64 z1, z2;
+
+ FT_Int64 z1, z2;
+
ft_multo64( in_x, out_y, &z1 );
ft_multo64( in_y, out_x, &z2 );
@@ -748,6 +755,7 @@
result = -1;
else
result = 0;
+
#endif
}
@@ -755,6 +763,8 @@
}
+ /* documentation is in ftcalc.h */
+
FT_BASE_DEF( FT_Int )
ft_corner_is_flat( FT_Pos in_x,
FT_Pos in_y,
@@ -791,4 +801,6 @@
return ( d_in + d_out - d_corner ) < ( d_corner >> 4 );
}
+
+
/* END */
diff --git a/src/pshinter/pshalgo.c b/src/pshinter/pshalgo.c
index 82771f4..2c29d96 100644
--- a/src/pshinter/pshalgo.c
+++ b/src/pshinter/pshalgo.c
@@ -886,6 +886,7 @@
#define psh_corner_orientation ft_corner_orientation
#else
+
FT_LOCAL_DEF( FT_Int )
psh_corner_is_flat( FT_Pos x_in,
FT_Pos y_in,
@@ -974,7 +975,8 @@
return result;
}
-#endif
+#endif /* !1 */
+
#ifdef COMPUTE_INFLEXS