[vlc-commits] text_style: use monospace flag instead of boolean

Francois Cartegnie git at videolan.org
Wed Aug 5 22:51:39 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Aug  5 22:25:44 2015 +0200| [b7167cb393a8d46dd7c55cf664a6899146b367fa] | committer: Francois Cartegnie

text_style: use monospace flag instead of boolean

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b7167cb393a8d46dd7c55cf664a6899146b367fa
---

 include/vlc_text_style.h         |    4 ++--
 modules/codec/cc.c               |    4 ++--
 modules/text_renderer/freetype.c |    3 ++-
 src/misc/text_style.c            |    1 -
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/vlc_text_style.h b/include/vlc_text_style.h
index 677d469..5d6eba1 100644
--- a/include/vlc_text_style.h
+++ b/include/vlc_text_style.h
@@ -49,9 +49,8 @@ typedef struct
     uint8_t    i_font_alpha;      /**< The transparency of the text.
                                        0x00 is fully opaque,
                                        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 */
-    bool       b_monospaced;      /**< If font should be default monospaced font */
 
     /* Outline */
     int        i_outline_color;   /**< The color of the outline 0xRRGGBB */
@@ -87,6 +86,7 @@ typedef struct
 #define STYLE_UNDERLINE   32
 #define STYLE_STRIKEOUT   64
 #define STYLE_HALFWIDTH   128
+#define STYLE_MONOSPACED  256
 
 #define STYLE_DEFAULT_FONT_SIZE 22
 
diff --git a/modules/codec/cc.c b/modules/codec/cc.c
index fa4bbe1..d9b2290 100644
--- a/modules/codec/cc.c
+++ b/modules/codec/cc.c
@@ -942,7 +942,7 @@ static text_segment_t * Eia608TextLine( struct eia608_screen *screen, int i_row,
         return NULL;
     }
     /* 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 */
     i_start = 0;
@@ -983,7 +983,7 @@ static text_segment_t * Eia608TextLine( struct eia608_screen *screen, int i_row,
                 text_segment_Delete(p_segment);
                 return p_segments_head;
             }
-            p_segment->style->b_monospaced = true;
+            p_segment->style->i_style_flags |= STYLE_MONOSPACED;
 
             /* start segment with new style */
             if(font & EIA608_FONT_ITALICS)
diff --git a/modules/text_renderer/freetype.c b/modules/text_renderer/freetype.c
index 4ac9598..40c470c 100644
--- a/modules/text_renderer/freetype.c
+++ b/modules/text_renderer/freetype.c
@@ -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 ) )
             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 */
     FT_Face p_face = LoadEmbeddedFace( p_sys, psz_fontname, p_style );
diff --git a/src/misc/text_style.c b/src/misc/text_style.c
index 5ccc2c7..82c9640 100644
--- a/src/misc/text_style.c
+++ b/src/misc/text_style.c
@@ -53,7 +53,6 @@ text_style_t *text_style_New( void )
     p_style->i_outline_width = 1;
     p_style->i_shadow_width = 0;
     p_style->i_spacing = -1;
-    p_style->b_monospaced = false;
 
     return p_style;
 }



More information about the vlc-commits mailing list