< prev index next >

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

Print this page

        

*** 1,21 **** ! /***************************************************************************/ ! /* */ ! /* afcjk.c */ ! /* */ ! /* Auto-fitter hinting routines for CJK writing system (body). */ ! /* */ ! /* Copyright 2006-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. */ ! /* */ ! /***************************************************************************/ /* * The algorithm is based on akito's autohint patch, archived at * * https://web.archive.org/web/20051219160454/http://www.kde.gr.jp:80/~akito/patch/freetype2/2.1.7/ --- 1,21 ---- ! /**************************************************************************** ! * ! * afcjk.c ! * ! * Auto-fitter hinting routines for CJK writing system (body). ! * ! * Copyright (C) 2006-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. ! * ! */ /* * The algorithm is based on akito's autohint patch, archived at * * https://web.archive.org/web/20051219160454/http://www.kde.gr.jp:80/~akito/patch/freetype2/2.1.7/
*** 25,35 **** #include <ft2build.h> #include FT_ADVANCES_H #include FT_INTERNAL_DEBUG_H #include "afglobal.h" - #include "afpic.h" #include "aflatin.h" #include "afcjk.h" #ifdef AF_CONFIG_OPTION_CJK --- 25,34 ----
*** 42,59 **** #ifdef AF_CONFIG_OPTION_USE_WARPER #include "afwarp.h" #endif ! /*************************************************************************/ ! /* */ ! /* 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_afcjk /*************************************************************************/ /*************************************************************************/ /***** *****/ --- 41,58 ---- #ifdef AF_CONFIG_OPTION_USE_WARPER #include "afwarp.h" #endif ! /************************************************************************** ! * ! * 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 afcjk /*************************************************************************/ /*************************************************************************/ /***** *****/
*** 90,116 **** FT_ULong glyph_index; int dim; AF_CJKMetricsRec dummy[1]; AF_Scaler scaler = &dummy->root.scaler; - #ifdef FT_CONFIG_OPTION_PIC - AF_FaceGlobals globals = metrics->root.globals; - #endif - AF_StyleClass style_class = metrics->root.style_class; ! AF_ScriptClass script_class = AF_SCRIPT_CLASSES_GET ! [style_class->script]; void* shaper_buf; const char* p; #ifdef FT_DEBUG_LEVEL_TRACE FT_ULong ch = 0; #endif p = script_class->standard_charstring; shaper_buf = af_shaper_buf_create( face ); /* We check a list of standard characters. The first match wins. */ glyph_index = 0; while ( *p ) --- 89,121 ---- FT_ULong glyph_index; int dim; AF_CJKMetricsRec dummy[1]; AF_Scaler scaler = &dummy->root.scaler; AF_StyleClass style_class = metrics->root.style_class; ! AF_ScriptClass script_class = af_script_classes[style_class->script]; + /* If HarfBuzz is not available, we need a pointer to a single */ + /* unsigned long value. */ + #ifdef FT_CONFIG_OPTION_USE_HARFBUZZ void* shaper_buf; + #else + FT_ULong shaper_buf_; + void* shaper_buf = &shaper_buf_; + #endif + const char* p; #ifdef FT_DEBUG_LEVEL_TRACE FT_ULong ch = 0; #endif p = script_class->standard_charstring; + + #ifdef FT_CONFIG_OPTION_USE_HARFBUZZ shaper_buf = af_shaper_buf_create( face ); + #endif /* We check a list of standard characters. The first match wins. */ glyph_index = 0; while ( *p )
*** 294,315 **** --- 299,329 ---- AF_StyleClass sc = metrics->root.style_class; AF_Blue_Stringset bss = sc->blue_stringset; const AF_Blue_StringRec* bs = &af_blue_stringsets[bss]; + /* If HarfBuzz is not available, we need a pointer to a single */ + /* unsigned long value. */ + #ifdef FT_CONFIG_OPTION_USE_HARFBUZZ void* shaper_buf; + #else + FT_ULong shaper_buf_; + void* shaper_buf = &shaper_buf_; + #endif /* we walk over the blue character strings as specified in the */ /* style's entry in the `af_blue_stringset' array, computing its */ /* extremum points (depending on the string properties) */ FT_TRACE5(( "cjk blue zones computation\n" "==========================\n" "\n" )); + #ifdef FT_CONFIG_OPTION_USE_HARFBUZZ shaper_buf = af_shaper_buf_create( face ); + #endif for ( ; bs->string != AF_BLUE_STRING_MAX; bs++ ) { const char* p = &af_blue_strings[bs->string]; FT_Pos* blue_ref;
*** 563,581 **** --- 577,605 ---- FT_Face face ) { FT_Bool started = 0, same_width = 1; FT_Fixed advance = 0, old_advance = 0; + /* If HarfBuzz is not available, we need a pointer to a single */ + /* unsigned long value. */ + #ifdef FT_CONFIG_OPTION_USE_HARFBUZZ void* shaper_buf; + #else + FT_ULong shaper_buf_; + void* shaper_buf = &shaper_buf_; + #endif /* in all supported charmaps, digits have character codes 0x30-0x39 */ const char digits[] = "0 1 2 3 4 5 6 7 8 9"; const char* p; p = digits; + + #ifdef FT_CONFIG_OPTION_USE_HARFBUZZ shaper_buf = af_shaper_buf_create( face ); + #endif while ( *p ) { FT_ULong glyph_index; unsigned int num_idx;
*** 998,1022 **** axis->num_edges = 0; scale = ( dim == AF_DIMENSION_HORZ ) ? hints->x_scale : hints->y_scale; ! /*********************************************************************/ ! /* */ ! /* We begin by generating a sorted table of edges for the current */ ! /* direction. To do so, we simply scan each segment and try to find */ ! /* an edge in our table that corresponds to its position. */ ! /* */ ! /* If no edge is found, we create and insert a new edge in the */ ! /* sorted table. Otherwise, we simply add the segment to the edge's */ ! /* list which is then processed in the second step to compute the */ ! /* edge's properties. */ ! /* */ ! /* Note that the edges table is sorted along the segment/edge */ ! /* position. */ ! /* */ ! /*********************************************************************/ edge_distance_threshold = FT_MulFix( laxis->edge_distance_threshold, scale ); if ( edge_distance_threshold > 64 / 4 ) edge_distance_threshold = FT_DivFix( 64 / 4, scale ); --- 1022,1046 ---- axis->num_edges = 0; scale = ( dim == AF_DIMENSION_HORZ ) ? hints->x_scale : hints->y_scale; ! /********************************************************************** ! * ! * We begin by generating a sorted table of edges for the current ! * direction. To do so, we simply scan each segment and try to find ! * an edge in our table that corresponds to its position. ! * ! * If no edge is found, we create and insert a new edge in the ! * sorted table. Otherwise, we simply add the segment to the edge's ! * list which is then processed in the second step to compute the ! * edge's properties. ! * ! * Note that the edges table is sorted along the segment/edge ! * position. ! * ! */ edge_distance_threshold = FT_MulFix( laxis->edge_distance_threshold, scale ); if ( edge_distance_threshold > 64 / 4 ) edge_distance_threshold = FT_DivFix( 64 / 4, scale );
*** 1112,1132 **** found->last->edge_next = seg; found->last = seg; } } ! /******************************************************************/ ! /* */ ! /* Good, we now compute each edge's properties according to the */ ! /* segments found on its position. Basically, these are */ ! /* */ ! /* - the edge's main direction */ ! /* - stem edge, serif edge or both (which defaults to stem then) */ ! /* - rounded edge, straight or both (which defaults to straight) */ ! /* - link for edge */ ! /* */ ! /******************************************************************/ /* first of all, set the `edge' field in each segment -- this is */ /* required in order to compute edge links */ /* --- 1136,1156 ---- found->last->edge_next = seg; found->last = seg; } } ! /******************************************************************* ! * ! * Good, we now compute each edge's properties according to the ! * segments found on its position. Basically, these are ! * ! * - the edge's main direction ! * - stem edge, serif edge or both (which defaults to stem then) ! * - rounded edge, straight or both (which defaults to straight) ! * - link for edge ! * ! */ /* first of all, set the `edge' field in each segment -- this is */ /* required in order to compute edge links */ /*
*** 1172,1182 **** else is_straight++; /* check for links -- if seg->serif is set, then seg->link must */ /* be ignored */ ! is_serif = (FT_Bool)( seg->serif && seg->serif->edge != edge ); if ( seg->link || is_serif ) { AF_Edge edge2; AF_Segment seg2; --- 1196,1206 ---- else is_straight++; /* check for links -- if seg->serif is set, then seg->link must */ /* be ignored */ ! is_serif = FT_BOOL( seg->serif && seg->serif->edge != edge ); if ( seg->link || is_serif ) { AF_Edge edge2; AF_Segment seg2;
< prev index next >