freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Devel] Debugging API for truetype?


From: George Williams
Subject: [Devel] Debugging API for truetype?
Date: Mon, 13 May 2002 19:36:26 -0700

Hello David,
I have been thinking for a while about writing a truetype debugger so that I could single step a truetype glyph's instructions and watch its points move (and figure out more easily where pfaedit's hinting is wrong). I would like to use freetype to execute instructions, which (I think) means expanding the API. I fear that this expansion is unlikely to be useful to anyone but me (possibly you too) and therefore you will prefer not to have it folded in to your main cvs branch. But on the off chance that you might be interested I thought I'd run it past the mailing list...

   At the moment I would like to have the following entry points:

        FT_Error FT_Load_Glyph_Debug(FT_Face face, int glyph_id, int flags,
                FT_GlyphDebugContext *db_context,
                void *usercontext,
                void (*motioncallback)(void *usercontext,int pnum,
                        FT_Vector newpos));
This would be similar to FT_LoadGlyph except that it would return without executing any instructions. The FT_GlyphDebugContext would probably be very similar to TT_ExecContextRec and would be returned from the routine. The motioncallback would be an optional routine that the interpreter would call each time it moved a point.

        FT_Error FT_Single_Step_Glyph(FT_GlyphDebugContext db_context)
Single steps to the next instruction, possibly calling the motioncallback routine.

        FT_Error FT_Debug_State(FT_GlyphDebugContext db_context,
                FT_DebugStateEnum which,
                FT_DebugStateUnion *value)
Retrieves current state information from the debug context. This would include things like
        * current instruction pc
                (offset, fdef/idef number, whether it is fdef/idef/fpgm/prep or 
char)
        * nested pcs
        * values on the stack
        * registers
        * vectors
        * ttf state variables
        * whether we are finished or not

        FT_Error FT_Outline_Decompose_Debug(FT_GlyphDebugContext db,
                const FT_Outline_Funcs *funcs, void *usercontext, int twilight)
Retrieves the current locations of the points either in zone 0 or 1.

        FT_Error FT_End_Debug(FT_GlyphDebugContext db)
To end the current debug session.

If applied to a non ttf font then I assume FT_Load_Glyph_Debug would behave as if there were no instructions associated with the glyph.

Would this be at all interesting to anyone else, and if so are there any suggestions for improving the API? Or is it likely to be such a horrible kludge that I should not even be suggesting it?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]