< prev index next >

src/java.desktop/share/native/libfreetype/src/autofit/afhints.c

Print this page

        

*** 1,37 **** ! /***************************************************************************/ ! /* */ ! /* afhints.c */ ! /* */ ! /* Auto-fitter hinting routines (body). */ ! /* */ ! /* Copyright 2003-2018 by */ ! /* David Turner, Robert Wilhelm, and Werner Lemberg. */ ! /* */ ! /* This file is part of the FreeType project, and may only be used, */ ! /* modified, and distributed under the terms of the FreeType project */ ! /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ ! /* this file you indicate that you have read the license and */ ! /* understand and accept it fully. */ ! /* */ ! /***************************************************************************/ #include "afhints.h" #include "aferrors.h" #include FT_INTERNAL_CALC_H #include FT_INTERNAL_DEBUG_H ! /*************************************************************************/ ! /* */ ! /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ ! /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ ! /* messages during execution. */ ! /* */ #undef FT_COMPONENT ! #define FT_COMPONENT trace_afhints /* Get new segment for given axis. */ FT_LOCAL_DEF( FT_Error ) --- 1,37 ---- ! /**************************************************************************** ! * ! * afhints.c ! * ! * Auto-fitter hinting routines (body). ! * ! * Copyright (C) 2003-2019 by ! * David Turner, Robert Wilhelm, and Werner Lemberg. ! * ! * This file is part of the FreeType project, and may only be used, ! * modified, and distributed under the terms of the FreeType project ! * license, LICENSE.TXT. By continuing to use, modify, or distribute ! * this file you indicate that you have read the license and ! * understand and accept it fully. ! * ! */ #include "afhints.h" #include "aferrors.h" #include FT_INTERNAL_CALC_H #include FT_INTERNAL_DEBUG_H ! /************************************************************************** ! * ! * The macro FT_COMPONENT is used in trace mode. It is an implicit ! * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log ! * messages during execution. ! */ #undef FT_COMPONENT ! #define FT_COMPONENT afhints /* Get new segment for given axis. */ FT_LOCAL_DEF( FT_Error )
*** 295,304 **** --- 295,317 ---- return segment_idx == -1 ? -1 : AF_INDEX_NUM( segment->edge, edges ); } + static int + af_get_strong_edge_index( AF_GlyphHints hints, + AF_Edge* strong_edges, + int dimension ) + { + AF_AxisHints axis = &hints->axis[dimension]; + AF_Edge edges = axis->edges; + + + return AF_INDEX_NUM( strong_edges[dimension], edges ); + } + + #ifdef __cplusplus extern "C" { #endif void af_glyph_hints_dump_points( AF_GlyphHints hints,
*** 315,326 **** if ( hints->num_points ) { AF_DUMP(( " index hedge hseg vedge vseg flags " /* " XXXXX XXXXX XXXXX XXXXX XXXXX XXXXXX" */ ! " xorg yorg xscale yscale xfit yfit" )); /* " XXXXX XXXXX XXXX.XX XXXX.XX XXXX.XX XXXX.XX" */ } else AF_DUMP(( " (none)\n" )); for ( point = points; point < limit; point++ ) --- 328,341 ---- if ( hints->num_points ) { AF_DUMP(( " index hedge hseg vedge vseg flags " /* " XXXXX XXXXX XXXXX XXXXX XXXXX XXXXXX" */ ! " xorg yorg xscale yscale xfit yfit " /* " XXXXX XXXXX XXXX.XX XXXX.XX XXXX.XX XXXX.XX" */ + " hbef haft vbef vaft" )); + /* " XXXXX XXXXX XXXXX XXXXX" */ } else AF_DUMP(( " (none)\n" )); for ( point = points; point < limit; point++ )
*** 328,348 **** int point_idx = AF_INDEX_NUM( point, points ); int segment_idx_0 = af_get_segment_index( hints, point_idx, 0 ); int segment_idx_1 = af_get_segment_index( hints, point_idx, 1 ); char buf1[16], buf2[16], buf3[16], buf4[16]; /* insert extra newline at the beginning of a contour */ if ( contour < climit && *contour == point ) { AF_DUMP(( "\n" )); contour++; } AF_DUMP(( " %5d %5s %5s %5s %5s %s" ! " %5d %5d %7.2f %7.2f %7.2f %7.2f\n", point_idx, af_print_idx( buf1, af_get_edge_index( hints, segment_idx_1, 1 ) ), af_print_idx( buf2, segment_idx_1 ), af_print_idx( buf3, --- 343,365 ---- int point_idx = AF_INDEX_NUM( point, points ); int segment_idx_0 = af_get_segment_index( hints, point_idx, 0 ); int segment_idx_1 = af_get_segment_index( hints, point_idx, 1 ); char buf1[16], buf2[16], buf3[16], buf4[16]; + char buf5[16], buf6[16], buf7[16], buf8[16]; /* insert extra newline at the beginning of a contour */ if ( contour < climit && *contour == point ) { AF_DUMP(( "\n" )); contour++; } AF_DUMP(( " %5d %5s %5s %5s %5s %s" ! " %5d %5d %7.2f %7.2f %7.2f %7.2f" ! " %5s %5s %5s %5s\n", point_idx, af_print_idx( buf1, af_get_edge_index( hints, segment_idx_1, 1 ) ), af_print_idx( buf2, segment_idx_1 ), af_print_idx( buf3,
*** 357,367 **** point->fx, point->fy, point->ox / 64.0, point->oy / 64.0, point->x / 64.0, ! point->y / 64.0 )); } AF_DUMP(( "\n" )); } #ifdef __cplusplus } --- 374,397 ---- point->fx, point->fy, point->ox / 64.0, point->oy / 64.0, point->x / 64.0, ! point->y / 64.0, ! ! af_print_idx( buf5, af_get_strong_edge_index( hints, ! point->before, ! 1 ) ), ! af_print_idx( buf6, af_get_strong_edge_index( hints, ! point->after, ! 1 ) ), ! af_print_idx( buf7, af_get_strong_edge_index( hints, ! point->before, ! 0 ) ), ! af_print_idx( buf8, af_get_strong_edge_index( hints, ! point->after, ! 0 ) ) )); } AF_DUMP(( "\n" )); } #ifdef __cplusplus }
*** 517,527 **** seg = &axis->segments[idx]; *offset = ( dim == AF_DIMENSION_HORZ ) ? seg->first->fx : seg->first->fy; if ( seg->edge ) ! *is_blue = (FT_Bool)( seg->edge->blue_edge != 0 ); else *is_blue = FALSE; if ( *is_blue ) *blue_offset = seg->edge->blue_edge->org; --- 547,557 ---- seg = &axis->segments[idx]; *offset = ( dim == AF_DIMENSION_HORZ ) ? seg->first->fx : seg->first->fy; if ( seg->edge ) ! *is_blue = FT_BOOL( seg->edge->blue_edge ); else *is_blue = FALSE; if ( *is_blue ) *blue_offset = seg->edge->blue_edge->org;
*** 896,905 **** --- 926,943 ---- endpoint = outline->contours[contour_index]; end = points + endpoint; prev = end; } } + + #ifdef FT_DEBUG_AUTOFIT + point->before[0] = NULL; + point->before[1] = NULL; + point->after[0] = NULL; + point->after[1] = NULL; + #endif + } } /* set up the contours array */ {
*** 1307,1325 **** --- 1345,1375 ---- edge = edges; delta = edge->fpos - u; if ( delta >= 0 ) { u = edge->pos - ( edge->opos - ou ); + + #ifdef FT_DEBUG_AUTOFIT + point->before[dim] = edge; + point->after[dim] = NULL; + #endif + goto Store_Point; } /* is the point after the last edge? */ edge = edge_limit - 1; delta = u - edge->fpos; if ( delta >= 0 ) { u = edge->pos + ( ou - edge->opos ); + + #ifdef FT_DEBUG_AUTOFIT + point->before[dim] = NULL; + point->after[dim] = edge; + #endif + goto Store_Point; } { FT_PtrDist min, max, mid;
*** 1362,1381 **** --- 1412,1442 ---- min = mid + 1; else { /* we are on the edge */ u = edge->pos; + + #ifdef FT_DEBUG_AUTOFIT + point->before[dim] = NULL; + point->after[dim] = NULL; + #endif + goto Store_Point; } } /* point is not on an edge */ { AF_Edge before = edges + min - 1; AF_Edge after = edges + min + 0; + #ifdef FT_DEBUG_AUTOFIT + point->before[dim] = before; + point->after[dim] = after; + #endif + /* assert( before && after && before != after ) */ if ( before->scale == 0 ) before->scale = FT_DivFix( after->pos - before->pos, after->fpos - before->fpos );
< prev index next >