summaryrefslogtreecommitdiff
path: root/src/ssa_reader.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-07-06 01:32:55 +0200
committerCarl Hetherington <cth@carlh.net>2022-07-06 02:11:41 +0200
commit71664a46891ab84cb0c24b54edf6b0766890b400 (patch)
tree44d26e1cbd3a39c3312904508433add853e029f8 /src/ssa_reader.cc
parenteba39d94cb28a3f80e850cdf75f475b23d330eb9 (diff)
Assume 1px == 1pt with SSA.font-sizing
Diffstat (limited to 'src/ssa_reader.cc')
-rw-r--r--src/ssa_reader.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ssa_reader.cc b/src/ssa_reader.cc
index 03d20dd..eb1e34e 100644
--- a/src/ssa_reader.cc
+++ b/src/ssa_reader.cc
@@ -243,7 +243,7 @@ SSAReader::parse_style (RawSubtitle& sub, string style, int play_res_x, int play
sub.vertical_position.proportional = raw_convert<float>(bits[2]) / play_res_y;
} else if (boost::starts_with(style, "\\fs")) {
SUB_ASSERT (style.length() > 3);
- sub.font_size.set_points (raw_convert<int>(style.substr(3)));
+ sub.font_size.set_proportional(raw_convert<float>(style.substr(3)) / play_res_y);
} else if (boost::starts_with(style, "\\c")) {
/* \c&Hbbggrr& */
if (style.length() <= 2) {
@@ -285,8 +285,8 @@ SSAReader::parse_line (RawSubtitle base, string line, int play_res_x, int play_r
in pixels and in that case we must know how big the subtitle
lines are to work out the position on screen.
*/
- if (!current.font_size.points()) {
- current.font_size.set_points (72);
+ if (!current.font_size.proportional()) {
+ current.font_size.set_proportional(72.0 / play_res_y);
}
/* Count the number of line breaks */
@@ -299,8 +299,8 @@ SSAReader::parse_line (RawSubtitle base, string line, int play_res_x, int play_r
}
}
- /* Imagine that the screen is 792 points (i.e. 11 inches) high (as with DCP) */
- double const line_size = current.font_size.proportional(792) * 1.2;
+ /* Aegisub docs seem to suggest that 1 point == 1 pixel */
+ double const line_size = current.font_size.proportional(play_res_y) * 1.2;
for (size_t i = 0; i < line.length(); ++i) {
char const c = line[i];
@@ -479,7 +479,7 @@ SSAReader::read (function<optional<string> ()> get_line)
SUB_ASSERT (styles.find(event[i]) != styles.end());
Style style = styles[event[i]];
sub.font = style.font_name;
- sub.font_size = FontSize::from_points (style.font_size);
+ sub.font_size = FontSize::from_proportional(static_cast<float>(style.font_size) / play_res_y);
sub.colour = style.primary_colour;
sub.effect_colour = style.back_colour;
sub.bold = style.bold;