SubtitleString (
effective_font.id,
effective_font.italic.get_value_or (false),
+ effective_font.bold.get_value_or (false),
effective_font.colour.get_value_or (dcp::Colour (255, 255, 255)),
effective_font.size,
effective_font.aspect_adjust.get_value_or (1.0),
string const xmlns = standard == SMPTE ? "dcst" : "";
- /* XXX: script, underlined, weight not supported */
+ /* XXX: script, underlined not supported */
optional<string> font;
bool italic = false;
+ bool bold = false;
Colour colour;
int size = 0;
float aspect_adjust = 1.0;
bool const font_changed =
font != i.font() ||
italic != i.italic() ||
+ bold != i.bold() ||
colour != i.colour() ||
size != i.size() ||
fabs (aspect_adjust - i.aspect_adjust()) > ASPECT_ADJUST_EPSILON ||
if (font_changed) {
font = i.font ();
italic = i.italic ();
+ bold = i.bold ();
colour = i.colour ();
size = i.size ();
aspect_adjust = i.aspect_adjust ();
} else {
font_element->set_attribute ("Underlined", "no");
}
- font_element->set_attribute ("Weight", "normal");
+ font_element->set_attribute ("Weight", bold ? "bold" : "normal");
}
if (!subtitle_element || font_changed ||
/*
- Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
SubtitleString::SubtitleString (
optional<string> font,
bool italic,
+ bool bold,
Colour colour,
int size,
float aspect_adjust,
)
: _font (font)
, _italic (italic)
+ , _bold (bold)
, _colour (colour)
, _size (size)
, _aspect_adjust (aspect_adjust)
return (
a.font() == b.font() &&
a.italic() == b.italic() &&
+ a.bold() == b.bold() &&
a.colour() == b.colour() &&
a.size() == b.size() &&
fabs (a.aspect_adjust() - b.aspect_adjust()) < ASPECT_ADJUST_EPSILON &&
<< "font " << sub.font().get_value_or ("[default]") << ", ";
if (sub.italic()) {
- s << "italic";
+ s << "italic, ";
} else {
- s << "non-italic";
+ s << "non-italic, ";
}
- s << ", size " << sub.size() << ", aspect " << sub.aspect_adjust() << ", colour " << sub.colour()
+ if (sub.bold()) {
+ s << "bold, ";
+ } else {
+ s << "normal, ";
+ }
+
+ s << "size " << sub.size() << ", aspect " << sub.aspect_adjust() << ", colour " << sub.colour()
<< ", vpos " << sub.v_position() << ", valign " << ((int) sub.v_align())
<< ", hpos " << sub.h_position() << ", halign " << ((int) sub.h_align())
<< ", effect " << ((int) sub.effect()) << ", effect colour " << sub.effect_colour();
BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
string ("theFontId"),
false,
+ false,
dcp::Colour (255, 255, 255),
39,
1.0,
BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
string ("theFontId"),
true,
+ false,
dcp::Colour (255, 255, 255),
39,
1.0,
BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
string ("theFontId"),
false,
+ false,
dcp::Colour (255, 255, 255),
39,
1.0,
BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
string ("theFontId"),
false,
+ false,
dcp::Colour (255, 255, 255),
39,
1.0,
BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
string ("theFontId"),
false,
+ false,
dcp::Colour (255, 255, 255),
39,
1.0,
BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
string ("theFont"),
true,
+ false,
dcp::Colour (255, 255, 255),
42,
1.0,
BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
string ("theFont"),
true,
+ false,
dcp::Colour (255, 255, 255),
42,
1.0,
BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
string ("theFont"),
true,
+ false,
dcp::Colour (255, 255, 255),
42,
1.0,
BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
string ("theFont"),
true,
+ false,
dcp::Colour (255, 255, 255),
42,
1.0,
BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
string ("theFont"),
true,
+ false,
dcp::Colour (255, 255, 255),
42,
1.0,
BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
string ("theFont"),
true,
+ false,
dcp::Colour (255, 255, 255),
42,
1.0,
BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
string ("theFont"),
true,
+ false,
dcp::Colour (255, 255, 255),
42,
1.0,
BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
string ("theFont"),
true,
+ false,
dcp::Colour (255, 255, 255),
42,
1.0,
BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
string ("theFont"),
true,
+ false,
dcp::Colour (255, 255, 255),
42,
1.0,
BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
string ("theFont"),
true,
+ false,
dcp::Colour (255, 255, 255),
42,
1.0,
BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
string ("theFont"),
false,
+ false,
dcp::Colour (255, 255, 255),
42,
1.0,
BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
string ("theFont"),
false,
+ false,
dcp::Colour (255, 255, 255),
42,
1.0,
BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
string ("theFont"),
false,
+ false,
dcp::Colour (255, 255, 255),
42,
1.0,
BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
string ("theFont"),
false,
+ false,
dcp::Colour (255, 255, 255),
42,
1.0,
BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
string ("theFont"),
false,
+ false,
dcp::Colour (255, 255, 255),
42,
1.0,
BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
string ("theFont"),
false,
+ false,
dcp::Colour (255, 255, 255),
42,
1.0,
BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
string ("theFont"),
true,
+ false,
dcp::Colour (255, 255, 255),
42,
1.0,
BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
string ("theFont"),
true,
+ false,
dcp::Colour (255, 255, 255),
42,
1.0,