}
s.set_in (dcp::Time(from.seconds(), 1000));
- ps.text.push_back (SubtitleString (s, piece->content->subtitle->outline_width()));
+ ps.text.push_back (PlainText (s, piece->content->subtitle->outline_width()));
ps.add_fonts (piece->content->subtitle->fonts ());
}
using boost::shared_ptr;
void
-PlayerSubtitles::add_fonts (list<shared_ptr<Font> > fonts_)
+PlayerText::add_fonts (list<shared_ptr<Font> > fonts_)
{
BOOST_FOREACH (shared_ptr<Font> i, fonts_) {
bool got = false;
}
void
-ReelWriter::write (PlayerSubtitles subs, DCPTimePeriod period)
+ReelWriter::write (PlayerText subs, DCPTimePeriod period)
{
if (!_subtitle_asset) {
string lang = _film->subtitle_language ();
}
}
- BOOST_FOREACH (SubtitleString i, subs.text) {
+ BOOST_FOREACH (PlainText i, subs.text) {
/* XXX: couldn't / shouldn't we use period here rather than getting time from the subtitle? */
i.set_in (i.in() - dcp::Time (_period.from.seconds(), i.in().tcr));
i.set_out (i.out() - dcp::Time (_period.from.seconds(), i.out().tcr));
#include "types.h"
#include "dcpomatic_time.h"
#include "referenced_reel_asset.h"
-#include "player_subtitles.h"
+#include "player_text.h"
#include <dcp/picture_asset_writer.h>
#include <boost/shared_ptr.hpp>
void fake_write (Frame frame, Eyes eyes, int size);
void repeat_write (Frame frame, Eyes eyes);
void write (boost::shared_ptr<const AudioBuffers> audio);
- void write (PlayerSubtitles subs, DCPTimePeriod period);
+ void write (PlayerText subs, DCPTimePeriod period);
void finish ();
boost::shared_ptr<dcp::Reel> create_reel (std::list<ReferencedReelAsset> const & refs, std::list<boost::shared_ptr<Font> > const & fonts);
static list<pair<FontFiles, string> > fc_config_fonts;
string
-marked_up (list<SubtitleString> subtitles, int target_height, float fade_factor)
+marked_up (list<PlainText> subtitles, int target_height, float fade_factor)
{
string out;
- BOOST_FOREACH (SubtitleString const & i, subtitles) {
+ BOOST_FOREACH (PlainText const & i, subtitles) {
out += "<span ";
if (i.italic()) {
out += "style=\"italic\" ";
* at the same time and with the same fade in/out.
*/
static PositionImage
-render_line (list<SubtitleString> subtitles, list<shared_ptr<Font> > fonts, dcp::Size target, DCPTime time, int frame_rate)
+render_line (list<PlainText> subtitles, list<shared_ptr<Font> > fonts, dcp::Size target, DCPTime time, int frame_rate)
{
/* XXX: this method can only handle italic / bold changes mid-line,
nothing else yet.
* @param frame_rate DCP frame rate.
*/
list<PositionImage>
-render_text (list<SubtitleString> subtitles, list<shared_ptr<Font> > fonts, dcp::Size target, DCPTime time, int frame_rate)
+render_text (list<PlainText> subtitles, list<shared_ptr<Font> > fonts, dcp::Size target, DCPTime time, int frame_rate)
{
- list<SubtitleString> pending;
+ list<PlainText> pending;
list<PositionImage> images;
- BOOST_FOREACH (SubtitleString const & i, subtitles) {
+ BOOST_FOREACH (PlainText const & i, subtitles) {
if (!pending.empty() && fabs (i.v_position() - pending.back().v_position()) > 1e-4) {
images.push_back (render_line (pending, fonts, target, time, frame_rate));
pending.clear ();
class Font;
-std::string marked_up (std::list<SubtitleString> subtitles, int target_height, float fade_factor);
+std::string marked_up (std::list<PlainText> subtitles, int target_height, float fade_factor);
std::list<PositionImage> render_text (
- std::list<SubtitleString>, std::list<boost::shared_ptr<Font> > fonts, dcp::Size, DCPTime, int
+ std::list<PlainText>, std::list<boost::shared_ptr<Font> > fonts, dcp::Size, DCPTime, int
);
#include <boost/test/unit_test.hpp>
static void
-add (std::list<SubtitleString>& s, std::string text, bool italic, bool bold, bool underline)
+add (std::list<PlainText>& s, std::string text, bool italic, bool bold, bool underline)
{
s.push_back (
- SubtitleString (
+ PlainText (
dcp::SubtitleString (
boost::optional<std::string> (),
italic,
/** Test marked_up() in render_text.cc */
BOOST_AUTO_TEST_CASE (render_markup_test1)
{
- std::list<SubtitleString> s;
+ std::list<PlainText> s;
add (s, "Hello", false, false, false);
BOOST_CHECK_EQUAL (marked_up (s, 1024, 1), "<span size=\"41472\" alpha=\"65535\" color=\"#FFFFFF\">Hello</span>");
}
/** Test marked_up() in render_text.cc */
BOOST_AUTO_TEST_CASE (render_markup_test2)
{
- std::list<SubtitleString> s;
+ std::list<PlainText> s;
add (s, "Hello", false, true, false);
BOOST_CHECK_EQUAL (marked_up (s, 1024, 1), "<span weight=\"bold\" size=\"41472\" alpha=\"65535\" color=\"#FFFFFF\">Hello</span>");
}
/** Test marked_up() in render_text.cc */
BOOST_AUTO_TEST_CASE (render_markup_test3)
{
- std::list<SubtitleString> s;
+ std::list<PlainText> s;
add (s, "Hello", true, true, false);
BOOST_CHECK_EQUAL (marked_up (s, 1024, 1), "<span style=\"italic\" weight=\"bold\" size=\"41472\" alpha=\"65535\" color=\"#FFFFFF\">Hello</span>");
}
/** Test marked_up() in render_text.cc */
BOOST_AUTO_TEST_CASE (render_markup_test4)
{
- std::list<SubtitleString> s;
+ std::list<PlainText> s;
add (s, "Hello", true, true, true);
BOOST_CHECK_EQUAL (marked_up (s, 1024, 1), "<span style=\"italic\" weight=\"bold\" underline=\"single\" size=\"41472\" alpha=\"65535\" color=\"#FFFFFF\">Hello</span>");
}
/** Test marked_up() in render_text.cc */
BOOST_AUTO_TEST_CASE (render_markup_test5)
{
- std::list<SubtitleString> s;
+ std::list<PlainText> s;
add (s, "Hello", false, true, false);
add (s, " world.", false, false, false);
BOOST_CHECK_EQUAL (marked_up (s, 1024, 1), "<span weight=\"bold\" size=\"41472\" alpha=\"65535\" color=\"#FFFFFF\">Hello</span><span size=\"41472\" alpha=\"65535\" color=\"#FFFFFF\"> world.</span>");
/** Test marked_up() in render_text.cc */
BOOST_AUTO_TEST_CASE (render_markup_test6)
{
- std::list<SubtitleString> s;
+ std::list<PlainText> s;
add (s, "Hello", true, false, false);
add (s, " world ", false, false, false);
add (s, "we are bold.", false, true, false);