- byte_t *p_char, *p_border; /* character and border mask data */
- int i_char_mask, i_border_mask, i_bg_mask; /* masks */
- int i_line; /* current line in character */
- int i_byte; /* current byte in character */
- int i_interspacing; /* offset between two chars */
- int i_font_bytes_per_line, i_font_height; /* font properties */
- int i_position, i_end; /* current position */
- vout_put_byte_t *p_PutByte; /* PutByte function */
-
- /* If no font was loaded, do nothing */
- if( p_font == NULL )
- {
- return;
- }
-
- /* FIXME: background: can be something else that whole byte ?? */
-
- /* Select output function */
- switch( i_bytes_per_pixel )
- {
- case 1:
- p_PutByte = (vout_put_byte_t *) PutByte8;
- break;
- case 2:
- p_PutByte = (vout_put_byte_t *) PutByte16;
- break;
- case 3:
- p_PutByte = (vout_put_byte_t *) PutByte24;
- break;
- case 4:
- default:
- p_PutByte = (vout_put_byte_t *) PutByte32;
- break;
- }
-
- /* Choose masks and copy font data to local variables */
- i_char_mask = (i_style & VOID_TEXT) ? 0 : 0xff;
- i_border_mask = (i_style & OUTLINED_TEXT) ? 0xff : 0;
- i_bg_mask = (i_style & OPAQUE_TEXT) ? 0xff : 0;
-
- i_font_bytes_per_line = p_font->i_bytes_per_line;
- i_font_height = p_font->i_height;
- i_interspacing = i_bytes_per_pixel * ((i_style & WIDE_TEXT) ?
- p_font->i_interspacing * 2 :
- p_font->i_interspacing);
-
- /* compute where to stop... */
- i_end = (int) (i_percent * strlen(psz_text) / 100LL);
- if(i_end > strlen(psz_text))
- i_end = strlen(psz_text);
-
-
- /* Print text */
- for( i_position = 0; i_position < i_end; i_position++ ,psz_text++ )
- {
- /* Check that the character is valid */
- if( (*psz_text >= p_font->i_first) && (*psz_text <= p_font->i_last) )
- {
- /* Select character - bytes per char is always valid, event for
- * non fixed fonts */
- p_char = p_font->p_data + (*psz_text - p_font->i_first) * p_font->i_bytes_per_char;
- p_border = p_char + (p_font->i_last - p_font->i_first + 1) * p_font->i_bytes_per_char;
-
- /* Select base address for output */
- switch( p_font->i_type )
- {
- case VOUT_FIXED_FONT:
- /*
- * Simple fixed width font
- */
-
- /* Italic text: shift picture start right */
- if( i_style & ITALIC_TEXT )
- {
- p_pic += i_bytes_per_pixel * (p_font->i_height / 3);
- }
-
- /* Print character */
- for( i_line = 0; i_line < i_font_height; i_line ++ )
- {
- for( i_byte = 0; i_byte < i_font_bytes_per_line; i_byte++, p_char++, p_border++)
- {
- /* Put pixels */
- p_PutByte( p_pic + i_bytes_per_line * i_line, i_byte,
- *p_char & i_char_mask, *p_border & i_border_mask, i_bg_mask,
- i_char_color, i_border_color, i_bg_color );
- }
-
- /* Italic text: shift picture start left */
- if( (i_style & ITALIC_TEXT) && !(i_line % 3) )
- {
- p_pic -= i_bytes_per_pixel;
- }
- }
-
- /* Jump to next character */
- p_pic += i_interspacing;
- break;
-#ifdef DEBUG
- default:
- intf_DbgMsg("error: unknown font type %d", p_font->i_type );
- break;
-#endif
- }
- }
-
- }
+ text_style_t *p_style = calloc( 1, sizeof(*p_style) );
+ if( !p_style )
+ return NULL;
+
+ /* initialize to default text style */
+ p_style->psz_fontname = NULL;
+ p_style->i_font_size = 22;
+ p_style->i_font_color = 0xffffff;
+ p_style->i_font_alpha = 0xff;
+ p_style->i_style_flags = STYLE_OUTLINE;
+ p_style->i_outline_color = 0x000000;
+ p_style->i_outline_alpha = 0xff;
+ p_style->i_shadow_color = 0x000000;
+ p_style->i_shadow_alpha = 0xff;
+ p_style->i_background_color = 0xffffff;
+ p_style->i_background_alpha = 0x80;
+ p_style->i_karaoke_background_color = 0xffffff;
+ p_style->i_karaoke_background_alpha = 0xff;
+ p_style->i_outline_width = 1;
+ p_style->i_shadow_width = 0;
+ p_style->i_spacing = -1;
+
+ return p_style;