27#ifdef AF_CONFIG_OPTION_USE_WARPER
39#define FT_COMPONENT aflatin
43#define FLAT_THRESHOLD( x ) ( x / 14 )
71 "latin standard widths computation (style `%s')\n"
72 "=====================================================\n"
74 af_style_names[
metrics->root.style_class->style] ));
100#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
104 void* shaper_buf = &shaper_buf_;
109#ifdef FT_DEBUG_LEVEL_TRACE
116#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
129 unsigned int num_idx;
131#ifdef FT_DEBUG_LEVEL_TRACE
139#ifdef FT_DEBUG_LEVEL_TRACE
163 FT_TRACE5((
"standard character missing;"
164 " using fallback stem widths\n" ));
168 FT_TRACE5((
"standard character: U+%04lX (glyph index %ld)\n",
172 if (
error ||
face->glyph->outline.n_points <= 0 )
221 for ( ; seg <
limit; seg++ )
236 axis->
widths[num_widths++].org = dist;
243 dummy->units_per_em / 100 );
262#ifdef FT_DEBUG_LEVEL_TRACE
305 for (
j =
i;
j > 0;
j-- )
360#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
364 void* shaper_buf = &shaper_buf_;
371 FT_TRACE5((
"latin blue zones computation\n"
372 "============================\n"
375#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
388#ifdef FT_DEBUG_LEVEL_TRACE
395 if (
bs->properties )
449 FT_Int best_point, best_contour_first, best_contour_last;
455 unsigned int i, num_idx;
457#ifdef FT_DEBUG_LEVEL_TRACE
466#ifdef FT_DEBUG_LEVEL_TRACE
486 for (
i = 0;
i < num_idx;
i++ )
498 if ( glyph_index == 0 )
509#ifdef FT_DEBUG_LEVEL_TRACE
511 FT_TRACE5((
" U+%04lX contains no (usable) outlines\n",
ch ));
513 FT_TRACE5((
" component %d of cluster starting with U+%04lX"
514 " contains no (usable) outlines\n",
i,
ch ));
523 best_contour_first = 0;
524 best_contour_last = 0;
534 FT_Int old_best_point = best_point;
552 if ( best_point < 0 ||
points[pp].
y > best_y )
556 ascender =
FT_MAX( ascender, best_y + y_offset );
566 if ( best_point < 0 ||
points[pp].
y < best_y )
570 descender =
FT_MIN( descender, best_y + y_offset );
577 if ( best_point != old_best_point )
579 best_contour_first =
first;
580 best_contour_last =
last;
588 if ( best_point >= 0 )
592 FT_Int best_segment_first, best_segment_last;
593 FT_Int best_on_point_first, best_on_point_last;
597 best_segment_first = best_point;
598 best_segment_last = best_point;
602 best_on_point_first = best_point;
603 best_on_point_last = best_point;
607 best_on_point_first = -1;
608 best_on_point_last = -1;
619 if ( prev > best_contour_first )
622 prev = best_contour_last;
631 best_segment_first = prev;
635 best_on_point_first = prev;
636 if ( best_on_point_last < 0 )
637 best_on_point_last = prev;
640 }
while ( prev != best_point );
644 if (
next < best_contour_last )
647 next = best_contour_first;
654 best_segment_last =
next;
658 best_on_point_last =
next;
659 if ( best_on_point_first < 0 )
660 best_on_point_first =
next;
663 }
while (
next != best_point );
686 points[best_segment_first].
x );
688 if ( dist < length_threshold &&
689 best_segment_last - best_segment_first + 2 <=
690 best_contour_last - best_contour_first )
714 if ( prev > best_contour_first )
717 prev = best_contour_last;
719 if (
points[prev].
x != best_x )
722 }
while ( prev != best_point );
725 if ( prev == best_point )
730 first = best_segment_last;
761 if (
last < best_contour_last )
764 last = best_contour_first;
793 if ( l2r == left2right &&
794 d >= length_threshold )
800 if (
last < best_contour_last )
803 last = best_contour_first;
810 if (
last > best_contour_first )
813 last = best_contour_last;
827 }
while (
last != best_segment_first );
831 best_segment_first =
first;
832 best_segment_last =
last;
834 best_on_point_first = p_first;
835 best_on_point_last = p_last;
840 }
while (
last != best_segment_first );
850#ifdef FT_DEBUG_LEVEL_TRACE
852 FT_TRACE5((
" U+%04lX: best_y = %5ld",
ch, best_y ));
854 FT_TRACE5((
" component %d of cluster starting with U+%04lX:"
855 " best_y = %5ld",
i,
ch, best_y ));
866 if ( best_on_point_first >= 0 &&
867 best_on_point_last >= 0 &&
869 points[best_on_point_first].
x ) ) >
891 if ( best_y > best_y_extremum )
893 best_y_extremum = best_y;
899 if ( best_y < best_y_extremum )
901 best_y_extremum = best_y;
912 rounds[num_rounds++] = best_y_extremum;
914 flats[num_flats++] = best_y_extremum;
919 if ( num_flats == 0 && num_rounds == 0 )
937 blue_shoot = &
blue->shoot.org;
941 if ( num_flats == 0 )
944 *blue_shoot = rounds[num_rounds / 2];
946 else if ( num_rounds == 0 )
949 *blue_shoot = flats[num_flats / 2];
953 *blue_ref = flats [num_flats / 2];
954 *blue_shoot = rounds[num_rounds / 2];
960 if ( *blue_shoot != *blue_ref )
963 FT_Pos shoot = *blue_shoot;
971 *blue_shoot = ( shoot +
ref ) / 2;
973 FT_TRACE5((
" [overshoot smaller than reference,"
974 " taking mean value]\n" ));
978 blue->ascender = ascender;
979 blue->descender = descender;
998 " overshoot = %ld\n",
999 *blue_ref, *blue_shoot ));
1015 blue_sorted[
i] = &axis->
blues[
i];
1026#ifdef FT_DEBUG_LEVEL_TRACE
1034 a = &blue_sorted[
i]->
shoot.org;
1035#ifdef FT_DEBUG_LEVEL_TRACE
1040 a = &blue_sorted[
i]->
ref.org;
1044 b = &blue_sorted[
i + 1]->
shoot.org;
1046 b = &blue_sorted[
i + 1]->
ref.org;
1052 " adjusting %s %ld to %ld\n",
1053 a_is_top ?
"overshoot" :
"reference",
1054 blue_sorted[
i] - axis->
blues,
1074 " hinting disabled for this style\n" ));
1079 gstyles[
i] = AF_STYLE_NONE_DFLT;
1095 FT_Bool started = 0, same_width = 1;
1100#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
1104 void* shaper_buf = &shaper_buf_;
1108 const char digits[] =
"0 1 2 3 4 5 6 7 8 9";
1114#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
1121 unsigned int num_idx;
1154 metrics->root.digits_have_same_width = same_width;
1250 ppem =
metrics->root.scaler.face->size->metrics.x_ppem;
1261 fitted = ( scaled + threshold ) & ~63;
1263 if ( scaled != fitted )
1268 if ( fitted < scaled )
1283 max_height =
metrics->units_per_em;
1297 "af_latin_metrics_scale_dim:"
1298 " x height alignment (style `%s'):\n"
1300 " vertical scaling changed from %.5f to %.5f (by %ld%%)\n"
1302 af_style_names[
metrics->root.style_class->style],
1304 new_scale / 65536.0,
1305 ( fitted - scaled ) * 100 / scaled ));
1309#ifdef FT_DEBUG_LEVEL_TRACE
1313 "af_latin_metrics_scale_dim:"
1314 " x height alignment (style `%s'):\n"
1316 " excessive vertical scaling abandoned\n"
1318 af_style_names[
metrics->root.style_class->style] ));
1327 axis->
delta = delta;
1332 metrics->root.scaler.x_delta = delta;
1337 metrics->root.scaler.y_delta = delta;
1342 af_style_names[
metrics->root.style_class->style] ));
1355 width->cur / 64.0 ));
1365#ifdef FT_DEBUG_LEVEL_TRACE
1367 FT_TRACE5((
"`%s' style is extra light (at current resolution)\n"
1369 af_style_names[
metrics->root.style_class->style] ));
1374#ifdef FT_DEBUG_LEVEL_TRACE
1376 FT_TRACE5((
"blue zones (style `%s')\n",
1377 af_style_names[
metrics->root.style_class->style] ));
1391 blue->flags &= ~AF_LATIN_BLUE_ACTIVE;
1395 if ( dist <= 48 && dist >= -48 )
1408 delta1 =
blue->shoot.org -
blue->ref.org;
1417 else if ( delta2 < 64 )
1418 delta2 = 32 + ( ( ( delta2 - 32 ) + 16 ) & ~31 );
1426 blue->shoot.fit =
blue->ref.fit + delta2;
1437 else if ( delta2 < 48 )
1446 blue->shoot.fit =
blue->ref.fit - delta2;
1479 if (
b->ref.fit <=
blue->shoot.fit &&
1480 b->shoot.fit >=
blue->ref.fit )
1488#ifdef FT_DEBUG_LEVEL_TRACE
1494 FT_TRACE5((
" reference %d: %ld scaled to %.2f%s\n"
1495 " overshoot %d: %ld scaled to %.2f%s\n",
1498 blue->ref.fit / 64.0,
1503 blue->shoot.fit / 64.0,
1518 metrics->root.scaler.render_mode = scaler->render_mode;
1519 metrics->root.scaler.face = scaler->face;
1520 metrics->root.scaler.flags = scaler->flags;
1576 segment_dir = major_dir;
1578 axis->num_segments = 0;
1607 for ( ; contour < contour_limit; contour++ )
1618 FT_Pos min_coord = 32000;
1619 FT_Pos max_coord = -32000;
1622 FT_Pos min_on_coord = 32000;
1623 FT_Pos max_on_coord = -32000;
1629 FT_Pos prev_min_pos = min_pos;
1630 FT_Pos prev_max_pos = max_pos;
1631 FT_Pos prev_min_coord = min_coord;
1632 FT_Pos prev_max_coord = max_coord;
1635 FT_Pos prev_min_on_coord = min_on_coord;
1636 FT_Pos prev_max_on_coord = max_on_coord;
1677 if (
v < min_coord )
1680 min_flags =
point->flags;
1682 if (
v > max_coord )
1685 max_flags =
point->flags;
1692 if (
v < min_on_coord )
1694 if (
v > max_on_coord )
1704 if ( !prev_segment || segment->
first != prev_segment->
last )
1709 segment->last =
point;
1710 segment->pos = (
FT_Short)( ( min_pos + max_pos ) >> 1 );
1711 segment->delta = (
FT_Short)( ( max_pos - min_pos ) >> 1 );
1717 ( max_on_coord - min_on_coord ) < flat_threshold )
1720 segment->min_coord = (
FT_Short)min_coord;
1721 segment->max_coord = (
FT_Short)max_coord;
1722 segment->height = segment->max_coord - segment->min_coord;
1724 prev_segment = segment;
1725 prev_min_pos = min_pos;
1726 prev_max_pos = max_pos;
1727 prev_min_coord = min_coord;
1728 prev_max_coord = max_coord;
1729 prev_min_flags = min_flags;
1730 prev_max_flags = max_flags;
1731 prev_min_on_coord = min_on_coord;
1732 prev_max_on_coord = max_on_coord;
1749 if ( prev_min_pos < min_pos )
1750 min_pos = prev_min_pos;
1751 if ( prev_max_pos > max_pos )
1752 max_pos = prev_max_pos;
1754 if ( prev_min_coord < min_coord )
1756 min_coord = prev_min_coord;
1757 min_flags = prev_min_flags;
1759 if ( prev_max_coord > max_coord )
1761 max_coord = prev_max_coord;
1762 max_flags = prev_max_flags;
1765 if ( prev_min_on_coord < min_on_coord )
1766 min_on_coord = prev_min_on_coord;
1767 if ( prev_max_on_coord > max_on_coord )
1768 max_on_coord = prev_max_on_coord;
1777 ( max_on_coord - min_on_coord ) < flat_threshold )
1780 prev_segment->
flags &= ~AF_EDGE_ROUND;
1792 if (
FT_ABS( prev_max_coord - prev_min_coord ) >
1793 FT_ABS( max_coord - min_coord ) )
1797 if ( min_pos < prev_min_pos )
1798 prev_min_pos = min_pos;
1799 if ( max_pos > prev_max_pos )
1800 prev_max_pos = max_pos;
1804 prev_max_pos ) >> 1 );
1806 prev_min_pos ) >> 1 );
1812 if ( prev_min_pos < min_pos )
1813 min_pos = prev_min_pos;
1814 if ( prev_max_pos > max_pos )
1815 max_pos = prev_max_pos;
1817 segment->last =
point;
1818 segment->pos = (
FT_Short)( ( min_pos + max_pos ) >> 1 );
1819 segment->delta = (
FT_Short)( ( max_pos - min_pos ) >> 1 );
1822 ( max_on_coord - min_on_coord ) < flat_threshold )
1825 segment->min_coord = (
FT_Short)min_coord;
1826 segment->max_coord = (
FT_Short)max_coord;
1827 segment->height = segment->max_coord -
1830 *prev_segment = *segment;
1832 prev_min_pos = min_pos;
1833 prev_max_pos = max_pos;
1834 prev_min_coord = min_coord;
1835 prev_max_coord = max_coord;
1836 prev_min_flags = min_flags;
1837 prev_max_flags = max_flags;
1838 prev_min_on_coord = min_on_coord;
1839 prev_max_on_coord = max_on_coord;
1843 axis->num_segments--;
1878 segment->dir = (
FT_Char)segment_dir;
1879 segment->first =
point;
1880 segment->last =
point;
1885 prev_segment = segment - 1;
1887 min_pos = max_pos =
point->u;
1888 min_coord = max_coord =
point->v;
1889 min_flags = max_flags =
point->flags;
1893 min_on_coord = 32000;
1894 max_on_coord = -32000;
1897 min_on_coord = max_on_coord =
point->v;
1913 segment->height = 0;
1933 for ( segment = segments; segment < segments_end; segment++ )
1941 if ( first_v < last_v )
1947 if (
p->v < first_v )
1948 segment->height = (
FT_Short)( segment->height +
1949 ( ( first_v -
p->v ) >> 1 ) );
1952 if (
p->v > last_v )
1953 segment->height = (
FT_Short)( segment->height +
1954 ( (
p->v - last_v ) >> 1 ) );
1962 if (
p->v > first_v )
1963 segment->height = (
FT_Short)( segment->height +
1964 ( (
p->v - first_v ) >> 1 ) );
1967 if (
p->v < last_v )
1968 segment->height = (
FT_Short)( segment->height +
1969 ( ( last_v -
p->v ) >> 1 ) );
1991 FT_Pos len_threshold, len_score, dist_score, max_width;
1996 max_width = widths[width_count - 1].org;
2002 if ( len_threshold == 0 )
2014 for ( seg1 = segments; seg1 < segment_limit; seg1++ )
2021 for ( seg2 = segments; seg2 < segment_limit; seg2++ )
2027 if ( seg1->
dir + seg2->
dir == 0 && pos2 > pos1 )
2035 if ( min < seg2->min_coord )
2044 if (
len >= len_threshold )
2060 FT_Pos dist = pos2 - pos1;
2062 FT_Pos dist_demerit, score;
2069 FT_Pos delta = ( dist << 10 ) / max_width - ( 1 << 10 );
2072 if ( delta > 10000 )
2073 dist_demerit = 32000;
2074 else if ( delta > 0 )
2075 dist_demerit = delta * delta / dist_score;
2080 dist_demerit = dist;
2082 score = dist_demerit + len_score /
len;
2085 if ( score < seg1->score )
2087 seg1->
score = score;
2091 if ( score < seg2->score )
2093 seg2->
score = score;
2102 for ( seg1 = segments; seg1 < segment_limit; seg1++ )
2108 if ( seg2->
link != seg1 )
2132 FT_Bool top_to_bottom_hinting = 0;
2142 FT_Pos edge_distance_threshold;
2143 FT_Pos segment_length_threshold;
2144 FT_Pos segment_width_threshold;
2168 segment_length_threshold = 0;
2195 if ( edge_distance_threshold > 64 / 4 )
2196 edge_distance_threshold = 64 / 4;
2198 edge_distance_threshold =
FT_DivFix( edge_distance_threshold,
2201 for ( seg = segments; seg < segment_limit; seg++ )
2209 if ( seg->
height < segment_length_threshold ||
2210 seg->
delta > segment_width_threshold ||
2217 2 * seg->
height < 3 * segment_length_threshold )
2221 for ( ee = 0; ee < axis->
num_edges; ee++ )
2231 if ( dist < edge_distance_threshold && edge->
dir == seg->
dir )
2247 top_to_bottom_hinting,
2275 for ( seg = segments; seg < segment_limit; seg++ )
2285 for ( ee = 0; ee < axis->
num_edges; ee++ )
2295 if ( dist < edge_distance_threshold )
2338 for ( edge = edges; edge < edge_limit; edge++ )
2347 }
while ( seg != edge->
first );
2351 for ( edge = edges; edge < edge_limit; edge++ )
2376 if ( seg->
dir == up_dir )
2400 edge2 = edge->
serif;
2409 edge_delta = edge->
fpos - edge2->
fpos;
2410 if ( edge_delta < 0 )
2411 edge_delta = -edge_delta;
2413 seg_delta = seg->
pos - seg2->
pos;
2414 if ( seg_delta < 0 )
2415 seg_delta = -seg_delta;
2417 if ( seg_delta < edge_delta )
2425 edge->
serif = edge2;
2434 }
while ( seg != edge->
first );
2439 if ( is_round > 0 && is_round >= is_straight )
2449 else if ( ups < downs )
2452 else if ( ups == downs )
2510 for ( ; edge < edge_limit; edge++ )
2514 FT_Bool best_blue_is_neutral = 0;
2523 if ( best_dist > 64 / 2 )
2529 FT_Bool is_top_blue, is_neutral_blue, is_major_dir;
2549 if ( is_top_blue ^ is_major_dir || is_neutral_blue )
2560 if ( dist < best_dist )
2563 best_blue = &
blue->ref;
2564 best_blue_is_neutral = is_neutral_blue;
2579 if ( is_top_blue ^ is_under_ref )
2581 dist = edge->
fpos -
blue->shoot.org;
2586 if ( dist < best_dist )
2589 best_blue = &
blue->shoot;
2590 best_blue_is_neutral = is_neutral_blue;
2600 if ( best_blue_is_neutral )
2614 FT_UInt32 scaler_flags, other_flags;
2637 scaler_flags =
hints->scaler_flags;
2674#ifdef AF_CONFIG_OPTION_USE_WARPER
2676 if ( !
metrics->root.globals->module->warping )
2680 hints->scaler_flags = scaler_flags;
2681 hints->other_flags = other_flags;
2704 FT_Pos best = 64 + 32 + 2;
2730 if (
width < scaled + 48 )
2735 if (
width > scaled - 48 )
2788 else if ( dist < 56 )
2791 if ( axis->width_count > 0 )
2797 delta = dist - axis->widths[0].cur;
2804 dist = axis->widths[0].cur;
2811 if ( dist < 3 * 64 )
2819 else if ( delta < 32 )
2822 else if ( delta < 54 )
2845 if ( ( (
width > 0 ) && ( base_delta > 0 ) ) ||
2846 ( (
width < 0 ) && ( base_delta < 0 ) ) )
2852 bdelta = base_delta;
2853 else if ( ppem < 30 )
2854 bdelta = ( base_delta * (
FT_Pos)( 30 - ppem ) ) / 20;
2860 dist = ( dist - bdelta + 32 ) & ~63;
2879 dist = ( dist + 16 ) & ~63;
2893 dist = ( dist + 32 ) & ~63;
2902 dist = ( dist + 64 ) >> 1;
2904 else if ( dist < 128 )
2915 dist = ( dist + 22 ) & ~63;
2916 delta = dist - org_dist;
2924 dist = ( dist + 64 ) >> 1;
2929 dist = ( dist + 32 ) & ~63;
2954 dist = stem_edge->
opos - base_edge->
opos;
2955 base_delta = base_edge->
pos - base_edge->
opos;
2963 stem_edge->
pos = base_edge->
pos + fitted_width;
2965 FT_TRACE5((
" LINK: edge %ld (opos=%.2f) linked to %.2f,"
2966 " dist was %.2f, now %.2f\n",
2967 stem_edge -
hints->axis[dim].edges, stem_edge->
opos / 64.0,
2968 stem_edge->
pos / 64.0, dist / 64.0, fitted_width / 64.0 ));
3014 FT_Bool top_to_bottom_hinting = 0;
3016#ifdef FT_DEBUG_LEVEL_TRACE
3021 FT_TRACE5((
"latin %s edge hinting (style `%s')\n",
3023 af_style_names[
hints->metrics->style_class->style] ));
3033 for ( edge = edges; edge < edge_limit; edge++ )
3063 edge2->
flags &= ~AF_EDGE_NEUTRAL;
3068 edge->
flags &= ~AF_EDGE_NEUTRAL;
3087#ifdef FT_DEBUG_LEVEL_TRACE
3089 FT_TRACE5((
" BLUE_ANCHOR: edge %ld (opos=%.2f) snapped to %.2f,"
3090 " was %.2f (anchor=edge %ld)\n",
3091 edge1 - edges, edge1->
opos / 64.0,
blue->fit / 64.0,
3092 edge1->
pos / 64.0, edge - edges ));
3094 FT_TRACE5((
" BLUE: edge %ld (opos=%.2f) snapped to %.2f,"
3096 edge1 - edges, edge1->
opos / 64.0,
blue->fit / 64.0,
3097 edge1->
pos / 64.0 ));
3110#ifdef FT_DEBUG_LEVEL_TRACE
3122 for ( edge = edges; edge < edge_limit; edge++ )
3143 FT_TRACE5((
" ASSERTION FAILED for edge %ld\n", edge2 - edges ));
3148#ifdef FT_DEBUG_LEVEL_TRACE
3158 FT_Pos org_len, org_center, cur_len;
3162 org_len = edge2->
opos - edge->
opos;
3171 if ( cur_len <= 64 )
3186 org_center = edge->
opos + ( org_len >> 1 );
3189 error1 = org_center - ( cur_pos1 - u_off );
3193 error2 = org_center - ( cur_pos1 + d_off );
3202 edge->
pos = cur_pos1 - cur_len / 2;
3203 edge2->
pos = edge->
pos + cur_len;
3211 FT_TRACE5((
" ANCHOR: edge %ld (opos=%.2f) and %ld (opos=%.2f)"
3212 " snapped to %.2f and %.2f\n",
3213 edge - edges, edge->
opos / 64.0,
3214 edge2 - edges, edge2->
opos / 64.0,
3215 edge->
pos / 64.0, edge2->
pos / 64.0 ));
3219#ifdef FT_DEBUG_LEVEL_TRACE
3225 FT_Pos org_pos, org_len, org_center, cur_len;
3226 FT_Pos cur_pos1, cur_pos2, delta1, delta2;
3229 org_pos = anchor->
pos + ( edge->
opos - anchor->
opos );
3230 org_len = edge2->
opos - edge->
opos;
3231 org_center = org_pos + ( org_len >> 1 );
3240 FT_TRACE5((
" ADJUST: edge %ld (pos=%.2f) moved to %.2f\n",
3241 edge - edges, edge->
pos / 64.0,
3242 ( edge2->
pos - cur_len ) / 64.0 ));
3244 edge->
pos = edge2->
pos - cur_len;
3247 else if ( cur_len < 96 )
3254 if ( cur_len <= 64 )
3265 delta1 = org_center - ( cur_pos1 - u_off );
3269 delta2 = org_center - ( cur_pos1 + d_off );
3273 if ( delta1 < delta2 )
3278 edge->
pos = cur_pos1 - cur_len / 2;
3279 edge2->
pos = cur_pos1 + cur_len / 2;
3281 FT_TRACE5((
" STEM: edge %ld (opos=%.2f) linked to %ld (opos=%.2f)"
3282 " snapped to %.2f and %.2f\n",
3283 edge - edges, edge->
opos / 64.0,
3284 edge2 - edges, edge2->
opos / 64.0,
3285 edge->
pos / 64.0, edge2->
pos / 64.0 ));
3290 org_pos = anchor->
pos + ( edge->
opos - anchor->
opos );
3291 org_len = edge2->
opos - edge->
opos;
3292 org_center = org_pos + ( org_len >> 1 );
3300 delta1 = cur_pos1 + ( cur_len >> 1 ) - org_center;
3304 cur_pos2 =
FT_PIX_ROUND( org_pos + org_len ) - cur_len;
3305 delta2 = cur_pos2 + ( cur_len >> 1 ) - org_center;
3309 edge->
pos = ( delta1 < delta2 ) ? cur_pos1 : cur_pos2;
3310 edge2->
pos = edge->
pos + cur_len;
3312 FT_TRACE5((
" STEM: edge %ld (opos=%.2f) linked to %ld (opos=%.2f)"
3313 " snapped to %.2f and %.2f\n",
3314 edge - edges, edge->
opos / 64.0,
3315 edge2 - edges, edge2->
opos / 64.0,
3316 edge->
pos / 64.0, edge2->
pos / 64.0 ));
3319#ifdef FT_DEBUG_LEVEL_TRACE
3326 if ( edge > edges &&
3327 ( top_to_bottom_hinting ? ( edge->
pos > edge[-1].
pos )
3328 : ( edge->
pos < edge[-1].
pos ) ) )
3334#ifdef FT_DEBUG_LEVEL_TRACE
3335 FT_TRACE5((
" BOUND: edge %ld (pos=%.2f) moved to %.2f\n",
3338 edge[-1].
pos / 64.0 ));
3343 edge->
pos = edge[-1].
pos;
3364 n_edges = edge_limit - edges;
3387 span = dist1 - dist2;
3393 delta = edge3->
pos - ( 2 * edge2->
pos - edge1->
pos );
3394 edge3->
pos -= delta;
3399 if ( n_edges == 12 )
3401 ( edges + 8 )->
pos -= delta;
3402 ( edges + 11 )->
pos -= delta;
3411 if ( has_serifs || !anchor )
3417 for ( edge = edges; edge < edge_limit; edge++ )
3434 if ( delta < 64 + 16 )
3437 FT_TRACE5((
" SERIF: edge %ld (opos=%.2f) serif to %ld (opos=%.2f)"
3438 " aligned to %.2f\n",
3439 edge - edges, edge->
opos / 64.0,
3441 edge->
pos / 64.0 ));
3447 FT_TRACE5((
" SERIF_ANCHOR: edge %ld (opos=%.2f)"
3448 " snapped to %.2f\n",
3449 edge-edges, edge->
opos / 64.0, edge->
pos / 64.0 ));
3465 after < edge_limit && after > edge )
3470 edge->pos =
before->pos +
3475 FT_TRACE5((
" SERIF_LINK1: edge %ld (opos=%.2f) snapped to %.2f"
3476 " from %ld (opos=%.2f)\n",
3477 edge - edges, edge->
opos / 64.0,
3483 edge->pos = anchor->
pos +
3484 ( ( edge->opos - anchor->
opos + 16 ) & ~31 );
3485 FT_TRACE5((
" SERIF_LINK2: edge %ld (opos=%.2f)"
3486 " snapped to %.2f\n",
3487 edge - edges, edge->
opos / 64.0, edge->pos / 64.0 ));
3491#ifdef FT_DEBUG_LEVEL_TRACE
3496 if ( edge > edges &&
3497 ( top_to_bottom_hinting ? ( edge->
pos > edge[-1].
pos )
3498 : ( edge->
pos < edge[-1].
pos ) ) )
3504#ifdef FT_DEBUG_LEVEL_TRACE
3505 FT_TRACE5((
" BOUND: edge %ld (pos=%.2f) moved to %.2f\n",
3508 edge[-1].
pos / 64.0 ));
3512 edge->
pos = edge[-1].
pos;
3516 if ( edge + 1 < edge_limit &&
3518 ( top_to_bottom_hinting ? ( edge->
pos < edge[1].
pos )
3519 : ( edge->
pos > edge[1].
pos ) ) )
3525#ifdef FT_DEBUG_LEVEL_TRACE
3526 FT_TRACE5((
" BOUND: edge %ld (pos=%.2f) moved to %.2f\n",
3529 edge[1].
pos / 64.0 ));
3540#ifdef FT_DEBUG_LEVEL_TRACE
3596#ifdef AF_CONFIG_OPTION_USE_WARPER
3641 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 int af_latin_metrics_init_blues(AF_LatinMetrics metrics, FT_Face face)
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)
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
#define FT_OFFSET(base, count)
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)