|
|
|
@ -198,7 +198,7 @@ |
|
|
|
|
AF_LatinBlue blue; |
|
|
|
|
FT_Error error; |
|
|
|
|
AF_LatinAxis axis = &metrics->axis[AF_DIMENSION_VERT]; |
|
|
|
|
FT_GlyphSlot glyph = face->glyph; |
|
|
|
|
FT_Outline outline; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* we compute the blues simply by loading each character from the */ |
|
|
|
@ -225,7 +225,7 @@ |
|
|
|
|
{ |
|
|
|
|
FT_UInt glyph_index; |
|
|
|
|
FT_Pos best_y; /* same as points.y */ |
|
|
|
|
FT_Int best_point, best_first, best_last; |
|
|
|
|
FT_Int best_point, best_contour_first, best_contour_last; |
|
|
|
|
FT_Vector* points; |
|
|
|
|
FT_Bool round = 0; |
|
|
|
|
|
|
|
|
@ -235,16 +235,17 @@ |
|
|
|
|
if ( glyph_index == 0 ) |
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE ); |
|
|
|
|
if ( error || glyph->outline.n_points <= 0 ) |
|
|
|
|
error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE ); |
|
|
|
|
outline = face->glyph->outline; |
|
|
|
|
if ( error || outline.n_points <= 0 ) |
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
/* now compute min or max point indices and coordinates */ |
|
|
|
|
points = glyph->outline.points; |
|
|
|
|
best_point = -1; |
|
|
|
|
best_y = 0; /* make compiler happy */ |
|
|
|
|
best_first = 0; /* ditto */ |
|
|
|
|
best_last = 0; /* ditto */ |
|
|
|
|
points = outline.points; |
|
|
|
|
best_point = -1; |
|
|
|
|
best_y = 0; /* make compiler happy */ |
|
|
|
|
best_contour_first = 0; /* ditto */ |
|
|
|
|
best_contour_last = 0; /* ditto */ |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
FT_Int nn; |
|
|
|
@ -252,15 +253,13 @@ |
|
|
|
|
FT_Int last = -1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for ( nn = 0; |
|
|
|
|
nn < glyph->outline.n_contours; |
|
|
|
|
first = last + 1, nn++ ) |
|
|
|
|
for ( nn = 0; nn < outline.n_contours; first = last + 1, nn++ ) |
|
|
|
|
{ |
|
|
|
|
FT_Int old_best_point = best_point; |
|
|
|
|
FT_Int pp; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
last = glyph->outline.contours[nn]; |
|
|
|
|
last = outline.contours[nn]; |
|
|
|
|
|
|
|
|
|
/* Avoid single-point contours since they are never rasterized. */ |
|
|
|
|
/* In some fonts, they correspond to mark attachment points */ |
|
|
|
@ -289,8 +288,8 @@ |
|
|
|
|
|
|
|
|
|
if ( best_point != old_best_point ) |
|
|
|
|
{ |
|
|
|
|
best_first = first; |
|
|
|
|
best_last = last; |
|
|
|
|
best_contour_first = first; |
|
|
|
|
best_contour_last = last; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
FT_TRACE5(( " %c %ld", *p, best_y )); |
|
|
|
@ -313,10 +312,10 @@ |
|
|
|
|
|
|
|
|
|
do |
|
|
|
|
{ |
|
|
|
|
if ( prev > best_first ) |
|
|
|
|
if ( prev > best_contour_first ) |
|
|
|
|
prev--; |
|
|
|
|
else |
|
|
|
|
prev = best_last; |
|
|
|
|
prev = best_contour_last; |
|
|
|
|
|
|
|
|
|
dist = FT_ABS( points[prev].y - best_y ); |
|
|
|
|
/* accept a small distance or a small angle (both values are */ |
|
|
|
@ -329,10 +328,10 @@ |
|
|
|
|
|
|
|
|
|
do |
|
|
|
|
{ |
|
|
|
|
if ( next < best_last ) |
|
|
|
|
if ( next < best_contour_last ) |
|
|
|
|
next++; |
|
|
|
|
else |
|
|
|
|
next = best_first; |
|
|
|
|
next = best_contour_first; |
|
|
|
|
|
|
|
|
|
dist = FT_ABS( points[next].y - best_y ); |
|
|
|
|
if ( dist > 5 ) |
|
|
|
@ -343,8 +342,8 @@ |
|
|
|
|
|
|
|
|
|
/* now set the `round' flag depending on the segment's kind */ |
|
|
|
|
round = FT_BOOL( |
|
|
|
|
FT_CURVE_TAG( glyph->outline.tags[prev] ) != FT_CURVE_TAG_ON || |
|
|
|
|
FT_CURVE_TAG( glyph->outline.tags[next] ) != FT_CURVE_TAG_ON ); |
|
|
|
|
FT_CURVE_TAG( outline.tags[prev] ) != FT_CURVE_TAG_ON || |
|
|
|
|
FT_CURVE_TAG( outline.tags[next] ) != FT_CURVE_TAG_ON ); |
|
|
|
|
|
|
|
|
|
FT_TRACE5(( " (%s)\n", round ? "round" : "flat" )); |
|
|
|
|
} |
|
|
|
|