freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] ftvalid


From: Masatake YAMATO
Subject: Re: [ft-devel] ftvalid
Date: Fri, 16 Jun 2006 06:17:44 +0900 (JST)

At George's suggestons, I've rewritten some part of ftvalid.
In my new code ftvalid tries to detect gxvalid is available 
or not with following code:

   /* Checking availability of FT_TrueTypeGX_Validate 
      before running validator */
   error = FT_TrueTypeGX_Validate(  NULL, 0, NULL, 0  );
   if ( error == FT_Err_Unimplemented_Feature )
      panic (error, "FT_TrueTypeGX_Validate is not available );

However, this code doesn't work. NULL and zero args are checked
before checking the module availability in FT_TrueTypeGX_Validate.

  FT_EXPORT_DEF( FT_Error )
  FT_TrueTypeGX_Validate( FT_Face   face,
                          FT_UInt   validation_flags,
                          FT_Bytes  tables[FT_VALIDATE_GX_LENGTH],
                          FT_UInt   table_length )
  {
    FT_Service_GXvalidate  service;
    FT_Error               error;


    if ( !face )
    {
      error = FT_Err_Invalid_Face_Handle; <<<<<<<<<<<<<<<<<<<<<<<<<
      goto Exit;
    }

    if ( tables == NULL )
    {
      error = FT_Err_Invalid_Argument;   <<<<<<<<<<<<<<<<<<<<<<<<<<
      goto Exit;
    }

    FT_FACE_FIND_GLOBAL_SERVICE( face, service, GX_VALIDATE );

    if ( service )
      error = service->validate( face,
                                 validation_flags,
                                 tables,
                                 table_length );
    else
      error = FT_Err_Unimplemented_Feature; <<<<<<<<<<<<< FINALY...

  Exit:
    return error;
  }


I think FT_Err_Unimplemented_Feature should be returned immediately
if gxvalid module is not available. However, current implementation
requires non-NULL face and non-NULL tables in any case.
libfreetype2.so itself knows gxvalid module is available or not.

Toshiya-san, do you remember who wrote this code? Did I?

Masatake YAMATO




reply via email to

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