Skip to content

Commit

Permalink
A few more small adjustments to the freetype Diagnostics API implemen…
Browse files Browse the repository at this point in the history
…tation

(place the diagnostics callback into FT_Face_Internal)
  • Loading branch information
felipesanches committed Sep 11, 2017
1 parent dac77c3 commit 51ec98b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 19 deletions.
2 changes: 0 additions & 2 deletions builds/exports.mk
Expand Up @@ -64,8 +64,6 @@ ifneq ($(EXPORTS_LIST),)
$(subst /,$(SEP),$(APINAMES_EXE)) -o$@ $(APINAMES_OPTIONS) $(PUBLIC_HEADERS)
@echo TT_New_Context >> $(EXPORTS_LIST)
@echo TT_RunIns >> $(EXPORTS_LIST)
@echo TT_Diagnostics_Unset >> $(EXPORTS_LIST)
@echo TT_Diagnostics_Set >> $(EXPORTS_LIST)

$(PROJECT_LIBRARY): $(EXPORTS_LIST)

Expand Down
14 changes: 5 additions & 9 deletions include/freetype/freetype.h
Expand Up @@ -837,7 +837,6 @@ FT_BEGIN_HEADER
} FT_CharMapRec;


#ifdef FT_DIAGNOSTICS
/*************************************************************************/
/* */
/* <Struct> */
Expand All @@ -855,7 +854,7 @@ FT_BEGIN_HEADER
int callTop,
int opc,
int start );
#endif


/*************************************************************************/
/*************************************************************************/
Expand Down Expand Up @@ -1046,6 +1045,10 @@ FT_BEGIN_HEADER
/* */
/* charmap :: The current active charmap for this face. */
/* */
/* diagnostics :: A callback that provides details about */
/* problems detected while interpreting */
/* hinting instructions. */
/* */
/* <Note> */
/* Fields may be changed after a call to @FT_Attach_File or */
/* @FT_Attach_Stream. */
Expand Down Expand Up @@ -1104,10 +1107,6 @@ FT_BEGIN_HEADER

FT_Face_Internal internal;

#ifdef FT_DIAGNOSTICS
FT_DiagnosticsFunc diagnostics;
#endif

/*@private end */

} FT_FaceRec;
Expand Down Expand Up @@ -4290,7 +4289,6 @@ FT_BEGIN_HEADER
FT_Bool value );


#ifdef FT_DIAGNOSTICS
/*************************************************************************/
/* */
/* <Function> */
Expand Down Expand Up @@ -4327,8 +4325,6 @@ FT_BEGIN_HEADER
FT_EXPORT( void )
FT_Diagnostics_Unset( FT_Face face );

#endif /* FT_DIAGNOSTICS */

/* */

FT_END_HEADER
Expand Down
4 changes: 4 additions & 0 deletions include/freetype/internal/ftobjs.h
Expand Up @@ -359,6 +359,10 @@ FT_BEGIN_HEADER
FT_Incremental_InterfaceRec* incremental_interface;
#endif

#ifdef FT_DIAGNOSTICS
FT_DiagnosticsFunc diagnostics;
#endif

FT_Int refcount;

} FT_Face_InternalRec;
Expand Down
4 changes: 0 additions & 4 deletions include/freetype/internal/tttypes.h
Expand Up @@ -1157,10 +1157,6 @@ FT_BEGIN_HEADER
/* It must be called after the header was */
/* read, and before the `forget'. */
/* */
/* diagnostics :: A callback that provides details about */
/* problems detected while interpreting */
/* hinting instructions. */
/* */
/* sfnt :: A pointer to the SFNT service. */
/* */
/* psnames :: A pointer to the PostScript names service. */
Expand Down
8 changes: 4 additions & 4 deletions src/truetype/ttinterp.c
Expand Up @@ -100,24 +100,24 @@
FT_EXPORT_DEF( void )
FT_Diagnostics_Unset( FT_Face face )
{
face->diagnostics = NULL;
face->internal->diagnostics = NULL;
}

/* documentation is in freetype.h */
FT_EXPORT_DEF( void )
FT_Diagnostics_Set( FT_Face face,
FT_DiagnosticsFunc funcptr )
{
face->diagnostics = funcptr;
face->internal->diagnostics = funcptr;
}
#endif

#ifdef FT_DIAGNOSTICS
#define DIAGNOSTICS( message, context ) \
do \
{ \
if ( exc->face->root.diagnostics ) \
(*exc->face->root.diagnostics)( message, \
if ( exc->face->root.internal->diagnostics ) \
(*exc->face->root.internal->diagnostics)( message, \
opcode_name[(context)->opcode] + 2, \
( (context)->callTop \
? (context)->callStack->Caller_Range \
Expand Down

0 comments on commit 51ec98b

Please sign in to comment.