summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-06-20 22:22:01 +0100
committerCarl Hetherington <cth@carlh.net>2016-06-20 22:22:01 +0100
commit6f1af34ae95586281f1632ceb87cc95784ccff28 (patch)
tree3c9b0881e8173786542ea5ddb9330a9ba0fb3691 /src
parent5a77646bf70c5fdfc39210035a7c3c3de43e89ed (diff)
Fix bold and newlines (in some cases) in SSA.
Diffstat (limited to 'src')
-rw-r--r--src/ssa_reader.cc12
-rw-r--r--src/util.cc2
2 files changed, 10 insertions, 4 deletions
diff --git a/src/ssa_reader.cc b/src/ssa_reader.cc
index 74d497a..eb85dea 100644
--- a/src/ssa_reader.cc
+++ b/src/ssa_reader.cc
@@ -239,6 +239,10 @@ SSAReader::parse_line (RawSubtitle base, string line)
current.italic = true;
} else if (style == "\\i0" || style == "\\i") {
current.italic = false;
+ } else if (style == "\\b1") {
+ current.bold = true;
+ } else if (style == "\\b0") {
+ current.bold = false;
} else if (style == "\\an1" || style == "\\an2" || style == "\\an3") {
current.vertical_position.reference = sub::BOTTOM_OF_SCREEN;
} else if (style == "\\an4" || style == "\\an5" || style == "\\an6") {
@@ -253,9 +257,11 @@ SSAReader::parse_line (RawSubtitle base, string line)
}
break;
case BACKSLASH:
- if ((c == 'n' || c == 'N') && !current.text.empty ()) {
- subs.push_back (current);
- current.text = "";
+ if (c == 'n' || c == 'N') {
+ if (!current.text.empty ()) {
+ subs.push_back (current);
+ current.text = "";
+ }
/* Move down one line (1.2 times the font size) */
if (current.vertical_position.reference.get() == BOTTOM_OF_SCREEN) {
current.vertical_position.proportional = current.vertical_position.proportional.get() - line_size;
diff --git a/src/util.cc b/src/util.cc
index a736a91..a165126 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -59,7 +59,7 @@ sub::get_line_file (FILE* f)
{
char buffer[256];
char* r = fgets (buffer, sizeof (buffer), f);
- if (r == 0 || feof (f)) {
+ if (r == 0) {
return optional<string> ();
}