[vlc-commits] Convert leading whitespace characters to non-breaking spaces
Devin Heitmueller
git at videolan.org
Mon Dec 31 14:00:04 CET 2012
vlc | branch: master | Devin Heitmueller <dheitmueller at kernellabs.com> | Thu Dec 27 01:08:16 2012 -0500| [a3b221775831de2fe24276f4468392c24be6dd35] | committer: Rafaël Carré
Convert leading whitespace characters to non-breaking spaces
If there are any whitespace characters before the start of text in a row,
convert it to non-breaking whitespace. We do this because the RenderHtml
function will strip any cases of more than one contigious whitespace. The
effect of such is that text that is not left justified will be forced to
the left.
Signed-off-by: Rafaël Carré <funman at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a3b221775831de2fe24276f4468392c24be6dd35
---
modules/codec/cc.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/modules/codec/cc.c b/modules/codec/cc.c
index 8e5b767..eeb8793 100644
--- a/modules/codec/cc.c
+++ b/modules/codec/cc.c
@@ -915,6 +915,8 @@ static void Eia608Strlcat( char *d, const char *s, int i_max )
d[i_max-1] = '\0';
}
+#define CAT(t) Eia608Strlcat( psz_text, t, i_text_max )
+
static void Eia608TextLine( struct eia608_screen *screen, char *psz_text, int i_text_max, int i_row, bool b_html )
{
const uint8_t *p_char = screen->characters[i_row];
@@ -926,11 +928,18 @@ static void Eia608TextLine( struct eia608_screen *screen, char *psz_text, int i_
eia608_color_t last_color = EIA608_COLOR_DEFAULT;
bool b_last_italics = false;
bool b_last_underline = false;
+ char utf8[4];
/* Search the start */
i_start = 0;
- while( i_start < EIA608_SCREEN_COLUMNS-1 && p_char[i_start] == ' ' )
- i_start++;
+
+ /* Convert leading spaces to non-breaking so that they don't get
+ stripped by the RenderHtml routine as regular whitespace */
+ while( i_start < EIA608_SCREEN_COLUMNS && p_char[i_start] == ' ' ) {
+ Eia608TextUtf8( utf8, 0x89 );
+ CAT( utf8 );
+ i_start++;
+ }
/* Search the end */
i_end = EIA608_SCREEN_COLUMNS-1;
@@ -938,13 +947,11 @@ static void Eia608TextLine( struct eia608_screen *screen, char *psz_text, int i_
i_end--;
/* */
-#define CAT(t) Eia608Strlcat( psz_text, t, i_text_max )
for( x = i_start; x <= i_end; x++ )
{
eia608_color_t color = p_color[x];
bool b_italics = p_font[x] & EIA608_FONT_ITALICS;
bool b_underline = p_font[x] & EIA608_FONT_UNDERLINE;
- char utf8[4];
/* */
if( b_html )
More information about the vlc-commits
mailing list