*/
struct subpicture_region_t
{
- /** \name Region properties */
- /**@{*/
video_format_t fmt; /**< format of the picture */
picture_t picture; /**< picture comprising this region */
int i_text_color; /**< text color (RGB native endianess) */
int i_text_alpha; /**< text transparency */
int i_text_size; /**< text size */
+ int i_text_align; /**< horizontal alignment hint for */
subpicture_region_t *p_next; /**< next region in the list */
subpicture_region_t *p_cache; /**< modified version of this region */
- /**@}*/
};
/**
for( ; p_line != NULL; p_line = p_line->p_next )
{
int i_glyph_tmax = 0;
- int i_bitmap_offset, i_offset;
+ int i_bitmap_offset, i_offset, i_align_offset = 0;
for( i = 0; p_line->pp_glyphs[i] != NULL; i++ )
{
FT_BitmapGlyph p_glyph = p_line->pp_glyphs[ i ];
i_glyph_tmax = __MAX( i_glyph_tmax, p_glyph->top );
}
+ if( p_line->i_width < i_width )
+ {
+ if( p_region->i_text_align == SUBPICTURE_ALIGN_RIGHT )
+ {
+ i_align_offset = i_width - p_line->i_width;
+ }
+ else if( p_region->i_text_align != SUBPICTURE_ALIGN_LEFT )
+ {
+ i_align_offset = ( i_width - p_line->i_width ) / 2;
+ }
+ }
for( i = 0; p_line->pp_glyphs[i] != NULL; i++ )
{
FT_BitmapGlyph p_glyph = p_line->pp_glyphs[ i ];
i_offset = ( p_line->p_glyph_pos[ i ].y +
i_glyph_tmax - p_glyph->top + 1 ) *
- i_pitch + p_line->p_glyph_pos[ i ].x + p_glyph->left + 1;
+ i_pitch + p_line->p_glyph_pos[ i ].x + p_glyph->left + 1 +
+ i_align_offset;
for( y = 0, i_bitmap_offset = 0; y < p_glyph->bitmap.rows; y++ )
{
i_offset = ( p_line->p_glyph_pos[ i ].y +
i_glyph_tmax - p_glyph->top + 1 ) *
- i_pitch + p_line->p_glyph_pos[ i ].x + p_glyph->left + 1;
+ i_pitch + p_line->p_glyph_pos[ i ].x + p_glyph->left + 1 +
+ i_align_offset;
for( y = 0, i_bitmap_offset = 0; y < p_glyph->bitmap.rows; y++ )
{