Commit 8bbf66a5 authored by Young-Ho Cha's avatar Young-Ho Cha Committed by Tim-Philipp Müller
Browse files

gst/subparse/samiparse.c: Honour font face tags in SAMI subtitles (#344503).

Original commit message from CVS:
Patch by: Young-Ho Cha  <ganadist at chollian net>
* gst/subparse/samiparse.c: (sami_context_pop_state),
(handle_start_font), (end_sami_element):
Honour font face tags in SAMI subtitles (#344503).
parent 189fd3d7
2006-06-12 Tim-Philipp Müller <tim at centricular dot net>
Patch by: Young-Ho Cha <ganadist at chollian net>
* gst/subparse/samiparse.c: (sami_context_pop_state),
(handle_start_font), (end_sami_element):
Honour font face tags in SAMI subtitles (#344503).
2006-06-11 Stefan Kost <ensonic@users.sf.net>
 
* po/POTFILES.in:
......
......@@ -25,7 +25,7 @@
#include <string.h>
#define ITALIC_TAG 'i'
#define COLOR_TAG 'c'
#define SPAN_TAG 's'
#define RUBY_TAG 'r'
#define RT_TAG 't'
#define CLEAR_TAG '0'
......@@ -79,7 +79,7 @@ sami_context_pop_state (GstSamiContext * sctx, char state)
g_string_append (str, "</i>");
break;
}
case COLOR_TAG: /* <span foreground= > */
case SPAN_TAG: /* <span foreground= > */
{
g_string_append (str, "</span>");
break;
......@@ -146,8 +146,9 @@ handle_start_font (GstSamiContext * sctx, const xmlChar ** atts)
{
int i;
sami_context_pop_state (sctx, COLOR_TAG);
sami_context_pop_state (sctx, SPAN_TAG);
if (atts != NULL) {
g_string_append (sctx->buf, "<span");
for (i = 0; (atts[i] != NULL); i += 2) {
const xmlChar *key, *value;
......@@ -179,11 +180,14 @@ handle_start_font (GstSamiContext * sctx, const xmlChar ** atts)
if (!xmlStrncmp ((const xmlChar *) "silver", value, 6)) {
value = (const xmlChar *) "#c0c0c0";
}
g_string_append_printf (sctx->buf, "<span foreground=\"%s%s\">", sharp,
g_string_append_printf (sctx->buf, " foreground=\"%s%s\"", sharp,
value);
sami_context_push_state (sctx, COLOR_TAG);
} else if (!xmlStrncmp ((const xmlChar *) "face", key, 4)) {
g_string_append_printf (sctx->buf, " font_family=\"%s\"", value);
}
}
g_string_append_c (sctx->buf, '>');
sami_context_push_state (sctx, SPAN_TAG);
}
}
......@@ -224,7 +228,7 @@ end_sami_element (void *ctx, const xmlChar * name)
if (!xmlStrncmp ((const xmlChar *) "title", name, 5)) {
sctx->in_title = FALSE;
} else if (!xmlStrncmp ((const xmlChar *) "font", name, 4)) {
sami_context_pop_state (sctx, COLOR_TAG);
sami_context_pop_state (sctx, SPAN_TAG);
} else if (!xmlStrncmp ((const xmlChar *) "ruby", name, 4)) {
sami_context_pop_state (sctx, RUBY_TAG);
} else if (!xmlStrncmp ((const xmlChar *) "i", name, 1)) {
......
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