21 #include FT_INTERNAL_CALC_H 22 #include FT_INTERNAL_DEBUG_H 32 #define FT_COMPONENT trace_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 );
314 AF_DUMP((
"Table of points:\n" ));
316 if (
hints->num_points )
318 AF_DUMP((
" index hedge hseg vedge vseg flags " 320 " xorg yorg xscale yscale xfit yfit" ));
324 AF_DUMP((
" (none)\n" ));
329 int segment_idx_0 = af_get_segment_index(
hints, point_idx, 0 );
330 int segment_idx_1 = af_get_segment_index(
hints, point_idx, 1 );
332 char buf1[16], buf2[16], buf3[16], buf4[16];
336 if ( contour < climit && *contour ==
point )
342 AF_DUMP((
" %5d %5s %5s %5s %5s %s" 343 " %5d %5d %7.2f %7.2f %7.2f %7.2f\n",
346 af_get_edge_index(
hints, segment_idx_1, 1 ) ),
347 af_print_idx( buf2, segment_idx_1 ),
349 af_get_edge_index(
hints, segment_idx_0, 0 ) ),
350 af_print_idx( buf4, segment_idx_0 ),
374 static char temp[32];
411 for ( dimension = 1; dimension >= 0; dimension-- )
420 char buf1[16], buf2[16], buf3[16];
423 AF_DUMP((
"Table of %s segments:\n",
428 AF_DUMP((
" index pos delta dir from to " 432 " height extra flags\n" ));
436 AF_DUMP((
" (none)\n" ));
439 AF_DUMP((
" %5d %5d %5d %5s %4d %4d" 442 AF_INDEX_NUM(
seg, segments ),
449 af_print_idx( buf1, AF_INDEX_NUM(
seg->link, segments ) ),
450 af_print_idx( buf2, AF_INDEX_NUM(
seg->serif, segments ) ),
451 af_print_idx( buf3, AF_INDEX_NUM(
seg->edge, edges ) ),
454 seg->height - (
seg->max_coord -
seg->min_coord ),
455 af_edge_flags_to_string(
seg->flags ) ));
480 axis = &
hints->axis[dim];
509 return FT_THROW( Invalid_Argument );
513 axis = &
hints->axis[dim];
516 return FT_THROW( Invalid_Argument );
522 *is_blue = (
FT_Bool)(
seg->edge->blue_edge != 0 );
527 *blue_offset =
seg->edge->blue_edge->org;
550 for ( dimension = 1; dimension >= 0; dimension-- )
557 char buf1[16], buf2[16];
565 AF_DUMP((
"Table of %s edges (1px=%.2fu, 10u=%.2fpx):\n",
567 65536.0 * 64.0 /
hints->x_scale,
568 10.0 *
hints->x_scale / 65536.0 / 64.0 ));
570 AF_DUMP((
"Table of %s edges (1px=%.2fu, 10u=%.2fpx):\n",
572 65536.0 * 64.0 /
hints->y_scale,
573 10.0 *
hints->y_scale / 65536.0 / 64.0 ));
577 AF_DUMP((
" index pos dir link serif" 579 " blue opos pos flags\n" ));
583 AF_DUMP((
" (none)\n" ));
585 for ( edge = edges; edge <
limit; edge++ )
586 AF_DUMP((
" %5d %7.2f %5s %4s %5s" 587 " %c %7.2f %7.2f %11s\n",
588 AF_INDEX_NUM( edge, edges ),
589 (
int)edge->
opos / 64.0,
591 af_print_idx( buf1, AF_INDEX_NUM( edge->
link, edges ) ),
592 af_print_idx( buf2, AF_INDEX_NUM( edge->
serif, edges ) ),
597 af_edge_flags_to_string( edge->
flags ) ));
703 if (
hints->contours !=
hints->embedded.contours )
705 hints->max_contours = 0;
706 hints->num_contours = 0;
708 if (
hints->points !=
hints->embedded.points )
710 hints->max_points = 0;
711 hints->num_points = 0;
745 hints->num_points = 0;
746 hints->num_contours = 0;
748 hints->axis[0].num_segments = 0;
749 hints->axis[0].num_edges = 0;
750 hints->axis[1].num_segments = 0;
751 hints->axis[1].num_edges = 0;
759 if ( !
hints->contours )
765 else if ( new_max > old_max )
767 if (
hints->contours ==
hints->embedded.contours )
770 new_max = ( new_max + 3 ) & ~3
U;
788 if ( !
hints->points )
794 else if ( new_max > old_max )
796 if (
hints->points ==
hints->embedded.points )
799 new_max = ( new_max + 2 + 7 ) & ~7
U;
823 hints->x_scale = x_scale;
824 hints->y_scale = y_scale;
825 hints->x_delta = x_delta;
826 hints->y_delta = y_delta;
828 hints->xmin_delta = 0;
829 hints->xmax_delta = 0;
832 if (
hints->num_points == 0 )
840 FT_UInt units_per_em =
hints->metrics->scaler.face->units_per_EM;
841 FT_Int near_limit = 20 * units_per_em / 2048;
894 if ( ++contour_index < outline->n_contours )
912 for ( ; contour < contour_limit; contour++,
end++ )
932 FT_Int near_limit2 = 2 * near_limit - 1;
938 for ( contour =
hints->contours; contour < contour_limit; contour++ )
953 while ( prev !=
first )
1021 for ( curr = curr->
next; curr !=
next; curr = curr->
next )
1063 in_x =
point->fx - prev_v->
fx;
1064 in_y =
point->fy - prev_v->
fy;
1066 out_x = next_u->
fx -
point->fx;
1067 out_y = next_u->
fy -
point->fy;
1069 if ( ( in_x ^ out_x ) >= 0 && ( in_y ^ out_y ) >= 0 )
1076 prev_v->
u = (
FT_Pos)( next_u - prev_v );
1077 next_u->
v = -prev_v->
u;
1122 prev_v->
u = (
FT_Pos)( next_u - prev_v );
1123 next_u->
v = -prev_v->
u;
1192 for (
seg = segments;
seg < segment_limit;
seg++ )
1218 for (
seg = segments;
seg < segment_limit;
seg++ )
1272 if ( edges < edge_limit )
1284 if (
point->flags & touch_flag )
1308 delta = edge->
fpos -
u;
1311 u = edge->
pos - ( edge->
opos - ou );
1316 edge = edge_limit - 1;
1317 delta =
u - edge->
fpos;
1320 u = edge->
pos + ( ou - edge->
opos );
1331 max = edge_limit - edges;
1340 for ( nn = 0; nn <
max; nn++ )
1341 if ( edges[nn].
fpos >=
u )
1344 if ( edges[nn].
fpos ==
u )
1355 mid = (
max +
min ) >> 1;
1361 else if (
u >
fpos )
1378 if (
before->scale == 0 )
1394 point->flags |= touch_flag;
1423 for (
p = p1;
p <
ref;
p++ )
1424 p->u =
p->v + delta;
1427 p->u =
p->v + delta;
1451 if ( ref1->
v > ref2->
v )
1467 for (
p = p1;
p <= p2;
p++ )
1486 for (
p = p1;
p <= p2;
p++ )
1543 for ( ; contour < contour_limit; contour++ )
1545 AF_Point first_touched, last_touched;
1549 end_point =
point->prev;
1550 first_point =
point;
1555 if (
point > end_point )
1558 if (
point->flags & touch_flag )
1564 first_touched =
point;
1569 (
point->flags & touch_flag ) != 0 );
1572 while (
point < end_point &&
1576 last_touched =
point;
1582 if (
point > end_point )
1585 if ( (
point->flags & touch_flag ) != 0 )
1593 last_touched,
point );
1598 if ( last_touched == first_touched )
1603 if ( last_touched < end_point )
1605 last_touched, first_touched );
1607 if ( first_touched >
points )
1609 last_touched, first_touched );
1630 #ifdef AF_CONFIG_OPTION_USE_WARPER 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
namespace GUID const ADDRINFOEXW * hints
af_glyph_hints_save(AF_GlyphHints hints, FT_Outline *outline)
FT_DivFix(FT_Long a, FT_Long b)
#define AF_FLAG_WEAK_INTERPOLATION
af_glyph_hints_align_edge_points(AF_GlyphHints hints, AF_Dimension dim)
af_glyph_hints_done(AF_GlyphHints hints)
FT_BEGIN_HEADER typedef signed long FT_Pos
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
#define FT_MEM_ZERO(dest, count)
#define FT_CURVE_TAG_CUBIC
GLenum GLenum GLenum GLenum GLenum scale
af_glyph_hints_init(AF_GlyphHints hints, FT_Memory memory)
static void af_iup_interp(AF_Point p1, AF_Point p2, AF_Point ref1, AF_Point ref2)
__inline int before(__u32 seq1, __u32 seq2)
FT_Outline_Get_Orientation(FT_Outline *outline)
enum AF_Direction_ AF_Direction
static char memory[1024 *256]
af_glyph_hints_reload(AF_GlyphHints hints, FT_Outline *outline)
FT_BEGIN_HEADER typedef unsigned char FT_Bool
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)
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
#define FT_ASSERT(condition)
ft_corner_is_flat(FT_Pos in_x, FT_Pos in_y, FT_Pos out_x, FT_Pos out_y)
af_glyph_hints_rescale(AF_GlyphHints hints, AF_StyleMetrics metrics)
struct AF_AxisHintsRec_::@3862 embedded
af_glyph_hints_align_strong_points(AF_GlyphHints hints, AF_Dimension dim)
#define FT_RENEW_ARRAY(ptr, curcnt, newcnt)
af_direction_compute(FT_Pos dx, FT_Pos dy)
GLsizei const GLfloat * points
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
__inline int after(__u32 seq1, __u32 seq2)
#define FT_NEW_ARRAY(ptr, count)
FT_MulFix(FT_Long a, FT_Long b)
af_axis_hints_new_segment(AF_AxisHints axis, FT_Memory memory, AF_Segment *asegment)
GLfloat GLfloat GLfloat v2
FT_BEGIN_HEADER enum AF_Dimension_ AF_Dimension
static unsigned __int64 next
static void af_iup_shift(AF_Point p1, AF_Point p2, AF_Point ref)
#define FT_CURVE_TAG_CONIC
#define AF_EDGES_EMBEDDED
af_glyph_hints_align_weak_points(AF_GlyphHints hints, AF_Dimension dim)
#define FT_CURVE_TAG(flag)
#define AF_CONTOURS_EMBEDDED
#define AF_SEGMENTS_EMBEDDED
#define AF_POINTS_EMBEDDED