Dear all:
Tnanks for taking time to read my mail and I write to you for help about the
Freetype library.
Rescently, I transplanted Freetype into our own graphics system(using cairo) to draw fonts and
it did work well most of the time.
But the problem is
sometimes the program calling functions in freetype would run into an endless
loop or can not access invalid pointer.
/*************************************************************************/
/*
*/
/* Record the
current cell in the
table.
*/
/*
*/
static PCell
gray_find_cell(
RAS_ARG )
{
//pcell always was an invalid pointer when
error occurs
PCell *pcell,
cell;
int x = ras.ex;
if ( x
> ras.max_ex )
x = ras.max_ex;
pcell =
&ras.ycells[ras.ey];
//following is the endless loop
// this circle list has only one node…
for (;;)
{
cell = *pcell;
if ( cell == NULL || cell->x > x )
break;
if ( cell->x == x )
goto Exit;
pcell = &cell->next;
}
if (
ras.num_cells >= ras.max_cells )
ft_longjmp( ras.jump_buffer, 1 );
cell = ras.cells + ras.num_cells++;
cell->x = x;
cell->area = 0;
cell->cover = 0;
cell->next = *pcell;
*pcell = cell;
Exit:
return
cell;
}
Here are the detail information of the calling stack:
We use freetype through cairo
freetype.dll!gray_find_cell(TWorker_ * worker=0x00a5c9e8) 行408 + 0x9 字节 C
freetype.dll!gray_record_cell(TWorker_ * worker=0x00a5c9e8) 行438 + 0x9 字节 C
freetype.dll!gray_set_cell(TWorker_ * worker=0x00a5c9e8, int ex=4, int ey=12) 行481 + 0x9 字节 C
freetype.dll!gray_render_scanline(TWorker_ * worker=0x00a5c9e8, int ey=12, long x1=1200, int y1=108, long x2=1200, int y2=108) 行545 + 0x11 字节 C
freetype.dll!gray_render_line(TWorker_ * worker=0x00a5c9e8, long to_x=1200, long to_y=3180) 行670 + 0x20 字节 C
freetype.dll!gray_line_to(const FT_Vector_ * to=0x0013d594, TWorker_ * worker=0x00a5c9e8) 行1092 + 0x1c 字节 C
freetype.dll!FT_Outline_Decompose(FT_Outline_ * outline=0x00a5cdbc, const FT_Outline_Funcs_ * func_interface=0x020fa244, void * user=0x00a5c9e8) 行151 + 0x10 字节 C
freetype.dll!gray_convert_glyph_inner(TWorker_ * worker=0x00a5c9e8) 行1621 + 0x18 字节 C
freetype.dll!gray_convert_glyph(TWorker_ * worker=0x00a5c9e8) 行1742 + 0x9 字节 C
freetype.dll!gray_raster_render(TRaster_ * raster=0x00a57f20, const FT_Raster_Params_ * params=0x0013d7d4) 行1871 + 0x9 字节 C
freetype.dll!FT_Outline_Render(FT_LibraryRec_ * library=0x00a5c900, FT_Outline_ * outline=0x00a63afc, FT_Raster_Params_ * params=0x0013d7d4) 行578 + 0x13 字节 C
freetype.dll!FT_Outline_Get_Bitmap(FT_LibraryRec_ * library=0x00a5c900, FT_Outline_ * outline=0x00a63afc, const FT_Bitmap_ * abitmap=0x0013d840) 行625 + 0x11 字节 C
cairo.dll!_render_glyph_outline(FT_FaceRec_ * face=0x00a626c0, _cairo_font_options * font_options=0x0236a130, _cairo_image_surface * * surface=0x0013d8b0) 行1028 + 0x13 字节 C
cairo.dll!_cairo_ft_scaled_glyph_init(void * abstract_font=0x0236a018, _cairo_scaled_glyph * scaled_glyph=0x0390a9f0, _cairo_scaled_glyph_info info=CAIRO_SCALED_GLYPH_INFO_SURFACE) 行1964 + 0x17 字节 C
cairo.dll!_cairo_scaled_glyph_lookup(_cairo_scaled_font * scaled_font=0x0236a018, unsigned long index=37, _cairo_scaled_glyph_info info=3, _cairo_scaled_glyph * * scaled_glyph_ret=0x0013d9d0) 行1600 + 0x1a 字节 C
cairo.dll!_cairo_scaled_font_show_glyphs(_cairo_scaled_font * scaled_font=0x0236a018, _cairo_operator op=CAIRO_OPERATOR_OVER, _cairo_pattern * pattern=0x0013dcc4, _cairo_surface * surface=0x03907248, int source_x=6, int source_y=24, int dest_x=6, int dest_y=24, unsigned int width=226, unsigned int height=20, cairo_glyph_t * glyphs=0x0013dd7c, int num_glyphs=14) 行1118 + 0x1c 字节 C
cairo.dll!_cairo_surface_old_show_glyphs_draw_func(void * closure=0x0013dc2c, _cairo_operator op=CAIRO_OPERATOR_OVER, _cairo_pattern * src="">行978 + 0x59 字节 C
cairo.dll!_clip_and_composite(_cairo_clip * clip=0x0237eb14, _cairo_operator op=CAIRO_OPERATOR_OVER, _cairo_pattern * src=""
TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="2"
UnitName="C" w:st="on">2c, _cairo_surface * dst=0x03907248, const _cairo_rectangle_int16 * extents=0x0013dc18) 行397 + 0x1b 字节 C
cairo.dll!_cairo_surface_fallback_show_glyphs(_cairo_surface * surface=0x03907248, _cairo_operator op=CAIRO_OPERATOR_OVER, _cairo_pattern * source=0x0013dcc4, cairo_glyph_t * glyphs=0x0013dd7c, int num_glyphs=14, _cairo_scaled_font * scaled_font=0x0236a018) 行1027 + 0x28 字节 C
cairo.dll!_cairo_surface_show_glyphs(_cairo_surface * surface=0x03907248, _cairo_operator op=CAIRO_OPERATOR_OVER, _cairo_pattern * source=0x0013e57c, cairo_glyph_t * glyphs=0x0013dd7c, int num_glyphs=14, _cairo_scaled_font * scaled_font=0x0236a018) 行1809 + 0x23 字节 C
cairo.dll!_cairo_gstate_show_glyphs(_cairo_gstate * gstate=0x0237ea90, const cairo_glyph_t * glyphs=0x0237a740, int num_glyphs=14) 行1596 + 0x2b 字节 C
cairo.dll!cairo_show_glyphs(_cairo * cr=0x0237ea70, const cairo_glyph_t * glyphs=0x0237a740, int num_glyphs=14) 行2945 + 0x14 字节 C
Hopefully you can give me
some help. Any suggestion would be highly appreciated!!
Thanks again!
Regards
wang xintuo