4 * Copyright (C) 2011 by Werner Lemberg.
6 * This file is part of the ttfautohint library, and may only be used,
7 * modified, and distributed under the terms given in `COPYING'. By
8 * continuing to use, modify, or distribute this file you indicate that you
9 * have read `COPYING' and understand and accept it fully.
11 * The file `COPYING' mentioned in the previous paragraph is distributed
12 * with the ttfautohint library.
16 /* originally file `afhints.c' (2011-Mar-28) from FreeType */
18 /* heavily modified 2011 by Werner Lemberg <wl@gnu.org> */
25 /* get new segment for given axis */
28 ta_axis_hints_new_segment(TA_AxisHints axis
,
31 FT_Error error
= FT_Err_Ok
;
32 TA_Segment segment
= NULL
;
35 if (axis
->num_segments
>= axis
->max_segments
)
37 TA_Segment segments_new
;
39 FT_Int old_max
= axis
->max_segments
;
40 FT_Int new_max
= old_max
;
41 FT_Int big_max
= (FT_Int
)(FT_INT_MAX
/ sizeof (*segment
));
44 if (old_max
>= big_max
)
46 error
= FT_Err_Out_Of_Memory
;
50 new_max
+= (new_max
>> 2) + 4;
55 segments_new
= (TA_Segment
)realloc(axis
->segments
,
56 new_max
* sizeof (TA_SegmentRec
));
58 return FT_Err_Out_Of_Memory
;
60 axis
->segments
= segments_new
;
61 axis
->max_segments
= new_max
;
64 segment
= axis
->segments
+ axis
->num_segments
++;
72 /* get new edge for given axis, direction, and position */
75 ta_axis_hints_new_edge(TA_AxisHints axis
,
80 FT_Error error
= FT_Err_Ok
;
85 if (axis
->num_edges
>= axis
->max_edges
)
89 FT_Int old_max
= axis
->max_edges
;
90 FT_Int new_max
= old_max
;
91 FT_Int big_max
= (FT_Int
)(FT_INT_MAX
/ sizeof (*edge
));
94 if (old_max
>= big_max
)
96 error
= FT_Err_Out_Of_Memory
;
100 new_max
+= (new_max
>> 2) + 4;
101 if (new_max
< old_max
102 || new_max
> big_max
)
105 edges_new
= (TA_Edge
)realloc(axis
->edges
,
106 new_max
* sizeof (TA_EdgeRec
));
108 return FT_Err_Out_Of_Memory
;
110 axis
->edges
= edges_new
;
111 axis
->max_edges
= new_max
;
115 edge
= edges
+ axis
->num_edges
;
119 if (edge
[-1].fpos
< fpos
)
122 /* we want the edge with same position and minor direction */
123 /* to appear before those in the major one in the list */
124 if (edge
[-1].fpos
== fpos
125 && dir
== axis
->major_dir
)
134 memset(edge
, 0, sizeof (TA_EdgeRec
));
135 edge
->fpos
= (FT_Short
)fpos
;
136 edge
->dir
= (FT_Char
)dir
;
149 ta_dir_str(TA_Direction dir
)
176 #define TA_INDEX_NUM(ptr, base) \
177 ((ptr) ? ((ptr) - (base)) \
182 ta_glyph_hints_dump_points(TA_GlyphHints hints
)
184 TA_Point points
= hints
->points
;
185 TA_Point limit
= points
+ hints
->num_points
;
189 printf("Table of points:\n");
190 printf(" [ index | xorg | yorg | xscale | yscale"
191 " | xfit | yfit | flags ]\n");
193 for (point
= points
; point
< limit
; point
++)
195 printf(" [ %5d | %5d | %5d | %6.2f | %6.2f"
196 " | %5.2f | %5.2f | %c%c%c%c%c%c ]\n",
204 (point
->flags
& TA_FLAG_WEAK_INTERPOLATION
) ? 'w' : ' ',
205 (point
->flags
& TA_FLAG_INFLECTION
) ? 'i' : ' ',
206 (point
->flags
& TA_FLAG_EXTREMA_X
) ? '<' : ' ',
207 (point
->flags
& TA_FLAG_EXTREMA_Y
) ? 'v' : ' ',
208 (point
->flags
& TA_FLAG_ROUND_X
) ? '(' : ' ',
209 (point
->flags
& TA_FLAG_ROUND_Y
) ? 'u' : ' ');
216 ta_edge_flags_to_string(FT_Byte flags
)
218 static char temp
[32];
222 if (flags
& TA_EDGE_ROUND
)
224 memcpy(temp
+ pos
, "round", 5);
227 if (flags
& TA_EDGE_SERIF
)
231 memcpy(temp
+ pos
, "serif", 5);
243 /* dump the array of linked segments */
246 ta_glyph_hints_dump_segments(TA_GlyphHints hints
)
251 for (dimension
= 1; dimension
>= 0; dimension
--)
253 TA_AxisHints axis
= &hints
->axis
[dimension
];
254 TA_Point points
= hints
->points
;
255 TA_Edge edges
= axis
->edges
;
256 TA_Segment segments
= axis
->segments
;
257 TA_Segment limit
= segments
+ axis
->num_segments
;
261 printf("Table of %s segments:\n",
262 dimension
== TA_DIMENSION_HORZ
? "vertical"
264 printf(" [ index | pos | dir | from | to | link | serif | edge |"
265 " height | extra | flags ]\n");
267 for (seg
= segments
; seg
< limit
; seg
++)
269 printf(" [ %5d | %5.2g | %5s | %4d | %4d | %4d | %5d | %4d |"
270 " %6d | %5d | %11s ]\n",
272 dimension
== TA_DIMENSION_HORZ
? (int)seg
->first
->ox
/ 64.0
273 : (int)seg
->first
->oy
/ 64.0,
274 ta_dir_str((TA_Direction
)seg
->dir
),
275 TA_INDEX_NUM(seg
->first
, points
),
276 TA_INDEX_NUM(seg
->last
, points
),
277 TA_INDEX_NUM(seg
->link
, segments
),
278 TA_INDEX_NUM(seg
->serif
, segments
),
279 TA_INDEX_NUM(seg
->edge
, edges
),
281 seg
->height
- (seg
->max_coord
- seg
->min_coord
),
282 ta_edge_flags_to_string(seg
->flags
));
289 /* dump the array of linked edges */
292 ta_glyph_hints_dump_edges(TA_GlyphHints hints
)
297 for (dimension
= 1; dimension
>= 0; dimension
--)
299 TA_AxisHints axis
= &hints
->axis
[dimension
];
300 TA_Edge edges
= axis
->edges
;
301 TA_Edge limit
= edges
+ axis
->num_edges
;
305 /* note that TA_DIMENSION_HORZ corresponds to _vertical_ edges */
306 /* since they have a constant X coordinate */
307 printf("Table of %s edges:\n",
308 dimension
== TA_DIMENSION_HORZ
? "vertical"
310 printf(" [ index | pos | dir | link |"
311 " serif | blue | opos | pos | flags ]\n");
313 for (edge
= edges
; edge
< limit
; edge
++)
315 printf(" [ %5d | %5.2g | %5s | %4d |"
316 " %5d | %c | %5.2f | %5.2f | %11s ]\n",
318 (int)edge
->opos
/ 64.0,
319 ta_dir_str((TA_Direction
)edge
->dir
),
320 TA_INDEX_NUM(edge
->link
, edges
),
321 TA_INDEX_NUM(edge
->serif
, edges
),
322 edge
->blue_edge
? 'y' : 'n',
325 ta_edge_flags_to_string(edge
->flags
));
333 ta_glyph_hints_dump_edge_links(TA_GlyphHints hints
)
338 for (dimension
= 1; dimension
>= 0; dimension
--)
340 TA_AxisHints axis
= &hints
->axis
[dimension
];
341 TA_Segment segments
= axis
->segments
;
342 TA_Edge edges
= axis
->edges
;
343 TA_Edge limit
= edges
+ axis
->num_edges
;
349 printf("%s edges consist of the following segments:\n",
350 dimension
== TA_DIMENSION_HORZ
? "Vertical"
352 for (edge
= edges
; edge
< limit
; edge
++)
354 printf(" %2d:", edge
- edges
);
359 printf(" %d", seg
- segments
);
360 seg
= seg
->edge_next
;
361 } while (seg
!= edge
->first
);
369 #endif /* TA_DEBUG */
372 /* compute the direction value of a given vector */
375 ta_direction_compute(FT_Pos dx
,
378 FT_Pos ll
, ss
; /* long and short arm lengths */
379 TA_Direction dir
; /* candidate direction */
413 /* return no direction if arm lengths differ too much */
414 /* (value 14 is heuristic) */
416 if (TA_ABS(ll
) <= TA_ABS(ss
))
424 ta_glyph_hints_init(TA_GlyphHints hints
)
426 memset(hints
, 0, sizeof (TA_GlyphHintsRec
));
431 ta_glyph_hints_done(TA_GlyphHints hints
)
439 /* we don't need to free the segment and edge buffers */
440 /* since they are really within the hints->points array */
441 for (dim
= 0; dim
< TA_DIMENSION_MAX
; dim
++)
443 TA_AxisHints axis
= &hints
->axis
[dim
];
446 axis
->num_segments
= 0;
447 axis
->max_segments
= 0;
448 free(axis
->segments
);
449 axis
->segments
= NULL
;
457 free(hints
->contours
);
458 hints
->contours
= NULL
;
459 hints
->max_contours
= 0;
460 hints
->num_contours
= 0;
463 hints
->points
= NULL
;
464 hints
->num_points
= 0;
465 hints
->max_points
= 0;
472 ta_glyph_hints_rescale(TA_GlyphHints hints
,
473 TA_ScriptMetrics metrics
)
475 hints
->metrics
= metrics
;
476 hints
->scaler_flags
= metrics
->scaler
.flags
;
480 /* from FreeType's ftcalc.c */
483 ta_corner_is_flat(FT_Pos in_x
,
491 FT_Pos d_in
, d_out
, d_corner
;
516 return (d_in
+ d_out
- d_corner
) < (d_corner
>> 4);
520 /* recompute all TA_Point in TA_GlyphHints */
521 /* from the definitions in a source outline */
524 ta_glyph_hints_reload(TA_GlyphHints hints
,
527 FT_Error error
= FT_Err_Ok
;
529 FT_UInt old_max
, new_max
;
531 FT_Fixed x_scale
= hints
->x_scale
;
532 FT_Fixed y_scale
= hints
->y_scale
;
533 FT_Pos x_delta
= hints
->x_delta
;
534 FT_Pos y_delta
= hints
->y_delta
;
537 hints
->num_points
= 0;
538 hints
->num_contours
= 0;
540 hints
->axis
[0].num_segments
= 0;
541 hints
->axis
[0].num_edges
= 0;
542 hints
->axis
[1].num_segments
= 0;
543 hints
->axis
[1].num_edges
= 0;
545 /* first of all, reallocate the contours array if necessary */
546 new_max
= (FT_UInt
)outline
->n_contours
;
547 old_max
= hints
->max_contours
;
548 if (new_max
> old_max
)
550 TA_Point
* contours_new
;
553 new_max
= (new_max
+ 3) & ~3; /* round up to a multiple of 4 */
555 contours_new
= (TA_Point
*)realloc(hints
->contours
,
556 new_max
* sizeof (TA_Point
));
558 return FT_Err_Out_Of_Memory
;
560 hints
->contours
= contours_new
;
561 hints
->max_contours
= new_max
;
564 /* reallocate the points arrays if necessary -- we reserve */
565 /* two additional point positions, used to hint metrics appropriately */
566 new_max
= (FT_UInt
)(outline
->n_points
+ 2);
567 old_max
= hints
->max_points
;
568 if (new_max
> old_max
)
573 new_max
= (new_max
+ 2 + 7) & ~7; /* round up to a multiple of 8 */
575 points_new
= (TA_Point
)realloc(hints
->points
,
576 new_max
* sizeof (TA_PointRec
));
578 return FT_Err_Out_Of_Memory
;
580 hints
->points
= points_new
;
581 hints
->max_points
= new_max
;
584 hints
->num_points
= outline
->n_points
;
585 hints
->num_contours
= outline
->n_contours
;
587 /* we can't rely on the value of `FT_Outline.flags' to know the fill */
588 /* direction used for a glyph, given that some fonts are broken */
589 /* (e.g. the Arphic ones); we thus recompute it each time we need to */
591 hints
->axis
[TA_DIMENSION_HORZ
].major_dir
= TA_DIR_UP
;
592 hints
->axis
[TA_DIMENSION_VERT
].major_dir
= TA_DIR_LEFT
;
594 if (FT_Outline_Get_Orientation(outline
) == FT_ORIENTATION_POSTSCRIPT
)
596 hints
->axis
[TA_DIMENSION_HORZ
].major_dir
= TA_DIR_DOWN
;
597 hints
->axis
[TA_DIMENSION_VERT
].major_dir
= TA_DIR_RIGHT
;
600 hints
->x_scale
= x_scale
;
601 hints
->y_scale
= y_scale
;
602 hints
->x_delta
= x_delta
;
603 hints
->y_delta
= y_delta
;
605 hints
->xmin_delta
= 0;
606 hints
->xmax_delta
= 0;
608 points
= hints
->points
;
609 if (hints
->num_points
== 0)
614 TA_Point point_limit
= points
+ hints
->num_points
;
617 /* compute coordinates & Bezier flags, next and prev */
619 FT_Vector
* vec
= outline
->points
;
620 char* tag
= outline
->tags
;
622 TA_Point end
= points
+ outline
->contours
[0];
625 FT_Int contour_index
= 0;
628 for (point
= points
; point
< point_limit
; point
++, vec
++, tag
++)
630 point
->fx
= (FT_Short
)vec
->x
;
631 point
->fy
= (FT_Short
)vec
->y
;
632 point
->ox
= point
->x
= FT_MulFix(vec
->x
, x_scale
) + x_delta
;
633 point
->oy
= point
->y
= FT_MulFix(vec
->y
, y_scale
) + y_delta
;
635 switch (FT_CURVE_TAG(*tag
))
637 case FT_CURVE_TAG_CONIC
:
638 point
->flags
= TA_FLAG_CONIC
;
640 case FT_CURVE_TAG_CUBIC
:
641 point
->flags
= TA_FLAG_CUBIC
;
644 point
->flags
= TA_FLAG_NONE
;
653 if (++contour_index
< outline
->n_contours
)
655 end
= points
+ outline
->contours
[contour_index
];
662 /* set up the contours array */
664 TA_Point
* contour
= hints
->contours
;
665 TA_Point
* contour_limit
= contour
+ hints
->num_contours
;
667 short* end
= outline
->contours
;
671 for (; contour
< contour_limit
; contour
++, end
++)
673 contour
[0] = points
+ idx
;
674 idx
= (short)(end
[0] + 1);
678 /* compute directions of in & out vectors */
680 TA_Point first
= points
;
681 TA_Point prev
= NULL
;
686 TA_Direction in_dir
= TA_DIR_NONE
;
689 for (point
= points
; point
< point_limit
; point
++)
698 in_x
= first
->fx
- prev
->fx
;
699 in_y
= first
->fy
- prev
->fy
;
700 in_dir
= ta_direction_compute(in_x
, in_y
);
704 point
->in_dir
= (FT_Char
)in_dir
;
707 out_x
= next
->fx
- point
->fx
;
708 out_y
= next
->fy
- point
->fy
;
710 in_dir
= ta_direction_compute(out_x
, out_y
);
711 point
->out_dir
= (FT_Char
)in_dir
;
713 /* check for weak points */
715 if (point
->flags
& TA_FLAG_CONTROL
)
718 point
->flags
|= TA_FLAG_WEAK_INTERPOLATION
;
720 else if (point
->out_dir
== point
->in_dir
)
722 if (point
->out_dir
!= TA_DIR_NONE
)
725 if (ta_corner_is_flat(in_x
, in_y
, out_x
, out_y
))
728 else if (point
->in_dir
== -point
->out_dir
)
743 /* store the hinted outline in an FT_Outline structure */
746 ta_glyph_hints_save(TA_GlyphHints hints
,
749 TA_Point point
= hints
->points
;
750 TA_Point limit
= point
+ hints
->num_points
;
752 FT_Vector
* vec
= outline
->points
;
753 char* tag
= outline
->tags
;
756 for (; point
< limit
; point
++, vec
++, tag
++)
761 if (point
->flags
& TA_FLAG_CONIC
)
762 tag
[0] = FT_CURVE_TAG_CONIC
;
763 else if (point
->flags
& TA_FLAG_CUBIC
)
764 tag
[0] = FT_CURVE_TAG_CUBIC
;
766 tag
[0] = FT_CURVE_TAG_ON
;
771 /****************************************************************
773 * EDGE POINT GRID-FITTING
775 ****************************************************************/
778 /* align all points of an edge to the same coordinate value, */
779 /* either horizontally or vertically */
782 ta_glyph_hints_align_edge_points(TA_GlyphHints hints
,
785 TA_AxisHints axis
= &hints
->axis
[dim
];
786 TA_Segment segments
= axis
->segments
;
787 TA_Segment segment_limit
= segments
+ axis
->num_segments
;
791 if (dim
== TA_DIMENSION_HORZ
)
793 for (seg
= segments
; seg
< segment_limit
; seg
++)
795 TA_Edge edge
= seg
->edge
;
796 TA_Point point
, first
, last
;
807 point
->x
= edge
->pos
;
808 point
->flags
|= TA_FLAG_TOUCH_X
;
819 for (seg
= segments
; seg
< segment_limit
; seg
++)
821 TA_Edge edge
= seg
->edge
;
822 TA_Point point
, first
, last
;
833 point
->y
= edge
->pos
;
834 point
->flags
|= TA_FLAG_TOUCH_Y
;
846 /****************************************************************
848 * STRONG POINT INTERPOLATION
850 ****************************************************************/
853 /* hint the strong points -- */
854 /* this is equivalent to the TrueType `IP' hinting instruction */
857 ta_glyph_hints_align_strong_points(TA_GlyphHints hints
,
860 TA_Point points
= hints
->points
;
861 TA_Point point_limit
= points
+ hints
->num_points
;
863 TA_AxisHints axis
= &hints
->axis
[dim
];
865 TA_Edge edges
= axis
->edges
;
866 TA_Edge edge_limit
= edges
+ axis
->num_edges
;
868 FT_UShort touch_flag
;
871 if (dim
== TA_DIMENSION_HORZ
)
872 touch_flag
= TA_FLAG_TOUCH_X
;
874 touch_flag
= TA_FLAG_TOUCH_Y
;
876 if (edges
< edge_limit
)
882 for (point
= points
; point
< point_limit
; point
++)
884 FT_Pos u
, ou
, fu
; /* point position */
888 if (point
->flags
& touch_flag
)
891 /* if this point is candidate to weak interpolation, we */
892 /* interpolate it after all strong points have been processed */
894 if ((point
->flags
& TA_FLAG_WEAK_INTERPOLATION
)
895 && !(point
->flags
& TA_FLAG_INFLECTION
))
898 if (dim
== TA_DIMENSION_VERT
)
911 /* is the point before the first edge? */
913 delta
= edge
->fpos
- u
;
916 u
= edge
->pos
- (edge
->opos
- ou
);
919 hints
->recorder(ta_ip_before
, hints
, dim
,
920 point
, NULL
, NULL
, NULL
, NULL
);
925 /* is the point after the last edge? */
926 edge
= edge_limit
- 1;
927 delta
= u
- edge
->fpos
;
930 u
= edge
->pos
+ (ou
- edge
->opos
);
933 hints
->recorder(ta_ip_after
, hints
, dim
,
934 point
, NULL
, NULL
, NULL
, NULL
);
940 FT_PtrDist min
, max
, mid
;
944 /* find enclosing edges */
946 max
= edge_limit
- edges
;
948 /* for a small number of edges, a linear search is better */
954 for (nn
= 0; nn
< max
; nn
++)
955 if (edges
[nn
].fpos
>= u
)
958 if (edges
[nn
].fpos
== u
)
963 hints
->recorder(ta_ip_on
, hints
, dim
,
964 point
, &edges
[nn
], NULL
, NULL
, NULL
);
973 mid
= (max
+ min
) >> 1;
983 /* we are on the edge */
987 hints
->recorder(ta_ip_on
, hints
, dim
,
988 point
, edge
, NULL
, NULL
, NULL
);
994 /* point is not on an edge */
996 TA_Edge before
= edges
+ min
- 1;
997 TA_Edge after
= edges
+ min
+ 0;
1000 /* assert(before && after && before != after) */
1001 if (before
->scale
== 0)
1002 before
->scale
= FT_DivFix(after
->pos
- before
->pos
,
1003 after
->fpos
- before
->fpos
);
1005 u
= before
->pos
+ FT_MulFix(fu
- before
->fpos
,
1008 if (hints
->recorder
)
1009 hints
->recorder(ta_ip_between
, hints
, dim
,
1010 point
, before
, after
, NULL
, NULL
);
1015 /* save the point position */
1016 if (dim
== TA_DIMENSION_HORZ
)
1021 point
->flags
|= touch_flag
;
1027 /****************************************************************
1029 * WEAK POINT INTERPOLATION
1031 ****************************************************************/
1034 /* shift the original coordinates of all points between `p1' and */
1035 /* `p2' to get hinted coordinates, using the same difference as */
1036 /* given by `ref' */
1039 ta_iup_shift(TA_Point p1
,
1044 FT_Pos delta
= ref
->u
- ref
->v
;
1050 for (p
= p1
; p
< ref
; p
++)
1051 p
->u
= p
->v
+ delta
;
1053 for (p
= ref
+ 1; p
<= p2
; p
++)
1054 p
->u
= p
->v
+ delta
;
1058 /* interpolate the original coordinates of all points between `p1' and */
1059 /* `p2' to get hinted coordinates, using `ref1' and `ref2' as the */
1060 /* reference points; the `u' and `v' members are the current and */
1061 /* original coordinate values, respectively. */
1063 /* details can be found in the TrueType bytecode specification */
1066 ta_iup_interp(TA_Point p1
,
1073 FT_Pos v1
= ref1
->v
;
1074 FT_Pos v2
= ref2
->v
;
1075 FT_Pos d1
= ref1
->u
- v1
;
1076 FT_Pos d2
= ref2
->u
- v2
;
1084 for (p
= p1
; p
<= p2
; p
++)
1100 for (p
= p1
; p
<= p2
; p
++)
1109 u
= ref1
->u
+ FT_MulDiv(u
- v1
, ref2
->u
- ref1
->u
, v2
- v1
);
1116 for (p
= p1
; p
<= p2
; p
++)
1125 u
= ref1
->u
+ FT_MulDiv(u
- v1
, ref2
->u
- ref1
->u
, v2
- v1
);
1133 /* hint the weak points -- */
1134 /* this is equivalent to the TrueType `IUP' hinting instruction */
1137 ta_glyph_hints_align_weak_points(TA_GlyphHints hints
,
1140 TA_Point points
= hints
->points
;
1141 TA_Point point_limit
= points
+ hints
->num_points
;
1143 TA_Point
* contour
= hints
->contours
;
1144 TA_Point
* contour_limit
= contour
+ hints
->num_contours
;
1146 FT_UShort touch_flag
;
1149 TA_Point first_point
;
1152 /* pass 1: move segment points to edge positions */
1154 if (dim
== TA_DIMENSION_HORZ
)
1156 touch_flag
= TA_FLAG_TOUCH_X
;
1158 for (point
= points
; point
< point_limit
; point
++)
1160 point
->u
= point
->x
;
1161 point
->v
= point
->ox
;
1166 touch_flag
= TA_FLAG_TOUCH_Y
;
1168 for (point
= points
; point
< point_limit
; point
++)
1170 point
->u
= point
->y
;
1171 point
->v
= point
->oy
;
1177 for (; contour
< contour_limit
; contour
++)
1179 TA_Point first_touched
, last_touched
;
1183 end_point
= point
->prev
;
1184 first_point
= point
;
1186 /* find first touched point */
1189 if (point
> end_point
) /* no touched point in contour */
1192 if (point
->flags
& touch_flag
)
1198 first_touched
= point
;
1199 last_touched
= point
;
1203 /* skip any touched neighbours */
1204 while (point
< end_point
1205 && (point
[1].flags
& touch_flag
) != 0)
1208 last_touched
= point
;
1210 /* find the next touched point, if any */
1214 if (point
> end_point
)
1217 if ((point
->flags
& touch_flag
) != 0)
1223 /* interpolate between last_touched and point */
1224 ta_iup_interp(last_touched
+ 1, point
- 1,
1225 last_touched
, point
);
1229 /* special case: only one point was touched */
1230 if (last_touched
== first_touched
)
1231 ta_iup_shift(first_point
, end_point
, first_touched
);
1233 else /* interpolate the last part */
1235 if (last_touched
< end_point
)
1236 ta_iup_interp(last_touched
+ 1, end_point
,
1237 last_touched
, first_touched
);
1239 if (first_touched
> points
)
1240 ta_iup_interp(first_point
, first_touched
- 1,
1241 last_touched
, first_touched
);
1248 /* now save the interpolated values back to x/y */
1249 if (dim
== TA_DIMENSION_HORZ
)
1251 for (point
= points
; point
< point_limit
; point
++)
1252 point
->x
= point
->u
;
1256 for (point
= points
; point
< point_limit
; point
++)
1257 point
->y
= point
->u
;
1262 #ifdef TA_CONFIG_OPTION_USE_WARPER
1264 /* apply (small) warp scale and warp delta for given dimension */
1267 ta_glyph_hints_scale_dim(TA_GlyphHints hints
,
1272 TA_Point points
= hints
->points
;
1273 TA_Point points_limit
= points
+ hints
->num_points
;
1277 if (dim
== TA_DIMENSION_HORZ
)
1279 for (point
= points
; point
< points_limit
; point
++)
1280 point
->x
= FT_MulFix(point
->fx
, scale
) + delta
;
1284 for (point
= points
; point
< points_limit
; point
++)
1285 point
->y
= FT_MulFix(point
->fy
, scale
) + delta
;
1289 #endif /* TA_CONFIG_OPTION_USE_WARPER */
1291 /* end of tahints.c */