Commit b7167cb3 authored by Francois Cartegnie's avatar Francois Cartegnie

text_style: use monospace flag instead of boolean

parent cb2293a5
...@@ -49,9 +49,8 @@ typedef struct ...@@ -49,9 +49,8 @@ typedef struct
uint8_t i_font_alpha; /**< The transparency of the text. uint8_t i_font_alpha; /**< The transparency of the text.
0x00 is fully opaque, 0x00 is fully opaque,
0xFF fully transparent */ 0xFF fully transparent */
int i_style_flags; /**< Formatting style flags */ uint16_t i_style_flags; /**< Formatting style flags */
int i_spacing; /**< The spaceing between glyphs in pixels */ int i_spacing; /**< The spaceing between glyphs in pixels */
bool b_monospaced; /**< If font should be default monospaced font */
/* Outline */ /* Outline */
int i_outline_color; /**< The color of the outline 0xRRGGBB */ int i_outline_color; /**< The color of the outline 0xRRGGBB */
...@@ -87,6 +86,7 @@ typedef struct ...@@ -87,6 +86,7 @@ typedef struct
#define STYLE_UNDERLINE 32 #define STYLE_UNDERLINE 32
#define STYLE_STRIKEOUT 64 #define STYLE_STRIKEOUT 64
#define STYLE_HALFWIDTH 128 #define STYLE_HALFWIDTH 128
#define STYLE_MONOSPACED 256
#define STYLE_DEFAULT_FONT_SIZE 22 #define STYLE_DEFAULT_FONT_SIZE 22
......
...@@ -942,7 +942,7 @@ static text_segment_t * Eia608TextLine( struct eia608_screen *screen, int i_row, ...@@ -942,7 +942,7 @@ static text_segment_t * Eia608TextLine( struct eia608_screen *screen, int i_row,
return NULL; return NULL;
} }
/* Ensure we get a monospaced font (required for accurate positioning */ /* Ensure we get a monospaced font (required for accurate positioning */
p_segment->style->b_monospaced = true; p_segment->style->i_style_flags |= STYLE_MONOSPACED;
/* Search the start */ /* Search the start */
i_start = 0; i_start = 0;
...@@ -983,7 +983,7 @@ static text_segment_t * Eia608TextLine( struct eia608_screen *screen, int i_row, ...@@ -983,7 +983,7 @@ static text_segment_t * Eia608TextLine( struct eia608_screen *screen, int i_row,
text_segment_Delete(p_segment); text_segment_Delete(p_segment);
return p_segments_head; return p_segments_head;
} }
p_segment->style->b_monospaced = true; p_segment->style->i_style_flags |= STYLE_MONOSPACED;
/* start segment with new style */ /* start segment with new style */
if(font & EIA608_FONT_ITALICS) if(font & EIA608_FONT_ITALICS)
......
...@@ -1368,7 +1368,8 @@ FT_Face LoadFace( filter_t *p_filter, ...@@ -1368,7 +1368,8 @@ FT_Face LoadFace( filter_t *p_filter,
&& !( ( p_cache->p_styles[ i ].i_style_flags ^ p_style->i_style_flags ) & STYLE_HALFWIDTH ) ) && !( ( p_cache->p_styles[ i ].i_style_flags ^ p_style->i_style_flags ) & STYLE_HALFWIDTH ) )
return p_cache->p_faces[ i ]; return p_cache->p_faces[ i ];
const char *psz_fontname = (p_style->b_monospaced) ? p_style->psz_monofontname : p_style->psz_fontname; const char *psz_fontname = (p_style->i_style_flags & STYLE_MONOSPACED)
? p_style->psz_monofontname : p_style->psz_fontname;
/* Look for a match amongst our attachments first */ /* Look for a match amongst our attachments first */
FT_Face p_face = LoadEmbeddedFace( p_sys, psz_fontname, p_style ); FT_Face p_face = LoadEmbeddedFace( p_sys, psz_fontname, p_style );
......
...@@ -53,7 +53,6 @@ text_style_t *text_style_New( void ) ...@@ -53,7 +53,6 @@ text_style_t *text_style_New( void )
p_style->i_outline_width = 1; p_style->i_outline_width = 1;
p_style->i_shadow_width = 0; p_style->i_shadow_width = 0;
p_style->i_spacing = -1; p_style->i_spacing = -1;
p_style->b_monospaced = false;
return p_style; return p_style;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment