Ejemplo n.º 1
0
SV*
Application_fonts( Handle self, char * name, char * encoding)
{
   int count, i;
   AV * glo = newAV();
   PFont fmtx = apc_fonts( self, name[0] ? name : nil,
      encoding[0] ? encoding : nil, &count);
   for ( i = 0; i < count; i++) {
      SV * sv      = sv_Font2HV( &fmtx[ i]);
      HV * profile = ( HV*) SvRV( sv);
      if ( fmtx[i]. utf8_flags & FONT_UTF8_NAME) {
         SV ** entry = hv_fetch(( HV*) SvRV( sv), "name", 4, 0);
	 if ( entry && SvOK( *entry))
            SvUTF8_on( *entry);
      }	 
      if ( fmtx[i]. utf8_flags & FONT_UTF8_FAMILY) {
         SV ** entry = hv_fetch(( HV*) SvRV( sv), "family", 6, 0);
	 if ( name && SvOK( *entry))
            SvUTF8_on( *entry);
      }	 
      if ( fmtx[i]. utf8_flags & FONT_UTF8_ENCODING) {
         SV ** entry = hv_fetch(( HV*) SvRV( sv), "encoding", 8, 0);
	 if ( name && SvOK( *entry))
            SvUTF8_on( *entry);
      }	 
      if ( name[0] == 0 && encoding[0] == 0) {
         /* Read specially-coded (const char*) encodings[] vector,
            stored in fmtx[i].encoding. First pointer is filled with 0s,
            except the last byte which is a counter. Such scheme
            allows max 31 encodings per entry to be coded with sizeof(char*)==8.
            The interface must be re-implemented, but this requires
            either change in gencls syntax so arrays can be members of hashes,
            or passing of a dynamic-allocated pointer vector here.
          */
         char ** enc = (char**) fmtx[i].encoding;
         unsigned char * shift = (unsigned char*) enc + sizeof(char *) - 1, j = *shift;
         AV * loc = newAV();
         pset_sv_noinc( encoding, newSVpv(( j > 0) ? *(++enc) : "", 0));
         while ( j--) av_push( loc, newSVpv(*(enc++),0));
         pset_sv_noinc( encodings, newRV_noinc(( SV*) loc));
      }
      pdelete( resolution);
      pdelete( codepage);
      av_push( glo, sv);
   }
   free( fmtx);
   return newRV_noinc(( SV *) glo);
}
Ejemplo n.º 2
0
static void * 
open_load( PImgCodec instance, PImgLoadFileInstance fi)
{
	LoadRec * l = malloc( sizeof( LoadRec));
	HV * profile = fi-> fileProperties;
	
	if ( !l) return nil;
	memset( l, 0, sizeof( LoadRec));
	
	GIF_CALL 0;
	if ( !( l-> gft = DGifOpen( fi-> req, my_gif_read GIF_ERROR_ARG))) {
		free( l);
		return nil;
	}
	fi-> stop = true;

	l-> passed  = -1;
	l-> transparent = -1;

	if ( fi-> loadExtras) {
		pset_i( screenWidth,           l-> gft-> SWidth);
		pset_i( screenHeight,          l-> gft-> SHeight);
		pset_i( screenColorResolution, l-> gft-> SColorResolution);
		pset_i( screenBackGroundColor, l-> gft-> SBackGroundColor);
		pset_sv_noinc( screenPalette,  make_palette_sv( l-> gft-> SColorMap));
	}
	return l;
}