diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-04-08 01:04:37 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-04-09 17:23:20 +0200 |
| commit | 1c73379ed8483dcf71c5ccfc459c2c22516a9aef (patch) | |
| tree | 2da4861633a408e4a1fef78cc5cb9f608794bd1d /src/lib/render_text.cc | |
| parent | 46193d2898321c70626a80785055884396f3e09d (diff) | |
Fix subtitle font handling with in-memory fonts from SMPTE (#2509).v2.16.52
Previously we would fail to make a font available if it came from
a SMPTE MXF. In that case we have a memory buffer containing the
TTF/OTF file but no file; here we add a hack/workaround so that
in-memory font files can be used by FontConfig.
Diffstat (limited to 'src/lib/render_text.cc')
| -rw-r--r-- | src/lib/render_text.cc | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/src/lib/render_text.cc b/src/lib/render_text.cc index 33e0c6a89..1a0672262 100644 --- a/src/lib/render_text.cc +++ b/src/lib/render_text.cc @@ -171,19 +171,6 @@ create_surface (shared_ptr<Image> image) } -static string -setup_font(shared_ptr<const dcpomatic::Font> font) -{ - auto font_file = default_font_file (); - - if (font && font->file()) { - font_file = *font->file(); - } - - return FontConfig::instance()->make_font_available(font_file); -} - - static float calculate_fade_factor (StringText const& first, DCPTime time, int frame_rate) { @@ -314,7 +301,7 @@ setup_layout(list<StringText> subtitles, dcp::Size target, DCPTime time, int fra DCPOMATIC_ASSERT(!subtitles.empty()); auto const& first = subtitles.front(); - auto const font_name = setup_font(first.font); + auto const font_name = FontConfig::instance()->make_font_available(first.font); auto const fade_factor = calculate_fade_factor(first, time, frame_rate); auto const markup = marked_up(subtitles, target.height, fade_factor, font_name); auto layout = create_layout(font_name, markup); @@ -492,7 +479,7 @@ FontMetrics::get(StringText const& subtitle) return iter; } - auto const font_name = setup_font(subtitle.font); + auto const font_name = FontConfig::instance()->make_font_available(subtitle.font); auto copy = subtitle; copy.set_text("Qypjg"); auto layout = create_layout(font_name, marked_up({copy}, _target_height, 1, font_name)); |
