21#include FT_INTERNAL_DEBUG_H
28#ifdef AF_CONFIG_OPTION_USE_WARPER
40#define FT_COMPONENT aflatin
44#define FLAT_THRESHOLD( x ) ( x / 14 )
73 "latin standard widths computation (style `%s')\n"
74 "=====================================================\n"
76 af_style_names[
metrics->root.style_class->style] ));
102#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
106 void* shaper_buf = &shaper_buf_;
111#ifdef FT_DEBUG_LEVEL_TRACE
118#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
131 unsigned int num_idx;
133#ifdef FT_DEBUG_LEVEL_TRACE
141#ifdef FT_DEBUG_LEVEL_TRACE
166 FT_TRACE5((
"standard character: U+%04lX (glyph index %d)\n",
170 if (
error ||
face->glyph->outline.n_points <= 0 )
219 for ( ; seg <
limit; seg++ )
234 axis->
widths[num_widths++].org = dist;
241 dummy->units_per_em / 100 );
260#ifdef FT_DEBUG_LEVEL_TRACE
304 for (
j =
i;
j > 0;
j-- )
359#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
363 void* shaper_buf = &shaper_buf_;
370 FT_TRACE5((
"latin blue zones computation\n"
371 "============================\n"
374#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
387#ifdef FT_DEBUG_LEVEL_TRACE
394 if (
bs->properties )
448 FT_Int best_point, best_contour_first, best_contour_last;
454 unsigned int i, num_idx;
456#ifdef FT_DEBUG_LEVEL_TRACE
465#ifdef FT_DEBUG_LEVEL_TRACE
474 FT_TRACE5((
" U+%04lX unavailable\n", ch ));
485 for (
i = 0;
i < num_idx;
i++ )
497 if ( glyph_index == 0 )
499 FT_TRACE5((
" U+%04lX unavailable\n", ch ));
508#ifdef FT_DEBUG_LEVEL_TRACE
510 FT_TRACE5((
" U+%04lX contains no (usable) outlines\n", ch ));
512 FT_TRACE5((
" component %d of cluster starting with U+%04lX"
513 " contains no (usable) outlines\n",
i, ch ));
522 best_contour_first = 0;
523 best_contour_last = 0;
533 FT_Int old_best_point = best_point;
551 if ( best_point < 0 ||
points[pp].
y > best_y )
555 ascender =
FT_MAX( ascender, best_y + y_offset );
565 if ( best_point < 0 ||
points[pp].
y < best_y )
569 descender =
FT_MIN( descender, best_y + y_offset );
576 if ( best_point != old_best_point )
578 best_contour_first =
first;
579 best_contour_last =
last;
587 if ( best_point >= 0 )
591 FT_Int best_segment_first, best_segment_last;
592 FT_Int best_on_point_first, best_on_point_last;
596 best_segment_first = best_point;
597 best_segment_last = best_point;
601 best_on_point_first = best_point;
602 best_on_point_last = best_point;
606 best_on_point_first = -1;
607 best_on_point_last = -1;
618 if ( prev > best_contour_first )
621 prev = best_contour_last;
630 best_segment_first = prev;
634 best_on_point_first = prev;
635 if ( best_on_point_last < 0 )
636 best_on_point_last = prev;
639 }
while ( prev != best_point );
643 if (
next < best_contour_last )
646 next = best_contour_first;
653 best_segment_last =
next;
657 best_on_point_last =
next;
658 if ( best_on_point_first < 0 )
659 best_on_point_first =
next;
662 }
while (
next != best_point );
685 points[best_segment_first].
x );
687 if ( dist < length_threshold &&
688 best_segment_last - best_segment_first + 2 <=
689 best_contour_last - best_contour_first )
713 if ( prev > best_contour_first )
716 prev = best_contour_last;
718 if (
points[prev].
x != best_x )
721 }
while ( prev != best_point );
724 if ( prev == best_point )
729 first = best_segment_last;
760 if (
last < best_contour_last )
763 last = best_contour_first;
792 if ( l2r == left2right &&
793 d >= length_threshold )
799 if (
last < best_contour_last )
802 last = best_contour_first;
809 if (
last > best_contour_first )
812 last = best_contour_last;
826 }
while (
last != best_segment_first );
830 best_segment_first =
first;
831 best_segment_last =
last;
833 best_on_point_first = p_first;
834 best_on_point_last = p_last;
839 }
while (
last != best_segment_first );
849#ifdef FT_DEBUG_LEVEL_TRACE
851 FT_TRACE5((
" U+%04lX: best_y = %5ld", ch, best_y ));
853 FT_TRACE5((
" component %d of cluster starting with U+%04lX:"
854 " best_y = %5ld",
i, ch, best_y ));
865 if ( best_on_point_first >= 0 &&
866 best_on_point_last >= 0 &&
868 points[best_on_point_first].
x ) ) >
890 if ( best_y > best_y_extremum )
892 best_y_extremum = best_y;
898 if ( best_y < best_y_extremum )
900 best_y_extremum = best_y;
911 rounds[num_rounds++] = best_y_extremum;
913 flats[num_flats++] = best_y_extremum;
918 if ( num_flats == 0 && num_rounds == 0 )
936 blue_shoot = &
blue->shoot.org;
940 if ( num_flats == 0 )
943 *blue_shoot = rounds[num_rounds / 2];
945 else if ( num_rounds == 0 )
948 *blue_shoot = flats[num_flats / 2];
952 *blue_ref = flats [num_flats / 2];
953 *blue_shoot = rounds[num_rounds / 2];
959 if ( *blue_shoot != *blue_ref )
962 FT_Pos shoot = *blue_shoot;
970 *blue_shoot = ( shoot +
ref ) / 2;
972 FT_TRACE5((
" [overshoot smaller than reference,"
973 " taking mean value]\n" ));
977 blue->ascender = ascender;
978 blue->descender = descender;
997 " overshoot = %ld\n",
998 *blue_ref, *blue_shoot ));
1013 blue_sorted[
i] = &axis->
blues[
i];
1024#ifdef FT_DEBUG_LEVEL_TRACE
1032 a = &blue_sorted[
i]->
shoot.org;
1033#ifdef FT_DEBUG_LEVEL_TRACE
1038 a = &blue_sorted[
i]->
ref.org;
1042 b = &blue_sorted[
i + 1]->
shoot.org;
1044 b = &blue_sorted[
i + 1]->
ref.org;
1050 " adjusting %s %d to %ld\n",
1051 a_is_top ?
"overshoot" :
"reference",
1052 blue_sorted[
i] - axis->
blues,
1070 FT_Bool started = 0, same_width = 1;
1075#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
1079 void* shaper_buf = &shaper_buf_;
1083 const char digits[] =
"0 1 2 3 4 5 6 7 8 9";
1089#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
1096 unsigned int num_idx;
1129 metrics->root.digits_have_same_width = same_width;
1217 ppem =
metrics->root.scaler.face->size->metrics.x_ppem;
1228 fitted = ( scaled + threshold ) & ~63;
1230 if ( scaled != fitted )
1235 if ( fitted < scaled )
1250 max_height =
metrics->units_per_em;
1264 "af_latin_metrics_scale_dim:"
1265 " x height alignment (style `%s'):\n"
1267 " vertical scaling changed from %.5f to %.5f (by %d%%)\n"
1269 af_style_names[
metrics->root.style_class->style],
1271 new_scale / 65536.0,
1272 ( fitted - scaled ) * 100 / scaled ));
1276#ifdef FT_DEBUG_LEVEL_TRACE
1280 "af_latin_metrics_scale_dim:"
1281 " x height alignment (style `%s'):\n"
1283 " excessive vertical scaling abandoned\n"
1285 af_style_names[
metrics->root.style_class->style] ));
1294 axis->
delta = delta;
1299 metrics->root.scaler.x_delta = delta;
1304 metrics->root.scaler.y_delta = delta;
1309 af_style_names[
metrics->root.style_class->style] ));
1322 width->cur / 64.0 ));
1332#ifdef FT_DEBUG_LEVEL_TRACE
1334 FT_TRACE5((
"`%s' style is extra light (at current resolution)\n"
1336 af_style_names[
metrics->root.style_class->style] ));
1341#ifdef FT_DEBUG_LEVEL_TRACE
1343 FT_TRACE5((
"blue zones (style `%s')\n",
1344 af_style_names[
metrics->root.style_class->style] ));
1358 blue->flags &= ~AF_LATIN_BLUE_ACTIVE;
1362 if ( dist <= 48 && dist >= -48 )
1375 delta1 =
blue->shoot.org -
blue->ref.org;
1384 else if ( delta2 < 64 )
1385 delta2 = 32 + ( ( ( delta2 - 32 ) + 16 ) & ~31 );
1393 blue->shoot.fit =
blue->ref.fit + delta2;
1404 else if ( delta2 < 48 )
1413 blue->shoot.fit =
blue->ref.fit - delta2;
1446 if (
b->ref.fit <=
blue->shoot.fit &&
1447 b->shoot.fit >=
blue->ref.fit )
1455#ifdef FT_DEBUG_LEVEL_TRACE
1461 FT_TRACE5((
" reference %d: %d scaled to %.2f%s\n"
1462 " overshoot %d: %d scaled to %.2f%s\n",
1465 blue->ref.fit / 64.0,
1470 blue->shoot.fit / 64.0,
1485 metrics->root.scaler.render_mode = scaler->render_mode;
1486 metrics->root.scaler.face = scaler->face;
1487 metrics->root.scaler.flags = scaler->flags;
1543 segment_dir = major_dir;
1545 axis->num_segments = 0;
1574 for ( ; contour < contour_limit; contour++ )
1585 FT_Pos min_coord = 32000;
1586 FT_Pos max_coord = -32000;
1589 FT_Pos min_on_coord = 32000;
1590 FT_Pos max_on_coord = -32000;
1596 FT_Pos prev_min_pos = min_pos;
1597 FT_Pos prev_max_pos = max_pos;
1598 FT_Pos prev_min_coord = min_coord;
1599 FT_Pos prev_max_coord = max_coord;
1602 FT_Pos prev_min_on_coord = min_on_coord;
1603 FT_Pos prev_max_on_coord = max_on_coord;
1644 if (
v < min_coord )
1647 min_flags =
point->flags;
1649 if (
v > max_coord )
1652 max_flags =
point->flags;
1659 if (
v < min_on_coord )
1661 if (
v > max_on_coord )
1671 if ( !prev_segment || segment->
first != prev_segment->
last )
1676 segment->last =
point;
1677 segment->pos = (
FT_Short)( ( min_pos + max_pos ) >> 1 );
1678 segment->delta = (
FT_Short)( ( max_pos - min_pos ) >> 1 );
1684 ( max_on_coord - min_on_coord ) < flat_threshold )
1687 segment->min_coord = (
FT_Short)min_coord;
1688 segment->max_coord = (
FT_Short)max_coord;
1689 segment->height = segment->max_coord - segment->min_coord;
1691 prev_segment = segment;
1692 prev_min_pos = min_pos;
1693 prev_max_pos = max_pos;
1694 prev_min_coord = min_coord;
1695 prev_max_coord = max_coord;
1696 prev_min_flags = min_flags;
1697 prev_max_flags = max_flags;
1698 prev_min_on_coord = min_on_coord;
1699 prev_max_on_coord = max_on_coord;
1716 if ( prev_min_pos < min_pos )
1717 min_pos = prev_min_pos;
1718 if ( prev_max_pos > max_pos )
1719 max_pos = prev_max_pos;
1721 if ( prev_min_coord < min_coord )
1723 min_coord = prev_min_coord;
1724 min_flags = prev_min_flags;
1726 if ( prev_max_coord > max_coord )
1728 max_coord = prev_max_coord;
1729 max_flags = prev_max_flags;
1732 if ( prev_min_on_coord < min_on_coord )
1733 min_on_coord = prev_min_on_coord;
1734 if ( prev_max_on_coord > max_on_coord )
1735 max_on_coord = prev_max_on_coord;
1744 ( max_on_coord - min_on_coord ) < flat_threshold )
1747 prev_segment->
flags &= ~AF_EDGE_ROUND;
1759 if (
FT_ABS( prev_max_coord - prev_min_coord ) >
1760 FT_ABS( max_coord - min_coord ) )
1764 if ( min_pos < prev_min_pos )
1765 prev_min_pos = min_pos;
1766 if ( max_pos > prev_max_pos )
1767 prev_max_pos = max_pos;
1771 prev_max_pos ) >> 1 );
1773 prev_min_pos ) >> 1 );
1779 if ( prev_min_pos < min_pos )
1780 min_pos = prev_min_pos;
1781 if ( prev_max_pos > max_pos )
1782 max_pos = prev_max_pos;
1784 segment->last =
point;
1785 segment->pos = (
FT_Short)( ( min_pos + max_pos ) >> 1 );
1786 segment->delta = (
FT_Short)( ( max_pos - min_pos ) >> 1 );
1789 ( max_on_coord - min_on_coord ) < flat_threshold )
1792 segment->min_coord = (
FT_Short)min_coord;
1793 segment->max_coord = (
FT_Short)max_coord;
1794 segment->height = segment->max_coord -
1797 *prev_segment = *segment;
1799 prev_min_pos = min_pos;
1800 prev_max_pos = max_pos;
1801 prev_min_coord = min_coord;
1802 prev_max_coord = max_coord;
1803 prev_min_flags = min_flags;
1804 prev_max_flags = max_flags;
1805 prev_min_on_coord = min_on_coord;
1806 prev_max_on_coord = max_on_coord;
1810 axis->num_segments--;
1845 segment->dir = (
FT_Char)segment_dir;
1846 segment->first =
point;
1847 segment->last =
point;
1852 prev_segment = segment - 1;
1854 min_pos = max_pos =
point->u;
1855 min_coord = max_coord =
point->v;
1856 min_flags = max_flags =
point->flags;
1860 min_on_coord = 32000;
1861 max_on_coord = -32000;
1864 min_on_coord = max_on_coord =
point->v;
1880 segment->height = 0;
1897 AF_Segment segments_end = segments + axis->num_segments;
1900 for ( segment = segments; segment < segments_end; segment++ )
1908 if ( first_v < last_v )
1914 if (
p->v < first_v )
1915 segment->height = (
FT_Short)( segment->height +
1916 ( ( first_v -
p->v ) >> 1 ) );
1919 if (
p->v > last_v )
1920 segment->height = (
FT_Short)( segment->height +
1921 ( (
p->v - last_v ) >> 1 ) );
1929 if (
p->v > first_v )
1930 segment->height = (
FT_Short)( segment->height +
1931 ( (
p->v - first_v ) >> 1 ) );
1934 if (
p->v < last_v )
1935 segment->height = (
FT_Short)( segment->height +
1936 ( ( last_v -
p->v ) >> 1 ) );
1958 FT_Pos len_threshold, len_score, dist_score, max_width;
1963 max_width = widths[width_count - 1].org;
1969 if ( len_threshold == 0 )
1981 for ( seg1 = segments; seg1 < segment_limit; seg1++ )
1988 for ( seg2 = segments; seg2 < segment_limit; seg2++ )
1994 if ( seg1->
dir + seg2->
dir == 0 && pos2 > pos1 )
2002 if ( min < seg2->min_coord )
2011 if (
len >= len_threshold )
2027 FT_Pos dist = pos2 - pos1;
2029 FT_Pos dist_demerit, score;
2036 FT_Pos delta = ( dist << 10 ) / max_width - ( 1 << 10 );
2039 if ( delta > 10000 )
2040 dist_demerit = 32000;
2041 else if ( delta > 0 )
2042 dist_demerit = delta * delta / dist_score;
2047 dist_demerit = dist;
2049 score = dist_demerit + len_score /
len;
2052 if ( score < seg1->score )
2054 seg1->
score = score;
2058 if ( score < seg2->score )
2060 seg2->
score = score;
2069 for ( seg1 = segments; seg1 < segment_limit; seg1++ )
2075 if ( seg2->
link != seg1 )
2099 FT_Bool top_to_bottom_hinting = 0;
2109 FT_Pos edge_distance_threshold;
2110 FT_Pos segment_length_threshold;
2111 FT_Pos segment_width_threshold;
2135 segment_length_threshold = 0;
2162 if ( edge_distance_threshold > 64 / 4 )
2163 edge_distance_threshold = 64 / 4;
2165 edge_distance_threshold =
FT_DivFix( edge_distance_threshold,
2168 for ( seg = segments; seg < segment_limit; seg++ )
2176 if ( seg->
height < segment_length_threshold ||
2177 seg->
delta > segment_width_threshold ||
2184 2 * seg->
height < 3 * segment_length_threshold )
2188 for ( ee = 0; ee < axis->
num_edges; ee++ )
2198 if ( dist < edge_distance_threshold && edge->
dir == seg->
dir )
2214 top_to_bottom_hinting,
2242 for ( seg = segments; seg < segment_limit; seg++ )
2252 for ( ee = 0; ee < axis->
num_edges; ee++ )
2262 if ( dist < edge_distance_threshold )
2305 for ( edge = edges; edge < edge_limit; edge++ )
2314 }
while ( seg != edge->
first );
2318 for ( edge = edges; edge < edge_limit; edge++ )
2343 if ( seg->
dir == up_dir )
2367 edge2 = edge->
serif;
2376 edge_delta = edge->
fpos - edge2->
fpos;
2377 if ( edge_delta < 0 )
2378 edge_delta = -edge_delta;
2380 seg_delta = seg->
pos - seg2->
pos;
2381 if ( seg_delta < 0 )
2382 seg_delta = -seg_delta;
2384 if ( seg_delta < edge_delta )
2392 edge->
serif = edge2;
2401 }
while ( seg != edge->
first );
2406 if ( is_round > 0 && is_round >= is_straight )
2416 else if ( ups < downs )
2419 else if ( ups == downs )
2477 for ( ; edge < edge_limit; edge++ )
2481 FT_Bool best_blue_is_neutral = 0;
2490 if ( best_dist > 64 / 2 )
2496 FT_Bool is_top_blue, is_neutral_blue, is_major_dir;
2516 if ( is_top_blue ^ is_major_dir || is_neutral_blue )
2527 if ( dist < best_dist )
2530 best_blue = &
blue->ref;
2531 best_blue_is_neutral = is_neutral_blue;
2546 if ( is_top_blue ^ is_under_ref )
2548 dist = edge->
fpos -
blue->shoot.org;
2553 if ( dist < best_dist )
2556 best_blue = &
blue->shoot;
2557 best_blue_is_neutral = is_neutral_blue;
2567 if ( best_blue_is_neutral )
2581 FT_UInt32 scaler_flags, other_flags;
2604 scaler_flags =
hints->scaler_flags;
2641#ifdef AF_CONFIG_OPTION_USE_WARPER
2643 if ( !
metrics->root.globals->module->warping )
2647 hints->scaler_flags = scaler_flags;
2648 hints->other_flags = other_flags;
2671 FT_Pos best = 64 + 32 + 2;
2697 if (
width < scaled + 48 )
2702 if (
width > scaled - 48 )
2755 else if ( dist < 56 )
2758 if ( axis->width_count > 0 )
2764 delta = dist - axis->widths[0].cur;
2771 dist = axis->widths[0].cur;
2778 if ( dist < 3 * 64 )
2786 else if ( delta < 32 )
2789 else if ( delta < 54 )
2812 if ( ( (
width > 0 ) && ( base_delta > 0 ) ) ||
2813 ( (
width < 0 ) && ( base_delta < 0 ) ) )
2819 bdelta = base_delta;
2820 else if ( ppem < 30 )
2821 bdelta = ( base_delta * (
FT_Pos)( 30 - ppem ) ) / 20;
2827 dist = ( dist - bdelta + 32 ) & ~63;
2846 dist = ( dist + 16 ) & ~63;
2860 dist = ( dist + 32 ) & ~63;
2869 dist = ( dist + 64 ) >> 1;
2871 else if ( dist < 128 )
2882 dist = ( dist + 22 ) & ~63;
2883 delta = dist - org_dist;
2891 dist = ( dist + 64 ) >> 1;
2896 dist = ( dist + 32 ) & ~63;
2921 dist = stem_edge->
opos - base_edge->
opos;
2922 base_delta = base_edge->
pos - base_edge->
opos;
2930 stem_edge->
pos = base_edge->
pos + fitted_width;
2932 FT_TRACE5((
" LINK: edge %d (opos=%.2f) linked to %.2f,"
2933 " dist was %.2f, now %.2f\n",
2934 stem_edge -
hints->axis[dim].edges, stem_edge->
opos / 64.0,
2935 stem_edge->
pos / 64.0, dist / 64.0, fitted_width / 64.0 ));
2981 FT_Bool top_to_bottom_hinting = 0;
2983#ifdef FT_DEBUG_LEVEL_TRACE
2988 FT_TRACE5((
"latin %s edge hinting (style `%s')\n",
2990 af_style_names[
hints->metrics->style_class->style] ));
3000 for ( edge = edges; edge < edge_limit; edge++ )
3030 edge2->
flags &= ~AF_EDGE_NEUTRAL;
3035 edge->
flags &= ~AF_EDGE_NEUTRAL;
3054#ifdef FT_DEBUG_LEVEL_TRACE
3056 FT_TRACE5((
" BLUE_ANCHOR: edge %d (opos=%.2f) snapped to %.2f,"
3057 " was %.2f (anchor=edge %d)\n",
3058 edge1 - edges, edge1->
opos / 64.0,
blue->fit / 64.0,
3059 edge1->
pos / 64.0, edge - edges ));
3061 FT_TRACE5((
" BLUE: edge %d (opos=%.2f) snapped to %.2f,"
3063 edge1 - edges, edge1->
opos / 64.0,
blue->fit / 64.0,
3064 edge1->
pos / 64.0 ));
3077#ifdef FT_DEBUG_LEVEL_TRACE
3089 for ( edge = edges; edge < edge_limit; edge++ )
3110 FT_TRACE5((
" ASSERTION FAILED for edge %d\n", edge2 - edges ));
3115#ifdef FT_DEBUG_LEVEL_TRACE
3125 FT_Pos org_len, org_center, cur_len;
3129 org_len = edge2->
opos - edge->
opos;
3138 if ( cur_len <= 64 )
3153 org_center = edge->
opos + ( org_len >> 1 );
3156 error1 = org_center - ( cur_pos1 - u_off );
3160 error2 = org_center - ( cur_pos1 + d_off );
3169 edge->
pos = cur_pos1 - cur_len / 2;
3170 edge2->
pos = edge->
pos + cur_len;
3178 FT_TRACE5((
" ANCHOR: edge %d (opos=%.2f) and %d (opos=%.2f)"
3179 " snapped to %.2f and %.2f\n",
3180 edge - edges, edge->
opos / 64.0,
3181 edge2 - edges, edge2->
opos / 64.0,
3182 edge->
pos / 64.0, edge2->
pos / 64.0 ));
3186#ifdef FT_DEBUG_LEVEL_TRACE
3192 FT_Pos org_pos, org_len, org_center, cur_len;
3193 FT_Pos cur_pos1, cur_pos2, delta1, delta2;
3196 org_pos = anchor->
pos + ( edge->
opos - anchor->
opos );
3197 org_len = edge2->
opos - edge->
opos;
3198 org_center = org_pos + ( org_len >> 1 );
3207 FT_TRACE5((
" ADJUST: edge %d (pos=%.2f) moved to %.2f\n",
3208 edge - edges, edge->
pos / 64.0,
3209 ( edge2->
pos - cur_len ) / 64.0 ));
3211 edge->
pos = edge2->
pos - cur_len;
3214 else if ( cur_len < 96 )
3221 if ( cur_len <= 64 )
3232 delta1 = org_center - ( cur_pos1 - u_off );
3236 delta2 = org_center - ( cur_pos1 + d_off );
3240 if ( delta1 < delta2 )
3245 edge->
pos = cur_pos1 - cur_len / 2;
3246 edge2->
pos = cur_pos1 + cur_len / 2;
3248 FT_TRACE5((
" STEM: edge %d (opos=%.2f) linked to %d (opos=%.2f)"
3249 " snapped to %.2f and %.2f\n",
3250 edge - edges, edge->
opos / 64.0,
3251 edge2 - edges, edge2->
opos / 64.0,
3252 edge->
pos / 64.0, edge2->
pos / 64.0 ));
3257 org_pos = anchor->
pos + ( edge->
opos - anchor->
opos );
3258 org_len = edge2->
opos - edge->
opos;
3259 org_center = org_pos + ( org_len >> 1 );
3267 delta1 = cur_pos1 + ( cur_len >> 1 ) - org_center;
3271 cur_pos2 =
FT_PIX_ROUND( org_pos + org_len ) - cur_len;
3272 delta2 = cur_pos2 + ( cur_len >> 1 ) - org_center;
3276 edge->
pos = ( delta1 < delta2 ) ? cur_pos1 : cur_pos2;
3277 edge2->
pos = edge->
pos + cur_len;
3279 FT_TRACE5((
" STEM: edge %d (opos=%.2f) linked to %d (opos=%.2f)"
3280 " snapped to %.2f and %.2f\n",
3281 edge - edges, edge->
opos / 64.0,
3282 edge2 - edges, edge2->
opos / 64.0,
3283 edge->
pos / 64.0, edge2->
pos / 64.0 ));
3286#ifdef FT_DEBUG_LEVEL_TRACE
3293 if ( edge > edges &&
3294 ( top_to_bottom_hinting ? ( edge->
pos > edge[-1].
pos )
3295 : ( edge->
pos < edge[-1].
pos ) ) )
3301#ifdef FT_DEBUG_LEVEL_TRACE
3302 FT_TRACE5((
" BOUND: edge %d (pos=%.2f) moved to %.2f\n",
3305 edge[-1].
pos / 64.0 ));
3310 edge->
pos = edge[-1].
pos;
3331 n_edges = edge_limit - edges;
3354 span = dist1 - dist2;
3360 delta = edge3->
pos - ( 2 * edge2->
pos - edge1->
pos );
3361 edge3->
pos -= delta;
3366 if ( n_edges == 12 )
3368 ( edges + 8 )->
pos -= delta;
3369 ( edges + 11 )->
pos -= delta;
3378 if ( has_serifs || !anchor )
3384 for ( edge = edges; edge < edge_limit; edge++ )
3401 if ( delta < 64 + 16 )
3404 FT_TRACE5((
" SERIF: edge %d (opos=%.2f) serif to %d (opos=%.2f)"
3405 " aligned to %.2f\n",
3406 edge - edges, edge->
opos / 64.0,
3408 edge->
pos / 64.0 ));
3414 FT_TRACE5((
" SERIF_ANCHOR: edge %d (opos=%.2f)"
3415 " snapped to %.2f\n",
3416 edge-edges, edge->
opos / 64.0, edge->
pos / 64.0 ));
3432 after < edge_limit && after > edge )
3437 edge->pos =
before->pos +
3442 FT_TRACE5((
" SERIF_LINK1: edge %d (opos=%.2f) snapped to %.2f"
3443 " from %d (opos=%.2f)\n",
3444 edge - edges, edge->
opos / 64.0,
3450 edge->pos = anchor->
pos +
3451 ( ( edge->opos - anchor->
opos + 16 ) & ~31 );
3452 FT_TRACE5((
" SERIF_LINK2: edge %d (opos=%.2f)"
3453 " snapped to %.2f\n",
3454 edge - edges, edge->
opos / 64.0, edge->pos / 64.0 ));
3458#ifdef FT_DEBUG_LEVEL_TRACE
3463 if ( edge > edges &&
3464 ( top_to_bottom_hinting ? ( edge->
pos > edge[-1].
pos )
3465 : ( edge->
pos < edge[-1].
pos ) ) )
3471#ifdef FT_DEBUG_LEVEL_TRACE
3472 FT_TRACE5((
" BOUND: edge %d (pos=%.2f) moved to %.2f\n",
3475 edge[-1].
pos / 64.0 ));
3479 edge->
pos = edge[-1].
pos;
3483 if ( edge + 1 < edge_limit &&
3485 ( top_to_bottom_hinting ? ( edge->
pos < edge[1].
pos )
3486 : ( edge->
pos > edge[1].
pos ) ) )
3492#ifdef FT_DEBUG_LEVEL_TRACE
3493 FT_TRACE5((
" BOUND: edge %d (pos=%.2f) moved to %.2f\n",
3496 edge[1].
pos / 64.0 ));
3507#ifdef FT_DEBUG_LEVEL_TRACE
3563#ifdef AF_CONFIG_OPTION_USE_WARPER
3608 af_latin_writing_system_class,
_STLP_MOVE_TO_STD_NAMESPACE void _STLP_CALL advance(_InputIterator &__i, _Distance __n)
af_sort_pos(FT_UInt count, FT_Pos *table)
af_sort_and_quantize_widths(FT_UInt *count, AF_Width table, FT_Pos threshold)
#define AF_BLUE_STRING_MAX_LEN
#define GET_UTF8_CHAR(ch, p)
#define AF_BLUE_STRINGSET_MAX_LEN
enum AF_Blue_Stringset_ AF_Blue_Stringset
#define AF_PROP_INCREASE_X_HEIGHT_MIN
af_axis_hints_new_edge(AF_AxisHints axis, FT_Int fpos, AF_Direction dir, FT_Bool top_to_bottom_hinting, FT_Memory memory, AF_Edge *anedge)
af_glyph_hints_done(AF_GlyphHints hints)
af_glyph_hints_align_edge_points(AF_GlyphHints hints, AF_Dimension dim)
af_glyph_hints_save(AF_GlyphHints hints, FT_Outline *outline)
af_glyph_hints_rescale(AF_GlyphHints hints, AF_StyleMetrics metrics)
af_axis_hints_new_segment(AF_AxisHints axis, FT_Memory memory, AF_Segment *asegment)
af_glyph_hints_reload(AF_GlyphHints hints, FT_Outline *outline)
af_glyph_hints_align_strong_points(AF_GlyphHints hints, AF_Dimension dim)
af_glyph_hints_align_weak_points(AF_GlyphHints hints, AF_Dimension dim)
af_glyph_hints_init(AF_GlyphHints hints, FT_Memory memory)
#define AF_HINTS_DO_BLUES(h)
#define AF_HINTS_DO_WARP(h)
#define AF_HINTS_DO_HORIZONTAL(h)
FT_BEGIN_HEADER enum AF_Dimension_ AF_Dimension
enum AF_Direction_ AF_Direction
#define AF_HINTS_DO_VERTICAL(h)
static void af_latin_align_serif_edge(AF_GlyphHints hints, AF_Edge base, AF_Edge serif)
af_latin_get_standard_widths(AF_LatinMetrics metrics, FT_Pos *stdHW, FT_Pos *stdVW)
af_latin_metrics_init(AF_LatinMetrics metrics, FT_Face face)
static void af_latin_align_linked_edge(AF_GlyphHints hints, AF_Dimension dim, AF_Edge base_edge, AF_Edge stem_edge)
#define FLAT_THRESHOLD(x)
static void af_latin_metrics_scale_dim(AF_LatinMetrics metrics, AF_Scaler scaler, AF_Dimension dim)
static void af_latin_sort_blue(FT_UInt count, AF_LatinBlue *table)
static FT_Pos af_latin_compute_stem_width(AF_GlyphHints hints, AF_Dimension dim, FT_Pos width, FT_Pos base_delta, FT_UInt base_flags, FT_UInt stem_flags)
static FT_Error af_latin_hints_apply(FT_UInt glyph_index, AF_GlyphHints hints, FT_Outline *outline, AF_LatinMetrics metrics)
static void af_latin_hints_compute_blue_edges(AF_GlyphHints hints, AF_LatinMetrics metrics)
af_latin_metrics_scale(AF_LatinMetrics metrics, AF_Scaler scaler)
static FT_Error af_latin_hints_init(AF_GlyphHints hints, AF_LatinMetrics metrics)
static void af_latin_hint_edges(AF_GlyphHints hints, AF_Dimension dim)
static FT_Pos af_latin_snap_width(AF_Width widths, FT_UInt count, FT_Pos width)
af_latin_hints_link_segments(AF_GlyphHints hints, FT_UInt width_count, AF_WidthRec *widths, AF_Dimension dim)
af_latin_hints_compute_segments(AF_GlyphHints hints, AF_Dimension dim)
af_latin_metrics_init_widths(AF_LatinMetrics metrics, FT_Face face)
af_latin_metrics_check_digits(AF_LatinMetrics metrics, FT_Face face)
af_latin_hints_compute_edges(AF_GlyphHints hints, AF_Dimension dim)
static void af_latin_metrics_init_blues(AF_LatinMetrics metrics, FT_Face face)
af_latin_hints_detect_features(AF_GlyphHints hints, FT_UInt width_count, AF_WidthRec *widths, AF_Dimension dim)
#define AF_LATIN_IS_X_HEIGHT_BLUE(b)
#define AF_LATIN_IS_TOP_BLUE(b)
#define AF_LATIN_HINTS_STEM_ADJUST
#define AF_LATIN_BLUE_SUB_TOP
#define AF_LATIN_HINTS_DO_MONO(h)
#define AF_LATIN_MAX_WIDTHS
#define AF_LATIN_HINTS_VERT_SNAP
#define AF_LATIN_HINTS_MONO
#define AF_LATIN_HINTS_DO_VERT_SNAP(h)
#define AF_LATIN_IS_LONG_BLUE(b)
#define AF_LATIN_IS_NEUTRAL_BLUE(b)
#define AF_LATIN_IS_SUB_TOP_BLUE(b)
#define AF_LATIN_CONSTANT(metrics, c)
struct AF_LatinMetricsRec_ * AF_LatinMetrics
#define AF_LATIN_BLUE_TOP
#define AF_LATIN_HINTS_DO_HORZ_SNAP(h)
#define AF_LATIN_HINTS_DO_STEM_ADJUST(h)
#define AF_LATIN_BLUE_ACTIVE
#define AF_LATIN_BLUE_ADJUSTMENT
#define AF_LATIN_HINTS_HORZ_SNAP
#define AF_LATIN_BLUE_NEUTRAL
void * af_shaper_buf_create(FT_Face face)
const char * af_shaper_get_cluster(const char *p, AF_StyleMetrics metrics, void *buf_, unsigned int *count)
FT_ULong af_shaper_get_elem(AF_StyleMetrics metrics, void *buf_, unsigned int idx, FT_Long *advance, FT_Long *y_offset)
void af_shaper_buf_destroy(FT_Face face, void *buf)
Arabic default AF_WRITING_SYSTEM_LATIN
#define AF_SCALER_FLAG_NO_WARPER
FT_Error(* AF_WritingSystem_InitMetricsFunc)(AF_StyleMetrics metrics, FT_Face face)
void(* AF_WritingSystem_ScaleMetricsFunc)(AF_StyleMetrics metrics, AF_Scaler scaler)
FT_BEGIN_HEADER struct AF_WidthRec_ AF_WidthRec
FT_BEGIN_HEADER struct AF_WidthRec_ * AF_Width
void(* AF_WritingSystem_DoneMetricsFunc)(AF_StyleMetrics metrics)
FT_Error(* AF_WritingSystem_InitHintsFunc)(AF_GlyphHints hints, AF_StyleMetrics metrics)
#define AF_DEFINE_WRITING_SYSTEM_CLASS( writing_system_class, system, m_size, m_init, m_scale, m_done, m_stdw, h_init, h_apply)
FT_Error(* AF_WritingSystem_ApplyHintsFunc)(FT_UInt glyph_index, AF_GlyphHints hints, FT_Outline *outline, AF_StyleMetrics metrics)
#define AF_SCALER_FLAG_NO_HORIZONTAL
void(* AF_WritingSystem_GetStdWidthsFunc)(AF_StyleMetrics metrics, FT_Pos *stdHW, FT_Pos *stdVW)
FT_Load_Glyph(FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
#define FT_STYLE_FLAG_ITALIC
enum FT_Render_Mode_ FT_Render_Mode
FT_DivFix(FT_Long a, FT_Long b)
FT_Select_Charmap(FT_Face face, FT_Encoding encoding)
FT_Set_Charmap(FT_Face face, FT_CharMap charmap)
FT_MulDiv(FT_Long a, FT_Long b, FT_Long c)
FT_MulFix(FT_Long a, FT_Long b)
#define FT_TRACE5(varformat)
#define FT_CURVE_TAG(flag)
FT_BEGIN_HEADER typedef signed long FT_Pos
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
FT_BEGIN_HEADER typedef unsigned char FT_Bool
GLint GLint GLint GLint GLint x
GLuint GLuint GLsizei count
GLint GLint GLint GLint GLint GLint y
GLint GLint GLsizei width
GLenum GLenum GLenum GLenum GLenum scale
GLenum GLenum GLvoid GLvoid GLvoid * span
GLenum GLuint GLint GLenum face
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
GLubyte GLubyte GLubyte GLubyte w
GLsizei const GLfloat * points
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
static const int digits[]
static struct msdos_boot_sector bs
static char memory[1024 *256]
static unsigned __int64 next
namespace GUID const ADDRINFOEXW * hints
AF_LatinBlueRec blues[AF_BLUE_STRINGSET_MAX]
AF_WidthRec widths[AF_LATIN_MAX_WIDTHS]
FT_Pos edge_distance_threshold
FT_Render_Mode render_mode
const char * standard_charstring
FT_Bool top_to_bottom_hinting
AF_Blue_Stringset blue_stringset
__inline int before(__u32 seq1, __u32 seq2)
__inline int after(__u32 seq1, __u32 seq2)