From 5dc4f24637d353d4d777c251f6d8c5746e062e7e Mon Sep 17 00:00:00 2001 From: Bo Xu Date: Sat, 24 May 2014 12:20:17 -0700 Subject: Fix warnings in android build, fix font rendering issue, fix issue 357588: wrong characters representation, and addjust some code indent BUG= R=jam@chromium.org Review URL: https://codereview.chromium.org/294353002 --- core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2font.c | 3 +-- core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2ft.c | 17 +++++++++++++---- core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2hints.c | 5 +++++ core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2intrp.c | 17 +++++++++++++---- 4 files changed, 32 insertions(+), 10 deletions(-) (limited to 'core/src/fxge/fx_freetype') diff --git a/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2font.c b/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2font.c index c1eeec289a..479d9125d1 100644 --- a/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2font.c +++ b/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2font.c @@ -328,7 +328,6 @@ FT_Error lastError = FT_Err_Ok; FT_Vector translation; - int refCount = 0; #if 0 FT_Vector advancePoint; @@ -355,7 +354,7 @@ /* winding order only affects darkening */ needWinding = font->darkened; - while ( refCount++ < 1024) + while ( 1 ) { /* reset output buffer */ cf2_outline_reset( &font->outline ); diff --git a/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2ft.c b/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2ft.c index 4311d10756..7f82b247af 100644 --- a/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2ft.c +++ b/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2ft.c @@ -143,6 +143,7 @@ /* downcast the object pointer */ CF2_Outline outline = (CF2_Outline)callbacks; CFF_Builder* builder; + FT_Error error; FT_ASSERT( outline && outline->decoder ); @@ -154,15 +155,18 @@ { /* record the move before the line; also check points and set */ /* `path_begun' */ - cff_builder_start_point( builder, + error = cff_builder_start_point(builder, params->pt0.x, params->pt0.y ); + if (callbacks && callbacks->error) *callbacks->error = error; + if (error) return; } /* `cff_builder_add_point1' includes a check_points call for one point */ - cff_builder_add_point1( builder, + error = cff_builder_add_point1(builder, params->pt1.x, params->pt1.y ); + if (callbacks && callbacks->error) *callbacks->error = error; } @@ -173,6 +177,7 @@ /* downcast the object pointer */ CF2_Outline outline = (CF2_Outline)callbacks; CFF_Builder* builder; + FT_Error error; FT_ASSERT( outline && outline->decoder ); @@ -184,13 +189,17 @@ { /* record the move before the line; also check points and set */ /* `path_begun' */ - cff_builder_start_point( builder, + error = cff_builder_start_point( builder, params->pt0.x, params->pt0.y ); + if (callbacks && callbacks->error) *callbacks->error = error; + if (error) return; } /* prepare room for 3 points: 2 off-curve, 1 on-curve */ - cff_check_points( builder, 3 ); + error = cff_check_points( builder, 3 ); + if (callbacks && callbacks->error) *callbacks->error = error; + if (error) return; cff_builder_add_point( builder, params->pt1.x, diff --git a/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2hints.c b/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2hints.c index e0755b4c3c..70926299f3 100644 --- a/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2hints.c +++ b/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2hints.c @@ -1585,6 +1585,7 @@ { /* emit offset 1st point as MoveTo */ cf2_glyphpath_pushMove( glyphpath, P0 ); + if (glyphpath->callbacks && glyphpath->callbacks->error && *glyphpath->callbacks->error) return; glyphpath->moveIsPending = FALSE; /* adjust state machine */ glyphpath->pathIsOpen = TRUE; @@ -1601,6 +1602,7 @@ &P0, P1, FALSE ); + if (glyphpath->callbacks && glyphpath->callbacks->error && *glyphpath->callbacks->error) return; } /* queue the current element with offset points */ @@ -1671,6 +1673,7 @@ { /* emit offset 1st point as MoveTo */ cf2_glyphpath_pushMove( glyphpath, P0 ); + if (glyphpath->callbacks && glyphpath->callbacks->error && *glyphpath->callbacks->error) return; glyphpath->moveIsPending = FALSE; glyphpath->pathIsOpen = TRUE; @@ -1687,6 +1690,7 @@ &P0, P1, FALSE ); + if (glyphpath->callbacks && glyphpath->callbacks->error && *glyphpath->callbacks->error) return; } /* queue the current element with offset points */ @@ -1723,6 +1727,7 @@ cf2_glyphpath_lineTo( glyphpath, glyphpath->start.x, glyphpath->start.y ); + if (glyphpath->callbacks && glyphpath->callbacks->error && *glyphpath->callbacks->error) return; /* Draw previous element (the explicit LineTo we just created, */ /* above) and connect it to the start point, but with the offset we */ diff --git a/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2intrp.c b/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2intrp.c index 12f5dd79e7..fc11100012 100644 --- a/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2intrp.c +++ b/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2intrp.c @@ -464,9 +464,6 @@ CF2_HintMaskRec hintMask; CF2_GlyphPathRec glyphPath; - int refCount = 0; - - /* initialize the remaining objects */ cf2_arrstack_init( &subrStack, memory, @@ -551,7 +548,7 @@ goto exit; /* main interpreter loop */ - while ( refCount++ < 10240 ) + while ( 1 ) { if ( cf2_buf_isEnd( charstring ) ) { @@ -646,6 +643,7 @@ curY += cf2_stack_popFixed( opStack ); cf2_glyphpath_moveTo( &glyphPath, curX, curY ); + if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit; break; @@ -663,6 +661,7 @@ curY += cf2_stack_getReal( opStack, index + 1 ); cf2_glyphpath_lineTo( &glyphPath, curX, curY ); + if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit; } cf2_stack_clear( opStack ); @@ -693,6 +692,7 @@ isX = !isX; cf2_glyphpath_lineTo( &glyphPath, curX, curY ); + if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit; } cf2_stack_clear( opStack ); @@ -720,6 +720,7 @@ cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); + if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit; curX = x3; curY = y3; @@ -732,6 +733,7 @@ curY += cf2_stack_getReal( opStack, index + 1 ); cf2_glyphpath_lineTo( &glyphPath, curX, curY ); + if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit; } cf2_stack_clear( opStack ); @@ -1225,6 +1227,7 @@ curX += cf2_stack_popFixed( opStack ); cf2_glyphpath_moveTo( &glyphPath, curX, curY ); + if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit; break; @@ -1243,6 +1246,7 @@ curX += cf2_stack_popFixed( opStack ); cf2_glyphpath_moveTo( &glyphPath, curX, curY ); + if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit; break; @@ -1260,6 +1264,7 @@ curY += cf2_stack_getReal( opStack, index + 1 ); cf2_glyphpath_lineTo( &glyphPath, curX, curY ); + if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit; index += 2; } @@ -1274,6 +1279,7 @@ cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); + if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit; curX = x3; curY = y3; @@ -1313,6 +1319,7 @@ y3 = cf2_stack_getReal( opStack, index + 3 ) + y2; cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); + if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit; curX = x3; curY = y3; @@ -1352,6 +1359,7 @@ y3 = y2; cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); + if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit; curX = x3; curY = y3; @@ -1418,6 +1426,7 @@ } cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); + if (glyphPath.callbacks && glyphPath.callbacks->error && *glyphPath.callbacks->error) goto exit; curX = x3; curY = y3; -- cgit v1.2.3