* src/cff/cffgload.c, src/psaux/t1decode.c, src/pshinter/pshrec.c, src/pshinter/ahalgo2.c, src/pshinter/pshglob.h: fixed a bug where the X and Y axis where inversed in the postscript hinter. this caused problem when displaying on non-square surfaces..
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
diff --git a/ChangeLog b/ChangeLog
index 699a553..2aca5fb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2001-12-21 David Turner <david@freetype.org>
+ * src/cff/cffgload.c, src/psaux/t1decode.c, src/pshinter/pshrec.c,
+ src/pshinter/ahalgo2.c, src/pshinter/pshglob.h: fixed a bug where
+ the X and Y axis where inversed in the postscript hinter. this
+ caused problem when displaying on non-square surfaces..
+
* include/freetype/cache/ftcmanag.h, include/freetype/cache/ftcimage.h,
include/freetype/cache/ftcsbits.h: updating documentation to better
explain the use of the "anode" output parameter in lookup functions
diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c
index 2004b8a..9a1d45f 100644
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -1080,7 +1080,7 @@
if ( hinter )
hinter->stems( hinter->hints,
- ( op == cff_op_vstem || op == cff_op_vstemhm ),
+ ( op == cff_op_hstem || op == cff_op_hstemhm ),
num_args / 2,
args );
@@ -1097,7 +1097,7 @@
{
if ( hinter )
hinter->stems( hinter->hints,
- 1,
+ 0,
num_args / 2,
args );
diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c
index 36c6054..7280781 100644
--- a/src/psaux/t1decode.c
+++ b/src/psaux/t1decode.c
@@ -1014,7 +1014,7 @@
if ( hinter )
{
/* top[0] += builder->left_bearing.y; */
- hinter->stem( hinter->hints, 0, top );
+ hinter->stem( hinter->hints, 1, top );
}
break;
@@ -1024,7 +1024,7 @@
/* record horizontal counter-controlled hints */
if ( hinter )
- hinter->stem3( hinter->hints, 0, top );
+ hinter->stem3( hinter->hints, 1, top );
break;
@@ -1035,7 +1035,7 @@
if ( hinter )
{
top[0] += orig_x;
- hinter->stem( hinter->hints, 1, top );
+ hinter->stem( hinter->hints, 0, top );
}
break;
@@ -1051,7 +1051,7 @@
top[0] += dx;
top[2] += dx;
top[4] += dx;
- hinter->stem3( hinter->hints, 1, top );
+ hinter->stem3( hinter->hints, 0, top );
}
break;
diff --git a/src/pshinter/pshalgo2.c b/src/pshinter/pshalgo2.c
index 6b27ec6..a10da1b 100644
--- a/src/pshinter/pshalgo2.c
+++ b/src/pshinter/pshalgo2.c
@@ -330,7 +330,7 @@
ps2_simple_scale( PSH2_Hint_Table table,
FT_Fixed scale,
FT_Fixed delta,
- FT_Int vertical )
+ FT_Int dimension )
{
PSH2_Hint hint;
FT_UInt count;
@@ -344,7 +344,7 @@
hint->cur_len = FT_MulFix( hint->org_len, scale );
if ( ps2_debug_hint_func )
- ps2_debug_hint_func( hint, vertical );
+ ps2_debug_hint_func( hint, dimension );
}
}
#endif
@@ -353,9 +353,9 @@
static void
psh2_hint_align( PSH2_Hint hint,
PSH_Globals globals,
- FT_Int vertical )
+ FT_Int dimension )
{
- PSH_Dimension dim = &globals->dimension[vertical];
+ PSH_Dimension dim = &globals->dimension[dimension];
FT_Fixed scale = dim->scale_mult;
FT_Fixed delta = dim->scale_delta;
@@ -388,7 +388,7 @@
align.align = 0;
align.align_bot = align.align_top = 0;
- if ( !vertical )
+ if ( dimension == 1 )
psh_blues_snap_stem( &globals->blues,
hint->org_pos + hint->org_len,
hint->org_pos,
@@ -425,7 +425,7 @@
/* ensure that parent is already fitted */
if ( !psh2_hint_is_fitted( parent ) )
- psh2_hint_align( parent, globals, vertical );
+ psh2_hint_align( parent, globals, dimension );
par_org_center = parent->org_pos + ( parent->org_len / 2);
par_cur_center = parent->cur_pos + ( parent->cur_len / 2);
@@ -461,7 +461,7 @@
#ifdef DEBUG_HINTER
if ( ps2_debug_hint_func )
- ps2_debug_hint_func( hint, vertical );
+ ps2_debug_hint_func( hint, dimension );
#endif
}
}
@@ -470,26 +470,26 @@
static void
psh2_hint_table_align_hints( PSH2_Hint_Table table,
PSH_Globals globals,
- FT_Int vertical )
+ FT_Int dimension )
{
PSH2_Hint hint;
FT_UInt count;
#ifdef DEBUG_HINTER
- PSH_Dimension dim = &globals->dimension[vertical];
+ PSH_Dimension dim = &globals->dimension[dimension];
FT_Fixed scale = dim->scale_mult;
FT_Fixed delta = dim->scale_delta;
- if ( ps_debug_no_vert_hints && vertical )
+ if ( ps_debug_no_vert_hints && dimension == 0 )
{
- ps2_simple_scale( table, scale, delta, vertical );
+ ps2_simple_scale( table, scale, delta, dimension );
return;
}
- if ( ps_debug_no_horz_hints && !vertical )
+ if ( ps_debug_no_horz_hints && dimension == 1 )
{
- ps2_simple_scale( table, scale, delta, vertical );
+ ps2_simple_scale( table, scale, delta, dimension );
return;
}
#endif
@@ -498,7 +498,7 @@
count = table->max_hints;
for ( ; count > 0; count--, hint++ )
- psh2_hint_align( hint, globals, vertical );
+ psh2_hint_align( hint, globals, dimension );
}
@@ -688,13 +688,13 @@
psh2_hint_table_tune_outline( PSH2_Hint_Table table,
FT_Outline* outline,
PSH_Globals globals,
- FT_Int vertical )
+ FT_Int dimension )
{
FT_UInt count, first, last;
PS_Mask_Table hint_masks = table->hint_masks;
PS_Mask mask;
- PSH_Dimension dim = &globals->dimension[vertical];
+ PSH_Dimension dim = &globals->dimension[dimension];
FT_Fixed scale = dim->scale_mult;
FT_Fixed delta = dim->scale_delta;
@@ -716,7 +716,7 @@
psh2_hint_table_activate_mask( table, mask );
- psh2_hint_table_optimize( table, globals, outline, vertical );
+ psh2_hint_table_optimize( table, globals, outline, dimension );
psh2_hint_table_setup_zones( table, scale, delta );
last = mask->end_point;
@@ -728,7 +728,7 @@
FT_Pos x, *px;
- px = vertical ? &vec->x : &vec->y;
+ px = dimension ? &vec->y : &vec->x;
x = *px;
*px = psh2_hint_table_tune_coord( table, (FT_Int)x );
@@ -746,7 +746,7 @@
vec = outline->points;
count = outline->n_points;
- if ( vertical )
+ if ( dimension == 0 )
{
for ( ; count > 0; count--, vec++ )
vec->x = FT_MulFix( vec->x, scale ) + delta;
@@ -999,7 +999,7 @@
/* load outline point coordinates into hinter glyph */
static void
psh2_glyph_load_points( PSH2_Glyph glyph,
- FT_Int vertical )
+ FT_Int dimension )
{
FT_Vector* vec = glyph->outline->points;
PSH2_Point point = glyph->points;
@@ -1010,7 +1010,7 @@
{
point->flags &= PSH2_POINT_OFF | PSH2_POINT_SMOOTH;
point->hint = 0;
- if ( vertical )
+ if ( dimension == 0 )
point->org_u = vec->x;
else
point->org_u = vec->y;
@@ -1026,7 +1026,7 @@
/* save hinted point coordinates back to outline */
static void
psh2_glyph_save_points( PSH2_Glyph glyph,
- FT_Int vertical )
+ FT_Int dimension )
{
FT_UInt n;
PSH2_Point point = glyph->points;
@@ -1036,16 +1036,16 @@
for ( n = 0; n < glyph->num_points; n++ )
{
- if ( vertical )
+ if ( dimension == 0 )
vec[n].x = point->cur_u;
else
vec[n].y = point->cur_u;
if ( psh2_point_is_strong( point ) )
- tags[n] |= vertical ? 32 : 64;
+ tags[n] |= (dimension == 0) ? 32 : 64;
#ifdef DEBUG_HINTER
- if ( vertical )
+ if ( dimension == 0 )
{
point->cur_x = point->cur_u;
point->flags_x = point->flags;
@@ -1115,16 +1115,16 @@
/* find strong points in a glyph */
static void
psh2_glyph_find_strong_points( PSH2_Glyph glyph,
- FT_Int vertical )
+ FT_Int dimension )
{
/* a point is strong if it is located on a stem */
/* edge and has an "in" or "out" tangent to the hint's direction */
{
- PSH2_Hint_Table table = &glyph->hint_tables[vertical];
+ PSH2_Hint_Table table = &glyph->hint_tables[dimension];
PS_Mask mask = table->hint_masks->masks;
FT_UInt num_masks = table->hint_masks->num_masks;
FT_UInt first = 0;
- FT_Int major_dir = vertical ? PSH2_DIR_UP : PSH2_DIR_RIGHT;
+ FT_Int major_dir = dimension == 0 ? PSH2_DIR_UP : PSH2_DIR_RIGHT;
/* process secondary hints to "selected" points */
@@ -1186,9 +1186,9 @@
/* interpolate strong points with the help of hinted coordinates */
static void
psh2_glyph_interpolate_strong_points( PSH2_Glyph glyph,
- FT_Int vertical )
+ FT_Int dimension )
{
- PSH_Dimension dim = &glyph->globals->dimension[vertical];
+ PSH_Dimension dim = &glyph->globals->dimension[dimension];
FT_Fixed scale = dim->scale_mult;
@@ -1231,10 +1231,10 @@
static void
psh2_glyph_interpolate_normal_points( PSH2_Glyph glyph,
- FT_Int vertical )
+ FT_Int dimension )
{
#if 1
- PSH_Dimension dim = &glyph->globals->dimension[vertical];
+ PSH_Dimension dim = &glyph->globals->dimension[dimension];
FT_Fixed scale = dim->scale_mult;
@@ -1344,9 +1344,9 @@
/* interpolate other points */
static void
psh2_glyph_interpolate_other_points( PSH2_Glyph glyph,
- FT_Int vertical )
+ FT_Int dimension )
{
- PSH_Dimension dim = &glyph->globals->dimension[vertical];
+ PSH_Dimension dim = &glyph->globals->dimension[dimension];
FT_Fixed scale = dim->scale_mult;
FT_Fixed delta = dim->scale_delta;
PSH2_Contour contour = glyph->contours;
@@ -1520,7 +1520,7 @@
if ( error )
goto Exit;
- for ( dimension = 1; dimension >= 0; dimension-- )
+ for ( dimension = 0; dimension < 2; dimension++ )
{
/* load outline coordinates into glyph */
psh2_glyph_load_points( glyph, dimension );
diff --git a/src/pshinter/pshglob.h b/src/pshinter/pshglob.h
index 569e6e7..1058fb1 100644
--- a/src/pshinter/pshglob.h
+++ b/src/pshinter/pshglob.h
@@ -129,7 +129,9 @@ FT_BEGIN_HEADER
} PSH_BluesRec, *PSH_Blues;
- /* font globals */
+ /* font globals. */
+ /* dimension 0 => X coordinates + vertical hints/stems */
+ /* dimension 1 => Y coordinates + horizontal hints/stems */
typedef struct PSH_GlobalsRec_
{
FT_Memory memory;
diff --git a/src/pshinter/pshrec.h b/src/pshinter/pshrec.h
index fb5309f..a939bea 100644
--- a/src/pshinter/pshrec.h
+++ b/src/pshinter/pshrec.h
@@ -129,7 +129,9 @@ FT_BEGIN_HEADER
#define PS_HINTS_MAGIC 0x68696e74 /* "hint" */
- /* glyph hints descriptor */
+ /* glyph hints descriptor */
+ /* dimension 0 => X coordinates + vertical hints/stems */
+ /* dimension 1 => Y coordinates + horizontal hints/stems */
typedef struct PS_HintsRec_
{
FT_Memory memory;