Esempio n. 1
0
void
i_close_t1(void) {
  i_mutex_lock(mutex);
  T1_CloseLib();
  t1_initialized = 0;
  i_mutex_unlock(mutex);
}
Esempio n. 2
0
static undef_int
i_init_t1_low(int t1log) {
  int init_flags = IGNORE_CONFIGFILE|IGNORE_FONTDATABASE;

  mm_log((1,"init_t1(%d)\n", t1log));

  i_clear_error();

  if (t1_active_fonts) {
    mm_log((1, "Cannot re-initialize T1 - active fonts\n"));
    i_push_error(0, "Cannot re-initialize T1 - active fonts");
    return 1;
  }

  if (t1_initialized) {
    T1_CloseLib();
    t1_initialized = 0;
  }
  
  if (t1log)
    init_flags |= LOGFILE;
  if ((T1_InitLib(init_flags) == NULL)){
    mm_log((1,"Initialization of t1lib failed\n"));
    i_push_error(0, "T1_InitLib failed");
    return(1);
  }
  T1_SetLogLevel(T1LOG_DEBUG);

  ++t1_initialized;

  return(0);
}
int main( void)
{

  GLYPH *glyph;
  int i;
  char * my_config = malloc(25);
  
  sprintf(my_config, "T1LIB_CONFIG=%s",LOCAL_CONFIG);
  
  /* Set our environment to an existent config file directory */
  putenv( my_config);

  /* Pad bitmaps to 16 bits, the default being 8 bits */
  T1_SetBitmapPad( 16);
  
  /* Initialize t1lib and return if error occurs. No logfile will be
     generated */
  if ((T1_InitLib(NO_LOGFILE)==NULL)){
    fprintf(stderr, "Initialization of t1lib failed\n");
    return(-1);
  }

  /* For every font in the database, generate a glyph for the string
     "Test" at 25 bp. Use Kerning. Then dump an ASCII representation
     of the glyph to stdout */
  for( i=0; i<T1_GetNoFonts(); i++){
    printf("FontID=%d, Font=%s\n", i, T1_GetFontFilePath(i));
    printf("FontID=%d, Metrics=%s\n", i, T1_GetAfmFilePath(i));
    glyph=T1_SetString( i, "Test", 0, 0, T1_KERNING, 25.0, NULL);
    T1_DumpGlyph( glyph);
  }

  /* Close library and free all data */
  T1_CloseLib();
  
  return( 0);
  
}