]> git.sesse.net Git - casparcg/blob - core/producer/text/text_producer.h
85eeb876910ff91fdea58253b409240960b794ca
[casparcg] / core / producer / text / text_producer.h
1 /*
2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
3 *
4 * This file is part of CasparCG (www.casparcg.com).
5 *
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.
10 *
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.
15 *
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/>.
18 *
19 * Author: Niklas P Andersson, niklas.p.andersson@svt.se
20 */
21
22 #pragma once
23
24 #include "../frame_producer.h"
25 #include "../../fwd.h"
26
27 #include <common/memory.h>
28
29 #include <boost/property_tree/ptree_fwd.hpp>
30 #include <string>
31 #include <vector>
32 #include <utility>
33
34 #include "utils/color.h"
35 #include "utils/string_metrics.h"
36 #include "utils/text_info.h"
37
38 namespace caspar { namespace core {
39         namespace text
40         {
41                 void init(module_dependencies dependencies);
42                 std::vector<std::pair<std::wstring, std::wstring>> list_fonts();
43         }
44
45 class text_producer : public frame_producer_base
46 {
47 public:
48         text_producer(const spl::shared_ptr<frame_factory>& frame_factory, int x, int y, const std::wstring& str,
49                 text::text_info& text_info, long parent_width, long parent_height, bool standalone);
50         static spl::shared_ptr<text_producer> create(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 = false);
51
52         draw_frame receive_impl() override;
53         std::future<std::wstring> call(const std::vector<std::wstring>& param) override;
54         variable& get_variable(const std::wstring& name) override;
55         const std::vector<std::wstring>& get_variables() const override;
56
57         constraints& pixel_constraints() override;
58         std::wstring print() const override;
59         std::wstring name() const override;
60         boost::property_tree::wptree info() const override;
61         monitor::subject& monitor_output();
62
63         binding<std::wstring>& text();
64         binding<double>& tracking();
65         const binding<double>& current_bearing_y() const;
66         const binding<double>& current_protrude_under_y() const;
67 private:
68         struct impl;
69         spl::unique_ptr<impl> impl_;
70 };
71
72 }}