21#include FT_INTERNAL_CALC_H
22#include FT_INTERNAL_DEBUG_H
32#define FT_COMPONENT afhints
48 if ( !axis->segments )
50 axis->segments = axis->embedded.segments;
54 else if ( axis->num_segments >= axis->max_segments )
56 FT_Int old_max = axis->max_segments;
61 if ( old_max >= big_max )
67 new_max += ( new_max >> 2 ) + 4;
68 if ( new_max < old_max || new_max > big_max )
71 if ( axis->segments == axis->embedded.segments )
75 ft_memcpy( axis->segments, axis->embedded.segments,
76 sizeof ( axis->embedded.segments ) );
84 axis->max_segments = new_max;
87 segment = axis->segments + axis->num_segments++;
115 axis->edges = axis->embedded.edges;
119 else if ( axis->num_edges >= axis->max_edges )
121 FT_Int old_max = axis->max_edges;
126 if ( old_max >= big_max )
132 new_max += ( new_max >> 2 ) + 4;
133 if ( new_max < old_max || new_max > big_max )
136 if ( axis->edges == axis->embedded.edges )
140 ft_memcpy( axis->edges, axis->embedded.edges,
141 sizeof ( axis->embedded.edges ) );
149 axis->max_edges = new_max;
153 edge = edges + axis->num_edges;
155 while ( edge > edges )
157 if ( top_to_bottom_hinting ? ( edge[-1].
fpos >
fpos )
163 if ( edge[-1].
fpos ==
fpos &&
dir == axis->major_dir )
178#ifdef FT_DEBUG_AUTOFIT
180#include FT_CONFIG_STANDARD_LIBRARY_H
183#define AF_DUMP( varformat ) \
189 FT_TRACE7( varformat ); \
221#define AF_INDEX_NUM( ptr, base ) (int)( (ptr) ? ( (ptr) - (base) ) : -1 )
225 af_print_idx(
char*
p,
253 for ( segment = segments; segment <
limit; segment++ )
270 if (
p == segment->
last )
279 if ( segment ==
limit )
282 return (
int)( segment - segments );
296 return segment_idx == -1 ? -1 : AF_INDEX_NUM( segment->
edge, edges );
309 return AF_INDEX_NUM( strong_edges[dimension], edges );
327 AF_DUMP((
"Table of points:\n" ));
329 if (
hints->num_points )
331 AF_DUMP((
" index hedge hseg vedge vseg flags "
333 " xorg yorg xscale yscale xfit yfit "
335 " hbef haft vbef vaft" ));
339 AF_DUMP((
" (none)\n" ));
344 int segment_idx_0 = af_get_segment_index(
hints, point_idx, 0 );
345 int segment_idx_1 = af_get_segment_index(
hints, point_idx, 1 );
347 char buf1[16], buf2[16], buf3[16], buf4[16];
348 char buf5[16], buf6[16], buf7[16], buf8[16];
352 if ( contour < climit && *contour ==
point )
358 AF_DUMP((
" %5d %5s %5s %5s %5s %s"
359 " %5d %5d %7.2f %7.2f %7.2f %7.2f"
360 " %5s %5s %5s %5s\n",
363 af_get_edge_index(
hints, segment_idx_1, 1 ) ),
364 af_print_idx( buf2, segment_idx_1 ),
366 af_get_edge_index(
hints, segment_idx_0, 0 ) ),
367 af_print_idx( buf4, segment_idx_0 ),
381 af_print_idx( buf5, af_get_strong_edge_index(
hints,
384 af_print_idx( buf6, af_get_strong_edge_index(
hints,
387 af_print_idx( buf7, af_get_strong_edge_index(
hints,
390 af_print_idx( buf8, af_get_strong_edge_index(
hints,
404 static char temp[32];
441 for ( dimension = 1; dimension >= 0; dimension-- )
450 char buf1[16], buf2[16], buf3[16];
453 AF_DUMP((
"Table of %s segments:\n",
458 AF_DUMP((
" index pos delta dir from to "
462 " height extra flags\n" ));
466 AF_DUMP((
" (none)\n" ));
468 for ( seg = segments; seg <
limit; seg++ )
469 AF_DUMP((
" %5d %5d %5d %5s %4d %4d"
472 AF_INDEX_NUM( seg, segments ),
479 af_print_idx( buf1, AF_INDEX_NUM( seg->
link, segments ) ),
480 af_print_idx( buf2, AF_INDEX_NUM( seg->
serif, segments ) ),
481 af_print_idx( buf3, AF_INDEX_NUM( seg->
edge, edges ) ),
485 af_edge_flags_to_string( seg->
flags ) ));
510 axis = &
hints->axis[dim];
539 return FT_THROW( Invalid_Argument );
543 axis = &
hints->axis[dim];
546 return FT_THROW( Invalid_Argument );
580 for ( dimension = 1; dimension >= 0; dimension-- )
587 char buf1[16], buf2[16];
595 AF_DUMP((
"Table of %s edges (1px=%.2fu, 10u=%.2fpx):\n",
597 65536.0 * 64.0 /
hints->x_scale,
598 10.0 *
hints->x_scale / 65536.0 / 64.0 ));
600 AF_DUMP((
"Table of %s edges (1px=%.2fu, 10u=%.2fpx):\n",
602 65536.0 * 64.0 /
hints->y_scale,
603 10.0 *
hints->y_scale / 65536.0 / 64.0 ));
607 AF_DUMP((
" index pos dir link serif"
609 " blue opos pos flags\n" ));
613 AF_DUMP((
" (none)\n" ));
615 for ( edge = edges; edge <
limit; edge++ )
616 AF_DUMP((
" %5d %7.2f %5s %4s %5s"
617 " %c %7.2f %7.2f %11s\n",
618 AF_INDEX_NUM( edge, edges ),
619 (
int)edge->
opos / 64.0,
621 af_print_idx( buf1, AF_INDEX_NUM( edge->
link, edges ) ),
622 af_print_idx( buf2, AF_INDEX_NUM( edge->
serif, edges ) ),
627 af_edge_flags_to_string( edge->
flags ) ));
733 if (
hints->contours !=
hints->embedded.contours )
735 hints->max_contours = 0;
736 hints->num_contours = 0;
738 if (
hints->points !=
hints->embedded.points )
740 hints->max_points = 0;
741 hints->num_points = 0;
775 hints->num_points = 0;
776 hints->num_contours = 0;
778 hints->axis[0].num_segments = 0;
779 hints->axis[0].num_edges = 0;
780 hints->axis[1].num_segments = 0;
781 hints->axis[1].num_edges = 0;
789 if ( !
hints->contours )
795 else if ( new_max > old_max )
797 if (
hints->contours ==
hints->embedded.contours )
800 new_max = ( new_max + 3 ) & ~3U;
818 if ( !
hints->points )
824 else if ( new_max > old_max )
826 if (
hints->points ==
hints->embedded.points )
829 new_max = ( new_max + 2 + 7 ) & ~7U;
853 hints->x_scale = x_scale;
854 hints->y_scale = y_scale;
855 hints->x_delta = x_delta;
856 hints->y_delta = y_delta;
858 hints->xmin_delta = 0;
859 hints->xmax_delta = 0;
862 if (
hints->num_points == 0 )
870 FT_UInt units_per_em =
hints->metrics->scaler.face->units_per_EM;
871 FT_Int near_limit = 20 * units_per_em / 2048;
924 if ( ++contour_index < outline->n_contours )
932#ifdef FT_DEBUG_AUTOFIT
950 for ( ; contour < contour_limit; contour++,
end++ )
970 FT_Int near_limit2 = 2 * near_limit - 1;
976 for ( contour =
hints->contours; contour < contour_limit; contour++ )
991 while ( prev !=
first )
1004 if (
FT_ABS( out_x ) +
FT_ABS( out_y ) >= near_limit2 )
1059 for ( curr = curr->
next; curr !=
next; curr = curr->
next )
1101 in_x =
point->fx - prev_v->
fx;
1102 in_y =
point->fy - prev_v->
fy;
1104 out_x = next_u->
fx -
point->fx;
1105 out_y = next_u->
fy -
point->fy;
1107 if ( ( in_x ^ out_x ) >= 0 && ( in_y ^ out_y ) >= 0 )
1114 prev_v->
u = (
FT_Pos)( next_u - prev_v );
1115 next_u->
v = -prev_v->
u;
1160 prev_v->
u = (
FT_Pos)( next_u - prev_v );
1161 next_u->
v = -prev_v->
u;
1230 for ( seg = segments; seg < segment_limit; seg++ )
1256 for ( seg = segments; seg < segment_limit; seg++ )
1310 if ( edges < edge_limit )
1322 if (
point->flags & touch_flag )
1346 delta = edge->
fpos -
u;
1349 u = edge->
pos - ( edge->
opos - ou );
1351#ifdef FT_DEBUG_AUTOFIT
1352 point->before[dim] = edge;
1360 edge = edge_limit - 1;
1361 delta =
u - edge->
fpos;
1364 u = edge->
pos + ( ou - edge->
opos );
1366#ifdef FT_DEBUG_AUTOFIT
1368 point->after[dim] = edge;
1381 max = edge_limit - edges;
1390 for ( nn = 0; nn <
max; nn++ )
1391 if ( edges[nn].
fpos >=
u )
1394 if ( edges[nn].
fpos ==
u )
1405 mid = (
max +
min ) >> 1;
1411 else if (
u >
fpos )
1418#ifdef FT_DEBUG_AUTOFIT
1433#ifdef FT_DEBUG_AUTOFIT
1439 if (
before->scale == 0 )
1455 point->flags |= touch_flag;
1484 for (
p = p1;
p <
ref;
p++ )
1485 p->u =
p->v + delta;
1488 p->u =
p->v + delta;
1512 if ( ref1->
v > ref2->
v )
1528 for (
p = p1;
p <= p2;
p++ )
1547 for (
p = p1;
p <= p2;
p++ )
1604 for ( ; contour < contour_limit; contour++ )
1606 AF_Point first_touched, last_touched;
1610 end_point =
point->prev;
1611 first_point =
point;
1616 if (
point > end_point )
1619 if (
point->flags & touch_flag )
1625 first_touched =
point;
1630 (
point->flags & touch_flag ) != 0 );
1633 while (
point < end_point &&
1637 last_touched =
point;
1643 if (
point > end_point )
1646 if ( (
point->flags & touch_flag ) != 0 )
1654 last_touched,
point );
1659 if ( last_touched == first_touched )
1664 if ( last_touched < end_point )
1666 last_touched, first_touched );
1668 if ( first_touched >
points )
1670 last_touched, first_touched );
1691#ifdef AF_CONFIG_OPTION_USE_WARPER
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)
static void af_iup_interp(AF_Point p1, AF_Point p2, AF_Point ref1, AF_Point ref2)
af_glyph_hints_done(AF_GlyphHints hints)
static void af_iup_shift(AF_Point p1, AF_Point p2, AF_Point ref)
af_direction_compute(FT_Pos dx, FT_Pos dy)
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_EDGES_EMBEDDED
#define AF_CONTOURS_EMBEDDED
FT_BEGIN_HEADER enum AF_Dimension_ AF_Dimension
enum AF_Direction_ AF_Direction
#define AF_SEGMENTS_EMBEDDED
#define AF_FLAG_WEAK_INTERPOLATION
#define AF_POINTS_EMBEDDED
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
FT_DivFix(FT_Long a, FT_Long b)
FT_MulFix(FT_Long a, FT_Long b)
ft_corner_is_flat(FT_Pos in_x, FT_Pos in_y, FT_Pos out_x, FT_Pos out_y)
#define FT_ASSERT(condition)
#define FT_CURVE_TAG_CUBIC
#define FT_CURVE_TAG_CONIC
#define FT_CURVE_TAG(flag)
FT_BEGIN_HEADER typedef signed long FT_Pos
#define FT_NEW_ARRAY(ptr, count)
#define FT_RENEW_ARRAY(ptr, curcnt, newcnt)
#define FT_MEM_ZERO(dest, count)
@ FT_ORIENTATION_POSTSCRIPT
FT_Outline_Get_Orientation(FT_Outline *outline)
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
FT_BEGIN_HEADER typedef unsigned char FT_Bool
GLenum GLenum GLenum GLenum GLenum scale
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
GLfloat GLfloat GLfloat v2
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 * u
static char memory[1024 *256]
static unsigned __int64 next
namespace GUID const ADDRINFOEXW * hints
struct AF_AxisHintsRec_::@4363 embedded
__inline int before(__u32 seq1, __u32 seq2)
__inline int after(__u32 seq1, __u32 seq2)
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList