Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 83955 Details for
Bug 128760
Series patches for freetype 2.1.10
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
freetype-2.1.10-cvsfixes.patch
freetype-2.1.10-cvsfixes.patch (text/plain), 34.87 KB, created by
Lin Hao-jie
on 2006-04-05 04:07:14 UTC
(
hide
)
Description:
freetype-2.1.10-cvsfixes.patch
Filename:
MIME Type:
Creator:
Lin Hao-jie
Created:
2006-04-05 04:07:14 UTC
Size:
34.87 KB
patch
obsolete
>--- freetype2/include/freetype/internal/ftobjs.h 27 May 2005 06:01:28 -0000 1.90 >+++ freetype2/include/freetype/internal/ftobjs.h 20 Jun 2005 09:04:49 -0000 1.91 >@@ -452,6 +452,13 @@ FT_BEGIN_HEADER > /* */ > > /* >+ * grid-fit slot->metrics >+ */ >+ FT_BASE( void ) >+ ft_glyphslot_grid_fit_metrics( FT_GlyphSlot slot ); >+ >+ >+ /* > * Free the bitmap of a given glyphslot when needed > * (i.e., only when it was allocated with ft_glyphslot_alloc_bitmap). > */ >Index: src/base/ftobjs.c >=================================================================== >RCS file: /cvsroot/freetype/freetype2/src/base/ftobjs.c,v >retrieving revision 1.215 >retrieving revision 1.217 >diff -u -p -r1.215 -r1.217 >--- freetype2/src/base/ftobjs.c 6 Jun 2005 07:01:47 -0000 1.215 >+++ freetype2/src/base/ftobjs.c 23 Jun 2005 20:31:48 -0000 1.217 >@@ -251,6 +251,29 @@ > > > FT_BASE_DEF( void ) >+ ft_glyphslot_grid_fit_metrics( FT_GlyphSlot slot ) >+ { >+ FT_Pos tmp; >+ >+ >+ tmp = FT_PIX_CEIL( slot->metrics.horiBearingX + slot->metrics.width ); >+ slot->metrics.horiBearingX = FT_PIX_FLOOR( slot->metrics.horiBearingX ); >+ slot->metrics.width = tmp - slot->metrics.horiBearingX; >+ >+ tmp = FT_PIX_FLOOR( slot->metrics.horiBearingY - slot->metrics.height ); >+ slot->metrics.horiBearingY = FT_PIX_CEIL( slot->metrics.horiBearingY ); >+ slot->metrics.height = slot->metrics.horiBearingY - tmp; >+ >+ slot->metrics.horiAdvance = FT_PIX_ROUND( slot->metrics.horiAdvance ); >+ >+ slot->metrics.vertBearingX = FT_PIX_FLOOR( slot->metrics.vertBearingX ); >+ /* note that vertBearingY should be floor'ed */ >+ slot->metrics.vertBearingY = FT_PIX_FLOOR( slot->metrics.vertBearingY ); >+ slot->metrics.vertAdvance = FT_PIX_ROUND( slot->metrics.vertAdvance ); >+ } >+ >+ >+ FT_BASE_DEF( void ) > ft_glyphslot_set_bitmap( FT_GlyphSlot slot, > FT_Byte* buffer ) > { >Index: src/base/ftoutln.c >=================================================================== >RCS file: /cvsroot/freetype/freetype2/src/base/ftoutln.c,v >retrieving revision 1.62 >retrieving revision 1.63 >diff -u -p -r1.62 -r1.63 >--- freetype2/src/base/ftoutln.c 25 May 2005 05:51:01 -0000 1.62 >+++ freetype2/src/base/ftoutln.c 16 Jun 2005 19:07:08 -0000 1.63 >@@ -683,6 +683,7 @@ > if ( !outline ) > return FT_Err_Invalid_Argument; > >+ strength /= 2; > if ( strength == 0 ) > return FT_Err_Ok; > >Index: src/base/ftsynth.c >=================================================================== >RCS file: /cvsroot/freetype/freetype2/src/base/ftsynth.c,v >retrieving revision 1.27 >retrieving revision 1.30 >diff -u -p -r1.27 -r1.30 >--- freetype2/src/base/ftsynth.c 30 May 2005 07:54:20 -0000 1.27 >+++ freetype2/src/base/ftsynth.c 23 Jun 2005 20:31:48 -0000 1.30 >@@ -81,13 +81,16 @@ > > /* some reasonable strength */ > xstr = FT_MulFix( face->units_per_EM, >- face->size->metrics.y_scale ) / 42; >+ face->size->metrics.y_scale ) / 24; > ystr = xstr; > > if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) > { > error = FT_Outline_Embolden( &slot->outline, xstr ); >- xstr = xstr * 4; /* according to the documentation */ >+ >+ /* this is more than enough for most glyphs; */ >+ /* if you need accurate values, you have to call FT_Outline_Get_CBox */ >+ xstr = xstr * 2; > ystr = xstr; > } > else if ( slot->format == FT_GLYPH_FORMAT_BITMAP ) >@@ -122,8 +125,8 @@ > /* modify the metrics accordingly */ > if ( !error ) > { >+ /* assume the layout is horizontal */ > slot->advance.x += xstr; >- slot->advance.y += ystr; > > slot->metrics.width += xstr; > slot->metrics.height += ystr; >Index: src/cff/cffgload.c >=================================================================== >RCS file: /cvsroot/freetype/freetype2/src/cff/cffgload.c,v >retrieving revision 1.66 >retrieving revision 1.67 >diff -u -p -r1.66 -r1.67 >--- freetype2/src/cff/cffgload.c 18 Apr 2005 07:13:07 -0000 1.66 >+++ freetype2/src/cff/cffgload.c 20 Jun 2005 09:04:50 -0000 1.67 >@@ -2510,11 +2510,8 @@ > glyph->root.linearHoriAdvance = decoder.glyph_width; > glyph->root.internal->glyph_transformed = 0; > >- /* make up vertical metrics */ >- metrics->vertBearingX = 0; >- metrics->vertBearingY = 0; >+ /* make up vertical ones */ > metrics->vertAdvance = 0; >- > glyph->root.linearVertAdvance = 0; > > glyph->root.format = FT_GLYPH_FORMAT_OUTLINE; >@@ -2559,42 +2556,26 @@ > vec->y = FT_MulFix( vec->y, y_scale ); > } > >- FT_Outline_Get_CBox( &glyph->root.outline, &cbox ); >- > /* Then scale the metrics */ > metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale ); > metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale ); >- >- metrics->vertBearingX = FT_MulFix( metrics->vertBearingX, x_scale ); >- metrics->vertBearingY = FT_MulFix( metrics->vertBearingY, y_scale ); >- >- if ( hinting ) >- { >- metrics->horiAdvance = FT_PIX_ROUND( metrics->horiAdvance ); >- metrics->vertAdvance = FT_PIX_ROUND( metrics->vertAdvance ); >- >- metrics->vertBearingX = FT_PIX_ROUND( metrics->vertBearingX ); >- metrics->vertBearingY = FT_PIX_ROUND( metrics->vertBearingY ); >- } > } > > /* compute the other metrics */ > FT_Outline_Get_CBox( &glyph->root.outline, &cbox ); > >- /* grid fit the bounding box if necessary */ >- if ( hinting ) >- { >- cbox.xMin &= -64; >- cbox.yMin &= -64; >- cbox.xMax = ( cbox.xMax + 63 ) & -64; >- cbox.yMax = ( cbox.yMax + 63 ) & -64; >- } >- > metrics->width = cbox.xMax - cbox.xMin; > metrics->height = cbox.yMax - cbox.yMin; > > metrics->horiBearingX = cbox.xMin; > metrics->horiBearingY = cbox.yMax; >+ >+ /* make up vertical ones */ >+ metrics->vertBearingX = 0; >+ metrics->vertBearingY = 0; >+ >+ if ( hinting ) >+ ft_glyphslot_grid_fit_metrics( &glyph->root ); > } > } > >Index: src/cid/cidgload.c >=================================================================== >RCS file: /cvsroot/freetype/freetype2/src/cid/cidgload.c,v >retrieving revision 1.70 >retrieving revision 1.72 >diff -u -p -r1.70 -r1.72 >--- freetype2/src/cid/cidgload.c 6 May 2004 11:48:35 -0000 1.70 >+++ freetype2/src/cid/cidgload.c 23 Jun 2005 20:31:48 -0000 1.72 >@@ -358,12 +358,10 @@ > cidglyph->linearHoriAdvance = decoder.builder.advance.x; > cidglyph->internal->glyph_transformed = 0; > >- /* make up vertical metrics */ >- metrics->vertBearingX = 0; >- metrics->vertBearingY = 0; >+ /* make up vertical ones */ > metrics->vertAdvance = 0; >- > cidglyph->linearVertAdvance = 0; >+ > cidglyph->format = FT_GLYPH_FORMAT_OUTLINE; > > if ( size && cidsize->metrics.y_ppem < 24 ) >@@ -403,42 +401,26 @@ > vec->y = FT_MulFix( vec->y, y_scale ); > } > >- FT_Outline_Get_CBox( &cidglyph->outline, &cbox ); >- > /* Then scale the metrics */ > metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale ); > metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale ); >- >- metrics->vertBearingX = FT_MulFix( metrics->vertBearingX, x_scale ); >- metrics->vertBearingY = FT_MulFix( metrics->vertBearingY, y_scale ); >- >- if ( hinting ) >- { >- metrics->horiAdvance = FT_PIX_ROUND( metrics->horiAdvance ); >- metrics->vertAdvance = FT_PIX_ROUND( metrics->vertAdvance ); >- >- metrics->vertBearingX = FT_PIX_ROUND( metrics->vertBearingX ); >- metrics->vertBearingY = FT_PIX_ROUND( metrics->vertBearingY ); >- } > } > > /* compute the other metrics */ > FT_Outline_Get_CBox( &cidglyph->outline, &cbox ); > >- /* grid fit the bounding box if necessary */ >- if ( hinting ) >- { >- cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); >- cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); >- cbox.xMax = FT_PIX_CEIL( cbox.xMax ); >- cbox.yMax = FT_PIX_CEIL( cbox.yMax ); >- } >- > metrics->width = cbox.xMax - cbox.xMin; > metrics->height = cbox.yMax - cbox.yMin; > > metrics->horiBearingX = cbox.xMin; > metrics->horiBearingY = cbox.yMax; >+ >+ /* make up vertical ones */ >+ metrics->vertBearingX = 0; >+ metrics->vertBearingY = 0; >+ >+ if ( hinting ) >+ ft_glyphslot_grid_fit_metrics( cidglyph ); > } > } > >Index: src/sfnt/ttsbit.c >=================================================================== >RCS file: /cvsroot/freetype/freetype2/src/sfnt/ttsbit.c,v >retrieving revision 1.63 >retrieving revision 1.64 >diff -u -p -r1.63 -r1.64 >--- freetype2/src/sfnt/ttsbit.c 1 Mar 2005 02:13:50 -0000 1.63 >+++ freetype2/src/sfnt/ttsbit.c 16 Jun 2005 19:07:08 -0000 1.64 >@@ -1501,7 +1501,7 @@ > /* some heuristic values */ > > metrics->vertBearingX = (FT_Char)(-metrics->width / 2 ); >- metrics->vertBearingY = (FT_Char)( advance / 10 ); >+ metrics->vertBearingY = (FT_Char)( ( advance - metrics->height ) / 2 ); > metrics->vertAdvance = (FT_Char)( advance * 12 / 10 ); > } > >Index: src/truetype/ttdriver.c >=================================================================== >RCS file: /cvsroot/freetype/freetype2/src/truetype/ttdriver.c,v >retrieving revision 1.78 >retrieving revision 1.79 >diff -u -p -r1.78 -r1.79 >--- freetype2/src/truetype/ttdriver.c 1 Mar 2005 02:13:50 -0000 1.78 >+++ freetype2/src/truetype/ttdriver.c 26 Jul 2005 08:14:03 -0000 1.79 >@@ -167,40 +167,33 @@ > FT_UInt horz_resolution, > FT_UInt vert_resolution ) > { >- TT_Size size = (TT_Size)ttsize; >- FT_Size_Metrics* metrics = &size->root.metrics; >- FT_Size_Metrics* metrics2 = &size->metrics; >- TT_Face face = (TT_Face)size->root.face; >- FT_Long dim_x, dim_y; >+ TT_Size size = (TT_Size)ttsize; >+ FT_Size_Metrics* metrics = &size->metrics; >+ TT_Face face = (TT_Face)size->root.face; > > >- *metrics2 = *metrics; >+ /* copy the result from base layer */ >+ *metrics = size->root.metrics; > > /* This bit flag, when set, indicates that the pixel size must be */ >- /* truncated to an integer. Nearly all TrueType fonts have this */ >- /* bit set, as hinting won't work really well otherwise. */ >+ /* rounded to integer. Nearly all TrueType fonts have this bit */ >+ /* set, as hinting won't work really well otherwise. */ > /* */ > if ( ( face->header.Flags & 8 ) != 0 ) > { >- /* we need to use rounding in the following computations. Otherwise, >- * the resulting hinted outlines will be very slightly distorted >- */ >- dim_x = ( ( char_width * horz_resolution + (36+32*72) ) / 72 ) & ~63; >- dim_y = ( ( char_height * vert_resolution + (36+32*72) ) / 72 ) & ~63; >- } >- else >- { >- dim_x = ( ( char_width * horz_resolution + 36 ) / 72 ); >- dim_y = ( ( char_height * vert_resolution + 36 ) / 72 ); >- } >+ FT_Long dim_x, dim_y; > >- /* we only modify "metrics2", not "metrics", so these changes have */ >- /* no effect on the result of the auto-hinter when it is used */ >- /* */ >- metrics2->x_ppem = (FT_UShort)( dim_x >> 6 ); >- metrics2->y_ppem = (FT_UShort)( dim_y >> 6 ); >- metrics2->x_scale = FT_DivFix( dim_x, face->root.units_per_EM ); >- metrics2->y_scale = FT_DivFix( dim_y, face->root.units_per_EM ); >+ dim_x = ( char_width * horz_resolution + 36 ) / 72; >+ dim_y = ( char_height * vert_resolution + 36 ) / 72; >+ >+ dim_x = FT_PIX_ROUND(dim_x); >+ dim_y = FT_PIX_ROUND(dim_y); >+ >+ metrics->x_ppem = (FT_UShort)( dim_x >> 6 ); >+ metrics->y_ppem = (FT_UShort)( dim_y >> 6 ); >+ metrics->x_scale = FT_DivFix( dim_x, face->root.units_per_EM ); >+ metrics->y_scale = FT_DivFix( dim_y, face->root.units_per_EM ); >+ } > > size->ttmetrics.valid = FALSE; > #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS >Index: src/truetype/ttgload.c >=================================================================== >RCS file: /cvsroot/freetype/freetype2/src/truetype/ttgload.c,v >retrieving revision 1.138 >retrieving revision 1.143 >diff -u -p -r1.138 -r1.143 >--- freetype2/src/truetype/ttgload.c 6 Apr 2005 14:48:55 -0000 1.138 >+++ freetype2/src/truetype/ttgload.c 13 Jul 2005 06:58:13 -0000 1.143 >@@ -1707,15 +1707,6 @@ > FT_Outline_Translate( &glyph->outline, -loader->pp1.x, 0 ); > > FT_Outline_Get_CBox( &glyph->outline, &bbox ); >- >- if ( IS_HINTED( loader->load_flags ) ) >- { >- /* grid-fit the bounding box */ >- bbox.xMin = FT_PIX_FLOOR( bbox.xMin ); >- bbox.yMin = FT_PIX_FLOOR( bbox.yMin ); >- bbox.xMax = FT_PIX_CEIL( bbox.xMax ); >- bbox.yMax = FT_PIX_CEIL( bbox.yMax ); >- } > } > else > bbox = loader->bbox; >@@ -1744,10 +1735,6 @@ > glyph->metrics.horiBearingY = bbox.yMax; > glyph->metrics.horiAdvance = loader->pp2.x - loader->pp1.x; > >- /* don't forget to hint the advance when we need to */ >- if ( IS_HINTED( loader->load_flags ) ) >- glyph->metrics.horiAdvance = FT_PIX_ROUND( glyph->metrics.horiAdvance ); >- > /* Now take care of vertical metrics. In the case where there is */ > /* no vertical information within the font (relatively common), make */ > /* up some metrics by `hand'... */ >@@ -1765,41 +1752,45 @@ > if ( face->vertical_info && > face->vertical.number_Of_VMetrics > 0 ) > { >- advance_height = (FT_UShort)( loader->pp4.y - loader->pp3.y ); >- top_bearing = (FT_Short)( loader->pp3.y - bbox.yMax ); >+ top_bearing = (FT_Short)FT_DivFix( loader->pp3.y - bbox.yMax, >+ y_scale ); >+ >+ if ( loader->pp3.y <= loader->pp4.y ) >+ advance_height = 0; >+ else >+ advance_height = (FT_UShort)FT_DivFix( loader->pp3.y - loader->pp4.y, >+ y_scale ); > } > else > { >- /* Make up the distances from the horizontal header. */ >+ FT_Short max_height, height; >+ >+ >+ /* XXX Compute top side bearing and advance height in */ >+ /* Get_VMetrics instead of here. */ > > /* NOTE: The OS/2 values are the only `portable' ones, */ > /* which is why we use them, if there is an OS/2 */ > /* table in the font. Otherwise, we use the */ > /* values defined in the horizontal header. */ >- /* */ >- /* NOTE2: The sTypoDescender is negative, which is why */ >- /* we compute the baseline-to-baseline distance */ >- /* here with: */ >- /* ascender - descender + linegap */ >- /* */ >- /* NOTE3: This is different from what MS's rasterizer */ >- /* appears to do when getting default values */ >- /* for the vertical phantom points. We leave */ >- /* the old code untouched, but relying on */ >- /* phantom points alone might be reasonable */ >- /* (i.e., removing the `if' above). */ >+ >+ height = (FT_Short)FT_DivFix( bbox.yMax - bbox.yMin, y_scale ); > if ( face->os2.version != 0xFFFFU ) > { >- top_bearing = (FT_Short)( face->os2.sTypoLineGap / 2 ); >- advance_height = (FT_UShort)( face->os2.sTypoAscender - >- face->os2.sTypoDescender + >- face->os2.sTypoLineGap ); >+ /* sTypoDescender is negative */ >+ max_height = (FT_Short)(face->os2.sTypoAscender - >+ face->os2.sTypoDescender); >+ >+ top_bearing = (FT_Short)( ( max_height - height ) / 2 ); >+ advance_height = (FT_UShort)( max_height + face->os2.sTypoLineGap ); > } > else > { >- top_bearing = (FT_Short)( face->horizontal.Line_Gap / 2 ); >- advance_height = (FT_UShort)( face->horizontal.Ascender + >- face->horizontal.Descender + >+ max_height = (FT_Short)(face->horizontal.Ascender + >+ face->horizontal.Descender); >+ >+ top_bearing = (FT_Short)( ( max_height - height ) / 2 ); >+ advance_height = (FT_UShort)( max_height + > face->horizontal.Line_Gap ); > } > } >@@ -1817,7 +1808,7 @@ > > metrics.bearing_x = 0; > metrics.bearing_y = top_bearing; >- metrics.advance = advance_height; >+ metrics.advance = advance_height; > error = > face->root.internal->incremental_interface->funcs->get_glyph_metrics( > face->root.internal->incremental_interface->object, >@@ -1834,20 +1825,15 @@ > > #endif /* FT_CONFIG_OPTION_INCREMENTAL */ > >- /* We must adjust the top_bearing value from the bounding box given */ >- /* in the glyph header to the bounding box calculated with */ >- /* FT_Get_Outline_CBox(). */ >- > /* scale the metrics */ > if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) ) > { >- top = FT_MulFix( top_bearing + loader->bbox.yMax, y_scale ) >- - bbox.yMax; >+ top = FT_MulFix( top_bearing, y_scale ); > advance = FT_MulFix( advance_height, y_scale ); > } > else > { >- top = top_bearing + loader->bbox.yMax - bbox.yMax; >+ top = top_bearing; > advance = advance_height; > } > >@@ -1860,14 +1846,6 @@ > /* */ > left = ( bbox.xMin - bbox.xMax ) / 2; > >- /* grid-fit them if necessary */ >- if ( IS_HINTED( loader->load_flags ) ) >- { >- left = FT_PIX_FLOOR( left ); >- top = FT_PIX_CEIL( top ); >- advance = FT_PIX_ROUND( advance ); >- } >- > glyph->metrics.vertBearingX = left; > glyph->metrics.vertBearingY = top; > glyph->metrics.vertAdvance = advance; >@@ -1889,6 +1867,9 @@ > /* set glyph dimensions */ > glyph->metrics.width = bbox.xMax - bbox.xMin; > glyph->metrics.height = bbox.yMax - bbox.yMin; >+ >+ if ( IS_HINTED( loader->load_flags ) ) >+ ft_glyphslot_grid_fit_metrics( glyph ); > > return 0; > } >Index: src/truetype/ttobjs.c >=================================================================== >RCS file: /cvsroot/freetype/freetype2/src/truetype/ttobjs.c,v >retrieving revision 1.90 >retrieving revision 1.91 >diff -u -p -r1.90 -r1.91 >--- freetype2/src/truetype/ttobjs.c 1 Mar 2005 02:13:50 -0000 1.90 >+++ freetype2/src/truetype/ttobjs.c 31 Jul 2005 11:41:54 -0000 1.91 >@@ -121,19 +121,21 @@ > FT_Error error; > > >- if ( maxPoints > 0 ) >- maxPoints += 2; >- > FT_MEM_ZERO( zone, sizeof ( *zone ) ); > zone->memory = memory; > >- if ( FT_NEW_ARRAY( zone->org, maxPoints * 2 ) || >- FT_NEW_ARRAY( zone->cur, maxPoints * 2 ) || >- FT_NEW_ARRAY( zone->tags, maxPoints ) || >- FT_NEW_ARRAY( zone->contours, maxContours ) ) >+ if ( FT_NEW_ARRAY( zone->org, maxPoints ) || >+ FT_NEW_ARRAY( zone->cur, maxPoints ) || >+ FT_NEW_ARRAY( zone->tags, maxPoints ) || >+ FT_NEW_ARRAY( zone->contours, maxContours ) ) > { > tt_glyphzone_done( zone ); > } >+ else >+ { >+ zone->max_points = maxPoints; >+ zone->max_contours = maxContours; >+ } > > return error; > } >@@ -318,6 +320,162 @@ > /* */ > /*************************************************************************/ > >+#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER >+ /*************************************************************************/ >+ /* */ >+ /* <Function> */ >+ /* tt_size_run_fpgm */ >+ /* */ >+ /* <Description> */ >+ /* Run the font program */ >+ /* */ >+ /* <Input> */ >+ /* size :: A handle to the size object. */ >+ /* */ >+ /* <Return> */ >+ /* FreeType error code. 0 means success. */ >+ /* */ >+ FT_LOCAL_DEF( FT_Error ) >+ tt_size_run_fpgm( TT_Size size ) >+ { >+ TT_Face face = (TT_Face)size->root.face; >+ TT_ExecContext exec; >+ FT_Error error; >+ >+ >+ /* debugging instances have their own context */ >+ if ( size->debug ) >+ exec = size->context; >+ else >+ exec = TT_New_Context( face ); >+ >+ if ( !exec ) >+ return TT_Err_Could_Not_Find_Context; >+ >+ TT_Load_Context( exec, face, size ); >+ >+ exec->callTop = 0; >+ exec->top = 0; >+ >+ exec->period = 64; >+ exec->phase = 0; >+ exec->threshold = 0; >+ >+ exec->instruction_trap = FALSE; >+ exec->F_dot_P = 0x10000L; >+ >+ { >+ FT_Size_Metrics* metrics = &exec->metrics; >+ TT_Size_Metrics* tt_metrics = &exec->tt_metrics; >+ >+ >+ metrics->x_ppem = 0; >+ metrics->y_ppem = 0; >+ metrics->x_scale = 0; >+ metrics->y_scale = 0; >+ >+ tt_metrics->ppem = 0; >+ tt_metrics->scale = 0; >+ tt_metrics->ratio = 0x10000L; >+ } >+ >+ /* allow font program execution */ >+ TT_Set_CodeRange( exec, >+ tt_coderange_font, >+ face->font_program, >+ face->font_program_size ); >+ >+ /* disable CVT and glyph programs coderange */ >+ TT_Clear_CodeRange( exec, tt_coderange_cvt ); >+ TT_Clear_CodeRange( exec, tt_coderange_glyph ); >+ >+ if ( face->font_program_size > 0 ) >+ { >+ error = TT_Goto_CodeRange( exec, tt_coderange_font, 0 ); >+ >+ if ( !error ) >+ error = face->interpreter( exec ); >+ } >+ else >+ error = TT_Err_Ok; >+ >+ if ( !error ) >+ TT_Save_Context( exec, size ); >+ >+ if ( !size->debug ) >+ TT_Done_Context( exec ); >+ >+ return error; >+ } >+ >+ >+ /*************************************************************************/ >+ /* */ >+ /* <Function> */ >+ /* tt_size_run_prep */ >+ /* */ >+ /* <Description> */ >+ /* Run the control value program */ >+ /* */ >+ /* <Input> */ >+ /* size :: A handle to the size object. */ >+ /* */ >+ /* <Return> */ >+ /* FreeType error code. 0 means success. */ >+ /* */ >+ FT_LOCAL_DEF( FT_Error ) >+ tt_size_run_prep( TT_Size size ) >+ { >+ TT_Face face = (TT_Face)size->root.face; >+ TT_ExecContext exec; >+ FT_Error error; >+ >+ >+ /* debugging instances have their own context */ >+ if ( size->debug ) >+ exec = size->context; >+ else >+ exec = TT_New_Context( face ); >+ >+ if ( !exec ) >+ return TT_Err_Could_Not_Find_Context; >+ >+ TT_Load_Context( exec, face, size ); >+ >+ exec->callTop = 0; >+ exec->top = 0; >+ >+ exec->instruction_trap = FALSE; >+ >+ TT_Set_CodeRange( exec, >+ tt_coderange_cvt, >+ face->cvt_program, >+ face->cvt_program_size ); >+ >+ TT_Clear_CodeRange( exec, tt_coderange_glyph ); >+ >+ if ( face->cvt_program_size > 0 ) >+ { >+ error = TT_Goto_CodeRange( exec, tt_coderange_cvt, 0 ); >+ >+ if ( !error && !size->debug ) >+ error = face->interpreter( exec ); >+ } >+ else >+ error = TT_Err_Ok; >+ >+ /* save as default graphics state */ >+ size->GS = exec->GS; >+ >+ TT_Save_Context( exec, size ); >+ >+ if ( !size->debug ) >+ TT_Done_Context( exec ); >+ >+ return error; >+ } >+#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ >+ > > /*************************************************************************/ > /* */ >@@ -338,15 +496,11 @@ > { > TT_Size size = (TT_Size)ttsize; > FT_Error error = TT_Err_Ok; >- >- > #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER >- > TT_Face face = (TT_Face)size->root.face; > FT_Memory memory = face->root.memory; > FT_Int i; > >- TT_ExecContext exec; > FT_UShort n_twilight; > TT_MaxProfile* maxp = &face->max_profile; > >@@ -387,17 +541,30 @@ > FT_NEW_ARRAY( size->instruction_defs, size->max_instruction_defs ) || > FT_NEW_ARRAY( size->cvt, size->cvt_size ) || > FT_NEW_ARRAY( size->storage, size->storage_size ) ) >+ { >+ tt_size_done( ttsize ); > >- goto Fail_Memory; >+ return error; >+ } > > /* reserve twilight zone */ > n_twilight = maxp->maxTwilightPoints; >+ >+ /* there are 4 phantom points (do we need this?) */ >+ n_twilight += 4; >+ > error = tt_glyphzone_new( memory, n_twilight, 0, &size->twilight ); > if ( error ) >- goto Fail_Memory; >+ { >+ tt_size_done( ttsize ); >+ >+ return error; >+ } > > size->twilight.n_points = n_twilight; > >+ size->GS = tt_default_graphics_state; >+ > /* set `face->interpreter' according to the debug hook present */ > { > FT_Library library = face->root.driver->root.library; >@@ -409,95 +576,17 @@ > face->interpreter = (TT_Interpreter)TT_RunIns; > } > >- /* Fine, now execute the font program! */ >- exec = size->context; >- /* size objects used during debugging have their own context */ >- if ( !size->debug ) >- exec = TT_New_Context( face ); >- >- if ( !exec ) >- { >- error = TT_Err_Could_Not_Find_Context; >- goto Fail_Memory; >- } >- >- size->GS = tt_default_graphics_state; >- TT_Load_Context( exec, face, size ); >- >- exec->callTop = 0; >- exec->top = 0; >- >- exec->period = 64; >- exec->phase = 0; >- exec->threshold = 0; >- >- { >- FT_Size_Metrics* metrics = &exec->metrics; >- TT_Size_Metrics* tt_metrics = &exec->tt_metrics; >- >- >- metrics->x_ppem = 0; >- metrics->y_ppem = 0; >- metrics->x_scale = 0; >- metrics->y_scale = 0; >- >- tt_metrics->ppem = 0; >- tt_metrics->scale = 0; >- tt_metrics->ratio = 0x10000L; >- } >+ /* Fine, now run the font program! */ >+ error = tt_size_run_fpgm( size ); > >- exec->instruction_trap = FALSE; >- >- exec->cvtSize = size->cvt_size; >- exec->cvt = size->cvt; >- >- exec->F_dot_P = 0x10000L; >- >- /* allow font program execution */ >- TT_Set_CodeRange( exec, >- tt_coderange_font, >- face->font_program, >- face->font_program_size ); >- >- /* disable CVT and glyph programs coderange */ >- TT_Clear_CodeRange( exec, tt_coderange_cvt ); >- TT_Clear_CodeRange( exec, tt_coderange_glyph ); >- >- if ( face->font_program_size > 0 ) >- { >- error = TT_Goto_CodeRange( exec, tt_coderange_font, 0 ); >- if ( !error ) >- error = face->interpreter( exec ); >- >- if ( error ) >- goto Fail_Exec; >- } >- else >- error = TT_Err_Ok; >- >- TT_Save_Context( exec, size ); >- >- if ( !size->debug ) >- TT_Done_Context( exec ); >+ if ( error ) >+ tt_size_done( ttsize ); > > #endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ > > size->ttmetrics.valid = FALSE; >- return error; >- >-#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER >- >- Fail_Exec: >- if ( !size->debug ) >- TT_Done_Context( exec ); >- >- Fail_Memory: > >- tt_size_done( ttsize ); > return error; >- >-#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ >- > } > > >@@ -516,9 +605,7 @@ > tt_size_done( FT_Size ttsize ) /* TT_Size */ > { > TT_Size size = (TT_Size)ttsize; >- > #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER >- > FT_Memory memory = size->root.face->memory; > > >@@ -625,10 +712,8 @@ > #endif > > #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER >- > { >- TT_ExecContext exec; >- FT_UInt i, j; >+ FT_UInt i; > > > /* Scale the cvt values to the new ppem. */ >@@ -637,12 +722,12 @@ > size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale ); > > /* All twilight points are originally zero */ >- for ( j = 0; j < (FT_UInt)size->twilight.n_points; j++ ) >+ for ( i = 0; i < (FT_UInt)size->twilight.n_points; i++ ) > { >- size->twilight.org[j].x = 0; >- size->twilight.org[j].y = 0; >- size->twilight.cur[j].x = 0; >- size->twilight.cur[j].y = 0; >+ size->twilight.org[i].x = 0; >+ size->twilight.org[i].y = 0; >+ size->twilight.cur[i].x = 0; >+ size->twilight.cur[i].y = 0; > } > > /* clear storage area */ >@@ -651,53 +736,8 @@ > > size->GS = tt_default_graphics_state; > >- /* get execution context and run prep program */ >- if ( size->debug ) >- exec = size->context; >- else >- exec = TT_New_Context( face ); >- /* debugging instances have their own context */ >- >- if ( !exec ) >- return TT_Err_Could_Not_Find_Context; >- >- TT_Load_Context( exec, face, size ); >- >- TT_Set_CodeRange( exec, >- tt_coderange_cvt, >- face->cvt_program, >- face->cvt_program_size ); >- >- TT_Clear_CodeRange( exec, tt_coderange_glyph ); >- >- exec->instruction_trap = FALSE; >- >- exec->top = 0; >- exec->callTop = 0; >- >- if ( face->cvt_program_size > 0 ) >- { >- error = TT_Goto_CodeRange( exec, tt_coderange_cvt, 0 ); >- if ( error ) >- goto End; >- >- if ( !size->debug ) >- error = face->interpreter( exec ); >- } >- else >- error = TT_Err_Ok; >- >- size->GS = exec->GS; >- /* save default graphics state */ >- >- End: >- TT_Save_Context( exec, size ); >- >- if ( !size->debug ) >- TT_Done_Context( exec ); >- /* debugging instances keep their context */ >+ error = tt_size_run_prep( size ); > } >- > #endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ > > if ( !error ) >Index: src/truetype/ttobjs.h >=================================================================== >RCS file: /cvsroot/freetype/freetype2/src/truetype/ttobjs.h,v >retrieving revision 1.36 >retrieving revision 1.38 >diff -u -p -r1.36 -r1.38 >--- freetype2/src/truetype/ttobjs.h 4 May 2004 16:53:45 -0000 1.36 >+++ freetype2/src/truetype/ttobjs.h 31 Jul 2005 11:41:54 -0000 1.38 >@@ -316,7 +316,10 @@ FT_BEGIN_HEADER > { > FT_SizeRec root; > >- FT_Size_Metrics metrics; /* slightly different from the root metrics */ >+ /* we have our own copy of metrics so that we can modify */ >+ /* it without affecting auto-hinting (when used) */ >+ FT_Size_Metrics metrics; >+ > TT_Size_Metrics ttmetrics; > > #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS >@@ -413,6 +416,14 @@ FT_BEGIN_HEADER > > FT_LOCAL( void ) > tt_size_done( FT_Size ttsize ); /* TT_Size */ >+ >+#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER >+ FT_LOCAL( FT_Error ) >+ tt_size_run_fpgm( TT_Size size ); >+ >+ FT_LOCAL( FT_Error ) >+ tt_size_run_prep( TT_Size size ); >+#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ > > FT_LOCAL( FT_Error ) > tt_size_reset( TT_Size size ); >Index: src/type1/t1gload.c >=================================================================== >RCS file: /cvsroot/freetype/freetype2/src/type1/t1gload.c,v >retrieving revision 1.85 >retrieving revision 1.87 >diff -u -p -r1.85 -r1.87 >--- freetype2/src/type1/t1gload.c 13 May 2004 12:59:59 -0000 1.85 >+++ freetype2/src/type1/t1gload.c 23 Jun 2005 20:31:48 -0000 1.87 >@@ -315,11 +315,7 @@ > glyph->root.linearHoriAdvance = decoder.builder.advance.x; > glyph->root.internal->glyph_transformed = 0; > >- /* make up vertical metrics */ >- metrics->vertBearingX = 0; >- metrics->vertBearingY = 0; >- metrics->vertAdvance = 0; >- >+ metrics->vertAdvance = 0; > glyph->root.linearVertAdvance = 0; > > glyph->root.format = FT_GLYPH_FORMAT_OUTLINE; >@@ -363,42 +359,26 @@ > vec->y = FT_MulFix( vec->y, y_scale ); > } > >- FT_Outline_Get_CBox( &glyph->root.outline, &cbox ); >- > /* Then scale the metrics */ > metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale ); > metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale ); >- >- metrics->vertBearingX = FT_MulFix( metrics->vertBearingX, x_scale ); >- metrics->vertBearingY = FT_MulFix( metrics->vertBearingY, y_scale ); >- >- if ( hinting ) >- { >- metrics->horiAdvance = FT_PIX_ROUND( metrics->horiAdvance ); >- metrics->vertAdvance = FT_PIX_ROUND( metrics->vertAdvance ); >- >- metrics->vertBearingX = FT_PIX_ROUND( metrics->vertBearingX ); >- metrics->vertBearingY = FT_PIX_ROUND( metrics->vertBearingY ); >- } > } > > /* compute the other metrics */ > FT_Outline_Get_CBox( &glyph->root.outline, &cbox ); > >- /* grid fit the bounding box if necessary */ >- if ( hinting ) >- { >- cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); >- cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); >- cbox.xMax = FT_PIX_CEIL( cbox.xMax ); >- cbox.yMax = FT_PIX_CEIL( cbox.yMax ); >- } >- > metrics->width = cbox.xMax - cbox.xMin; > metrics->height = cbox.yMax - cbox.yMin; > > metrics->horiBearingX = cbox.xMin; > metrics->horiBearingY = cbox.yMax; >+ >+ /* make up vertical ones */ >+ metrics->vertBearingX = 0; >+ metrics->vertBearingY = 0; >+ >+ if ( hinting ) >+ ft_glyphslot_grid_fit_metrics( &glyph->root ); > } > > /* Set control data to the glyph charstrings. Note that this is */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 128760
:
83876
|
83877
|
83878
|
83879
|
83880
|
83881
|
83883
|
83885
| 83955 |
83956
|
83957
|
83958
|
83959
|
83960