diff options
author | Nick Kralevich <nnk@google.com> | 2010-09-14 17:02:58 -0700 |
---|---|---|
committer | Nick Kralevich <nnk@google.com> | 2010-09-15 10:32:30 -0700 |
commit | aacb8e1368a883fcbc9fe64fd0e460cef9c9b20c (patch) | |
tree | 2b4c5412391bf31f6a54b237ea83bfde05ec3802 /src/autofit | |
parent | d4476115dee94297c020b3a2b067188117424e25 (diff) | |
download | android_external_freetype-aacb8e1368a883fcbc9fe64fd0e460cef9c9b20c.tar.gz android_external_freetype-aacb8e1368a883fcbc9fe64fd0e460cef9c9b20c.tar.bz2 android_external_freetype-aacb8e1368a883fcbc9fe64fd0e460cef9c9b20c.zip |
upgrade freetype to 2.4.2.
Bug: 2969145
Change-Id: I8debbbe0bd478d9cf8c39cff5179981b5f3b371a
Diffstat (limited to 'src/autofit')
-rw-r--r-- | src/autofit/afcjk.c | 8 | ||||
-rw-r--r-- | src/autofit/afglobal.c | 11 | ||||
-rw-r--r-- | src/autofit/afglobal.h | 2 | ||||
-rw-r--r-- | src/autofit/afhints.c | 133 | ||||
-rw-r--r-- | src/autofit/afhints.h | 5 | ||||
-rw-r--r-- | src/autofit/aflatin.c | 6 | ||||
-rw-r--r-- | src/autofit/aflatin2.c | 83 | ||||
-rw-r--r-- | src/autofit/afloader.c | 14 | ||||
-rw-r--r-- | src/autofit/afpic.c | 18 |
9 files changed, 81 insertions, 199 deletions
diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c index ae64422..f3b1067 100644 --- a/src/autofit/afcjk.c +++ b/src/autofit/afcjk.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for CJK script (body). */ /* */ -/* Copyright 2006, 2007, 2008, 2009 by */ +/* Copyright 2006, 2007, 2008, 2009, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -60,8 +60,8 @@ face->charmap = NULL; else { - /* latin's version would suffice */ - af_latin_metrics_init_widths( metrics, face, 0x7530 ); + /* latin's version would suffice */ + af_latin_metrics_init_widths( metrics, face, 0x7530 ); af_latin_metrics_check_digits( metrics, face ); } @@ -1371,7 +1371,7 @@ FT_UNUSED( metrics ); - error = af_glyph_hints_reload( hints, outline, 0 ); + error = af_glyph_hints_reload( hints, outline ); if ( error ) goto Exit; diff --git a/src/autofit/afglobal.c b/src/autofit/afglobal.c index ac29361..178c884 100644 --- a/src/autofit/afglobal.c +++ b/src/autofit/afglobal.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter routines to compute global hinting values (body). */ /* */ -/* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ +/* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -167,8 +167,11 @@ for ( nn = 0; nn < globals->glyph_count; nn++ ) { - if ( gscripts[nn] == AF_SCRIPT_LIST_NONE ) - gscripts[nn] = AF_SCRIPT_LIST_DEFAULT; + if ( ( gscripts[nn] & ~AF_DIGIT ) == AF_SCRIPT_LIST_NONE ) + { + gscripts[nn] &= ~AF_SCRIPT_LIST_NONE; + gscripts[nn] |= AF_SCRIPT_LIST_DEFAULT; + } } } @@ -183,7 +186,7 @@ { FT_Error error; FT_Memory memory; - AF_FaceGlobals globals; + AF_FaceGlobals globals = NULL; memory = face->memory; diff --git a/src/autofit/afglobal.h b/src/autofit/afglobal.h index 0d8fb5f..2a68e19 100644 --- a/src/autofit/afglobal.h +++ b/src/autofit/afglobal.h @@ -60,7 +60,7 @@ FT_BEGIN_HEADER af_face_globals_is_digit( AF_FaceGlobals globals, FT_UInt gindex ); - /* */ + /* */ FT_END_HEADER diff --git a/src/autofit/afhints.c b/src/autofit/afhints.c index a5aec80..c349709 100644 --- a/src/autofit/afhints.c +++ b/src/autofit/afhints.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines (body). */ /* */ -/* Copyright 2003, 2004, 2005, 2006, 2007, 2009 by */ +/* Copyright 2003, 2004, 2005, 2006, 2007, 2009, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -377,120 +377,6 @@ } - /* compute all inflex points in a given glyph */ - - static void - af_glyph_hints_compute_inflections( AF_GlyphHints hints ) - { - AF_Point* contour = hints->contours; - AF_Point* contour_limit = contour + hints->num_contours; - - - /* do each contour separately */ - for ( ; contour < contour_limit; contour++ ) - { - AF_Point point = contour[0]; - AF_Point first = point; - AF_Point start = point; - AF_Point end = point; - AF_Point before; - AF_Point after; - FT_Pos in_x, in_y, out_x, out_y; - AF_Angle orient_prev, orient_cur; - FT_Int finished = 0; - - - /* compute first segment in contour */ - first = point; - - start = end = first; - do - { - end = end->next; - if ( end == first ) - goto Skip; - - in_x = end->fx - start->fx; - in_y = end->fy - start->fy; - - } while ( in_x == 0 && in_y == 0 ); - - /* extend the segment start whenever possible */ - before = start; - do - { - do - { - start = before; - before = before->prev; - if ( before == first ) - goto Skip; - - out_x = start->fx - before->fx; - out_y = start->fy - before->fy; - - } while ( out_x == 0 && out_y == 0 ); - - orient_prev = ft_corner_orientation( in_x, in_y, out_x, out_y ); - - } while ( orient_prev == 0 ); - - first = start; - - in_x = out_x; - in_y = out_y; - - /* now process all segments in the contour */ - do - { - /* first, extend current segment's end whenever possible */ - after = end; - do - { - do - { - end = after; - after = after->next; - if ( after == first ) - finished = 1; - - out_x = after->fx - end->fx; - out_y = after->fy - end->fy; - - } while ( out_x == 0 && out_y == 0 ); - - orient_cur = ft_corner_orientation( in_x, in_y, out_x, out_y ); - - } while ( orient_cur == 0 ); - - if ( ( orient_prev + orient_cur ) == 0 ) - { - /* we have an inflection point here */ - do - { - start->flags |= AF_FLAG_INFLECTION; - start = start->next; - - } while ( start != end ); - - start->flags |= AF_FLAG_INFLECTION; - } - - start = end; - end = after; - - orient_prev = orient_cur; - in_x = out_x; - in_y = out_y; - - } while ( !finished ); - - Skip: - ; - } - } - - FT_LOCAL_DEF( void ) af_glyph_hints_init( AF_GlyphHints hints, FT_Memory memory ) @@ -551,8 +437,7 @@ FT_LOCAL_DEF( FT_Error ) af_glyph_hints_reload( AF_GlyphHints hints, - FT_Outline* outline, - FT_Bool get_inflections ) + FT_Outline* outline ) { FT_Error error = AF_Err_Ok; AF_Point points; @@ -639,13 +524,11 @@ { FT_Vector* vec = outline->points; char* tag = outline->tags; - AF_Point first = points; AF_Point end = points + outline->contours[0]; AF_Point prev = end; FT_Int contour_index = 0; - FT_UNUSED( first ); for ( point = points; point < point_limit; point++, vec++, tag++ ) { point->fx = (FT_Short)vec->x; @@ -673,9 +556,8 @@ { if ( ++contour_index < outline->n_contours ) { - first = point + 1; - end = points + outline->contours[contour_index]; - prev = end; + end = points + outline->contours[contour_index]; + prev = end; } } } @@ -752,11 +634,6 @@ } } - /* compute inflection points -- */ - /* disabled due to no longer perceived benefits */ - if ( 0 && get_inflections ) - af_glyph_hints_compute_inflections( hints ); - Exit: return error; } @@ -942,7 +819,7 @@ { FT_PtrDist min, max, mid; - FT_Pos fpos; + FT_Pos fpos; /* find enclosing edges */ diff --git a/src/autofit/afhints.h b/src/autofit/afhints.h index 6758268..10e673b 100644 --- a/src/autofit/afhints.h +++ b/src/autofit/afhints.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines (specification). */ /* */ -/* Copyright 2003, 2004, 2005, 2006, 2007, 2008 by */ +/* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -286,8 +286,7 @@ FT_BEGIN_HEADER FT_LOCAL( FT_Error ) af_glyph_hints_reload( AF_GlyphHints hints, - FT_Outline* outline, - FT_Bool get_inflections ); + FT_Outline* outline ); FT_LOCAL( void ) af_glyph_hints_save( AF_GlyphHints hints, diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c index e6882d5..8c6c430 100644 --- a/src/autofit/aflatin.c +++ b/src/autofit/aflatin.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for latin script (body). */ /* */ -/* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ +/* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -77,7 +77,7 @@ af_glyph_hints_rescale( hints, (AF_ScriptMetrics)dummy ); - error = af_glyph_hints_reload( hints, &face->glyph->outline, 0 ); + error = af_glyph_hints_reload( hints, &face->glyph->outline ); if ( error ) goto Exit; @@ -2105,7 +2105,7 @@ int dim; - error = af_glyph_hints_reload( hints, outline, 1 ); + error = af_glyph_hints_reload( hints, outline ); if ( error ) goto Exit; diff --git a/src/autofit/aflatin2.c b/src/autofit/aflatin2.c index f58ef38..6546475 100644 --- a/src/autofit/aflatin2.c +++ b/src/autofit/aflatin2.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for latin script (body). */ /* */ -/* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ +/* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -84,7 +84,7 @@ af_glyph_hints_rescale( hints, (AF_ScriptMetrics)dummy ); - error = af_glyph_hints_reload( hints, &face->glyph->outline, 0 ); + error = af_glyph_hints_reload( hints, &face->glyph->outline ); if ( error ) goto Exit; @@ -545,7 +545,8 @@ FT_Pos fitted = ( scaled + 40 ) & ~63; #if 1 - if ( scaled != fitted ) { + if ( scaled != fitted ) + { scale = FT_MulDiv( scale, fitted, scaled ); AF_LOG(( "== scaled x-top = %.2g fitted = %.2g, scaling = %.4g\n", scaled/64.0, fitted/64.0, (fitted*1.0)/scaled )); } @@ -2104,52 +2105,52 @@ FT_Int n_edges = edge_limit - edges; - if ( dim == AF_DIMENSION_HORZ && ( n_edges == 6 || n_edges == 12 ) ) - { - AF_Edge edge1, edge2, edge3; - FT_Pos dist1, dist2, span, delta; - - - if ( n_edges == 6 ) + if ( dim == AF_DIMENSION_HORZ && ( n_edges == 6 || n_edges == 12 ) ) { - edge1 = edges; - edge2 = edges + 2; - edge3 = edges + 4; - } - else - { - edge1 = edges + 1; - edge2 = edges + 5; - edge3 = edges + 9; - } + AF_Edge edge1, edge2, edge3; + FT_Pos dist1, dist2, span, delta; - dist1 = edge2->opos - edge1->opos; - dist2 = edge3->opos - edge2->opos; - span = dist1 - dist2; - if ( span < 0 ) - span = -span; + if ( n_edges == 6 ) + { + edge1 = edges; + edge2 = edges + 2; + edge3 = edges + 4; + } + else + { + edge1 = edges + 1; + edge2 = edges + 5; + edge3 = edges + 9; + } - if ( span < 8 ) - { - delta = edge3->pos - ( 2 * edge2->pos - edge1->pos ); - edge3->pos -= delta; - if ( edge3->link ) - edge3->link->pos -= delta; + dist1 = edge2->opos - edge1->opos; + dist2 = edge3->opos - edge2->opos; - /* move the serifs along with the stem */ - if ( n_edges == 12 ) + span = dist1 - dist2; + if ( span < 0 ) + span = -span; + + if ( span < 8 ) { - ( edges + 8 )->pos -= delta; - ( edges + 11 )->pos -= delta; - } + delta = edge3->pos - ( 2 * edge2->pos - edge1->pos ); + edge3->pos -= delta; + if ( edge3->link ) + edge3->link->pos -= delta; - edge3->flags |= AF_EDGE_DONE; - if ( edge3->link ) - edge3->link->flags |= AF_EDGE_DONE; + /* move the serifs along with the stem */ + if ( n_edges == 12 ) + { + ( edges + 8 )->pos -= delta; + ( edges + 11 )->pos -= delta; + } + + edge3->flags |= AF_EDGE_DONE; + if ( edge3->link ) + edge3->link->flags |= AF_EDGE_DONE; + } } } - } #endif if ( has_serifs || !anchor ) @@ -2249,7 +2250,7 @@ int dim; - error = af_glyph_hints_reload( hints, outline, 1 ); + error = af_glyph_hints_reload( hints, outline ); if ( error ) goto Exit; diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c index bf25cd1..6dd9f2a 100644 --- a/src/autofit/afloader.c +++ b/src/autofit/afloader.c @@ -183,9 +183,9 @@ if ( axis->num_edges > 1 && AF_HINTS_DO_ADVANCE( hints ) ) { - old_rsb = loader->pp2.x - edge2->opos; - old_lsb = edge1->opos; - new_lsb = edge1->pos; + old_rsb = loader->pp2.x - edge2->opos; + old_lsb = edge1->opos; + new_lsb = edge1->pos; /* remember unhinted values to later account */ /* for rounding errors */ @@ -216,8 +216,8 @@ } else { - FT_Pos pp1x = loader->pp1.x; - FT_Pos pp2x = loader->pp2.x; + FT_Pos pp1x = loader->pp1.x; + FT_Pos pp2x = loader->pp2.x; loader->pp1.x = FT_PIX_ROUND( pp1x ); @@ -229,8 +229,8 @@ } else { - FT_Pos pp1x = loader->pp1.x; - FT_Pos pp2x = loader->pp2.x; + FT_Pos pp1x = loader->pp1.x; + FT_Pos pp2x = loader->pp2.x; loader->pp1.x = FT_PIX_ROUND( pp1x + hints->xmin_delta ); diff --git a/src/autofit/afpic.c b/src/autofit/afpic.c index 76822c3..5b9aba6 100644 --- a/src/autofit/afpic.c +++ b/src/autofit/afpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for autofit module. */ /* */ -/* Copyright 2009 by */ +/* Copyright 2009, 2010 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -45,19 +45,21 @@ } } + FT_Error - autofit_module_class_pic_init( FT_Library library ) + autofit_module_class_pic_init( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_UInt ss; - FT_Error error = FT_Err_Ok; - AFModulePIC* container; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_UInt ss; + FT_Error error = AF_Err_Ok; + AFModulePIC* container; + FT_Memory memory = library->memory; + /* allocate pointer, clear and set global container pointer */ if ( FT_ALLOC ( container, sizeof ( *container ) ) ) return error; - FT_MEM_SET( container, 0, sizeof(*container) ); + FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->autofit = container; /* initialize pointer table - this is how the module usually expects this data */ |