[vlc-commits] text_style: add line breaking info

Francois Cartegnie git at videolan.org
Mon Jun 5 20:52:36 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Jun  2 17:18:51 2017 +0200| [84bea4d164437922baacd527a2db3a10014b890f] | committer: Francois Cartegnie

text_style: add line breaking info

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

 include/vlc_text_style.h | 9 +++++++++
 src/misc/text_style.c    | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/include/vlc_text_style.h b/include/vlc_text_style.h
index 523d789147..b3b07bf8cd 100644
--- a/include/vlc_text_style.h
+++ b/include/vlc_text_style.h
@@ -68,6 +68,14 @@ typedef struct
     uint8_t    i_background_alpha;/**< The transparency of the background */
     int        i_karaoke_background_color;/**< Background color for karaoke 0xRRGGBB */
     uint8_t    i_karaoke_background_alpha;/**< The transparency of the karaoke bg */
+
+    /* Line breaking */
+    enum
+    {
+        STYLE_WRAP_DEFAULT = 0,   /**< Breaks on whitespace or fallback on char */
+        STYLE_WRAP_CHAR,          /**< Breaks at character level only */
+        STYLE_WRAP_NONE,          /**< No line breaks (except explicit ones) */
+    } e_wrapinfo;
 } text_style_t;
 
 #define STYLE_ALPHA_OPAQUE      0xFF
@@ -87,6 +95,7 @@ typedef struct
 #define STYLE_HAS_BACKGROUND_ALPHA      (1 << 8)
 #define STYLE_HAS_K_BACKGROUND_COLOR    (1 << 9)
 #define STYLE_HAS_K_BACKGROUND_ALPHA    (1 << 10)
+#define STYLE_HAS_WRAP_INFO             (1 << 11)
 
 /* Style flags for \ref text_style_t */
 #define STYLE_BOLD              (1 << 0)
diff --git a/src/misc/text_style.c b/src/misc/text_style.c
index adff5ad3b2..90de47a912 100644
--- a/src/misc/text_style.c
+++ b/src/misc/text_style.c
@@ -65,6 +65,7 @@ text_style_t *text_style_Create( int i_defaults )
     p_style->i_outline_width = 1;
     p_style->i_shadow_width = 0;
     p_style->i_spacing = -1;
+    p_style->e_wrapinfo = STYLE_WRAP_DEFAULT;
 
     return p_style;
 }
@@ -120,6 +121,7 @@ void text_style_Merge( text_style_t *p_dst, const text_style_t *p_src, bool b_ov
         MERGE(i_background_alpha,   STYLE_HAS_BACKGROUND_ALPHA);
         MERGE(i_karaoke_background_color, STYLE_HAS_K_BACKGROUND_COLOR);
         MERGE(i_karaoke_background_alpha, STYLE_HAS_K_BACKGROUND_ALPHA);
+        MERGE(e_wrapinfo,            STYLE_HAS_WRAP_INFO);
         p_dst->i_features |= p_src->i_features;
         p_dst->i_style_flags |= p_src->i_style_flags;
     }



More information about the vlc-commits mailing list