2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
4 * This file is part of CasparCG (www.casparcg.com).
6 * CasparCG is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * CasparCG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
19 * Author: Niklas P Andersson, niklas.p.andersson@svt.se
24 #include "../frame_producer.h"
26 #include <common/memory.h>
28 #include <boost/property_tree/ptree_fwd.hpp>
32 #include "utils/color.h"
33 #include "utils/string_metrics.h"
34 #include "utils/text_info.h"
36 namespace caspar { namespace core {
42 class text_producer : public frame_producer_base
45 text_producer(const spl::shared_ptr<frame_factory>& frame_factory, int x, int y, const std::wstring& str, text::text_info& text_info, long parent_width, long parent_height, bool standalone);
46 static spl::shared_ptr<text_producer> create(const spl::shared_ptr<class frame_factory>& frame_factory, int x, int y, const std::wstring& str, text::text_info& text_info, long parent_width, long parent_height, bool standalone = false);
48 draw_frame receive_impl() override;
49 boost::unique_future<std::wstring> call(const std::vector<std::wstring>& param) override;
50 variable& get_variable(const std::wstring& name) override;
51 const std::vector<std::wstring>& get_variables() const override;
53 text::string_metrics measure_string(const std::wstring& str);
55 constraints& pixel_constraints() override;
56 std::wstring print() const override;
57 std::wstring name() const override;
58 boost::property_tree::wptree info() const override;
59 monitor::source& monitor_output();
61 binding<std::wstring>& text();
62 binding<double>& tracking();
63 const binding<double>& current_bearing_y() const;
64 const binding<double>& current_protrude_under_y() const;
67 spl::unique_ptr<impl> impl_;
70 spl::shared_ptr<frame_producer> create_text_producer(const spl::shared_ptr<class frame_factory>& frame_factory, const video_format_desc& format_desc, const std::vector<std::wstring>& params);