summaryrefslogtreecommitdiff
path: root/src/lib/render_text.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-10-16 22:17:24 +0200
committerCarl Hetherington <cth@carlh.net>2021-10-17 15:35:08 +0200
commit2b793cd6eac56b06a2d694591cddecb3ae2b099d (patch)
tree68fc8ec56a7f0cc3c572d0342a8feb1fb900da35 /src/lib/render_text.cc
parent487cb0c6d7ebe705f015176b0d7e98e23c8c5d28 (diff)
Move some functions up the file so we can use them.
Diffstat (limited to 'src/lib/render_text.cc')
-rw-r--r--src/lib/render_text.cc54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/lib/render_text.cc b/src/lib/render_text.cc
index 94b412856..989bc7dfe 100644
--- a/src/lib/render_text.cc
+++ b/src/lib/render_text.cc
@@ -55,6 +55,33 @@ static FcConfig* fc_config = nullptr;
static list<pair<boost::filesystem::path, string>> fc_config_fonts;
+/** Create a Pango layout using a dummy context which we can use to calculate the size
+ * of the text we will render. Then we can transfer the layout over to the real context
+ * for the actual render.
+ */
+static Glib::RefPtr<Pango::Layout>
+create_layout()
+{
+ auto c_font_map = pango_cairo_font_map_new ();
+ DCPOMATIC_ASSERT (c_font_map);
+ auto font_map = Glib::wrap (c_font_map);
+ auto c_context = pango_font_map_create_context (c_font_map);
+ DCPOMATIC_ASSERT (c_context);
+ auto context = Glib::wrap (c_context);
+ return Pango::Layout::create (context);
+}
+
+
+static void
+setup_layout (Glib::RefPtr<Pango::Layout> layout, string font_name, string markup)
+{
+ layout->set_alignment (Pango::ALIGN_LEFT);
+ Pango::FontDescription font (font_name);
+ layout->set_font_description (font);
+ layout->set_markup (markup);
+}
+
+
string
marked_up (list<StringText> subtitles, int target_height, float fade_factor)
{
@@ -259,33 +286,6 @@ y_position (StringText const& first, int target_height, int layout_height)
}
-static void
-setup_layout (Glib::RefPtr<Pango::Layout> layout, string font_name, string markup)
-{
- layout->set_alignment (Pango::ALIGN_LEFT);
- Pango::FontDescription font (font_name);
- layout->set_font_description (font);
- layout->set_markup (markup);
-}
-
-
-/** Create a Pango layout using a dummy context which we can use to calculate the size
- * of the text we will render. Then we can transfer the layout over to the real context
- * for the actual render.
- */
-static Glib::RefPtr<Pango::Layout>
-create_layout()
-{
- auto c_font_map = pango_cairo_font_map_new ();
- DCPOMATIC_ASSERT (c_font_map);
- auto font_map = Glib::wrap (c_font_map);
- auto c_context = pango_font_map_create_context (c_font_map);
- DCPOMATIC_ASSERT (c_context);
- auto context = Glib::wrap (c_context);
- return Pango::Layout::create (context);
-}
-
-
/** @param subtitles A list of subtitles that are all on the same line,
* at the same time and with the same fade in/out.
*/