-#ifdef SYS_BEOS
- /* Under BeOS, we need to add beos_GetProgramPath() to access
- * files under the current directory */
- if( strncmp( *ppsz_path, "/", 1 ) )
- {
- psz_file = malloc( strlen( psz_name ) + strlen( *ppsz_path )
- + i_vlclen + 3 );
- if( psz_file == NULL )
- {
- continue;
- }
- sprintf( psz_file, "%s/%s/%s", psz_vlcpath, *ppsz_path, psz_name );
- }
- else
-#endif
- {
- psz_file = malloc( strlen( psz_name ) + strlen( *ppsz_path ) + 2 );
- if( psz_file == NULL )
- {
- continue;
- }
- sprintf( psz_file, "%s/%s", *ppsz_path, psz_name );
- }
-
- /* Open file */
- i_file = open( psz_file, O_RDONLY );
- free( psz_file );
-
- if( i_file != -1 )
- {
- break;
- }
- }
-
- if( i_file == -1 )
- {
- intf_DbgMsg( "vout error: can't open file '%s' (%s)",
- psz_name, strerror(errno) );
- return( NULL );
- }
-
- /* Read magick number */
- if( read( i_file, pi_buffer, 2 ) != 2 )
- {
- intf_ErrMsg("vout error: unexpected end of file '%s'", psz_name );
- close( i_file );
- return( NULL );
- }
-
- /* Allocate font descriptor */
- p_font = malloc( sizeof( vout_font_t ) );
- if( p_font == NULL )
- {
- intf_ErrMsg( "vout error: cannot allocate vout_font_t (%s)",
- strerror(ENOMEM) );
- close( i_file );
- return( NULL );
- }
-
- /* Read file */
- switch( ((u16)pi_buffer[0] << 8) | pi_buffer[1] )
- {
- case 0x3604: /* .psf file */
- /*
- * PSF font: simple fixed font. Only the first 256 characters are read.
- * Those fonts are always 1 byte wide, and 256 or 512 characters long.
- */
-
- /* Read font header - two bytes indicate the font properties */
- if( read( i_file, pi_buffer, 2 ) != 2)
- {
- intf_ErrMsg( "vout error: unexpected end of file '%s'", psz_name );
- free( p_font );
- close( i_file );
- return( NULL );
- }
-
- /* Copy font properties */
- p_font->i_type = VOUT_FIXED_FONT;
- p_font->i_width = 8;
- p_font->i_height = pi_buffer[1];
- p_font->i_interspacing = 8;
- p_font->i_bytes_per_line = 1;
- p_font->i_bytes_per_char = pi_buffer[1];
- p_font->i_first = 0;
- p_font->i_last = 255;
-
- /* Allocate font space */
- p_font->p_data = malloc( 2 * 256 * pi_buffer[1] );
- if( p_font->p_data == NULL )
- {
- intf_ErrMsg( "vout error: cannot allocate font space (%s)",
- strerror(ENOMEM) );
- free( p_font );
- close( i_file );
- return( NULL );
- }
-
- /* Copy raw data */
- if( read( i_file, p_font->p_data, 256 * pi_buffer[1] ) != 256 * pi_buffer[1] )
- {
- intf_ErrMsg("vout error: unexpected end of file '%s'", psz_name );
- free( p_font->p_data );
- free( p_font );
- close( i_file );
- return( NULL );
- }
-
- /* Computes border masks - remember that masks have the same matrix as
- * characters, so an empty character border is required to have a complete
- * border mask. */
- for( i_char = 0; i_char <= 255; i_char++ )
- {
- for( i_line = 0; i_line < pi_buffer[1]; i_line++ )
- {
-
- p_font->p_data[ (i_char + 256) * pi_buffer[1] + i_line ] =
- ((p_font->p_data[ i_char * pi_buffer[1] + i_line ] << 1) |
- (p_font->p_data[ i_char * pi_buffer[1] + i_line ] >> 1) |
- (i_line > 0 ? p_font->p_data[ i_char * pi_buffer[1] + i_line - 1]: 0) |
- (i_line < pi_buffer[1] - 1 ? p_font->p_data[ i_char * pi_buffer[1] + i_line + 1]: 0))
- & ~p_font->p_data[ i_char * pi_buffer[1] + i_line ];
- }
- }
-
- break;
- default:
- intf_ErrMsg("vout error: file '%s' has an unknown format", psz_name );
- free( p_font );
- close( i_file );
- return( NULL );
- break;