View Bug Details

IDProjectCategoryView StatusLast Update
0002509DCP-o-maticBugspublic2023-09-01 21:53
Reportercarl Assigned Tocarl  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Target Version2.16.x 
Summary0002509: Player does not use font specified in DCP
Description

always the default.

TagsNo tags attached.
Branch2509-fonts
Estimated weeks required
Estimated work requiredUndecided

Activities

carl

2023-04-07 23:11

administrator   ~0005619

Looks like because setup_font in render_text.cc does not do anything if the font is in a memory buffer but not in a real file (e.g. for SMPTE subs).

carl

2023-04-07 23:11

administrator   ~0005620

https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/12 asks for a FontConfig API call to do what we want to do here.

carl

2023-04-07 23:22

administrator   ~0005621

index 231a93bd0..3f06625fe 100644
--- a/src/lib/dcp_content.cc
+++ b/src/lib/dcp_content.cc
@@ -263,6 +263,7 @@ DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
    for (int i = 0; i < examiner->text_count(TextType::OPEN_SUBTITLE); ++i) {
        auto c = make_shared<TextContent>(this, TextType::OPEN_SUBTITLE, TextType::OPEN_SUBTITLE);
        c->set_language (examiner->open_subtitle_language());
+       std::cout << "add " << examiner->fonts().size() << " from examiner.\n";
        add_fonts_from_examiner(c, examiner->fonts());
        new_text.push_back (c);
    }
@@ -827,6 +828,7 @@ add_fonts_from_examiner(shared_ptr<TextContent> text, vector<vector<shared_ptr<F
             */
            font->set_id(id_for_font_in_reel(font->id(), reel_number));
            text->add_font(font);
+           std::cout << "adding font " << font->id() << " " << static_cast<bool>(font->data()) << " " << font->data()->size() << "\n";
        }
        ++reel_number;
    }
diff --git a/src/lib/render_text.cc b/src/lib/render_text.cc
index 33e0c6a89..dca351ab7 100644
--- a/src/lib/render_text.cc
+++ b/src/lib/render_text.cc
@@ -176,6 +176,15 @@ setup_font(shared_ptr<const dcpomatic::Font> font)
 {
    auto font_file = default_font_file ();

+   std::cout << "setup " << font->id() << "\n";
+
+   if (font) {
+       if (!font->file() && font->data()) {
+           font->data()->write("/tmp/woo.ttf");
+           std::const_pointer_cast<dcpomatic::Font>(font)->set_file("/tmp/woo.ttf");
+       }
+   }
+
    if (font && font->file()) {
        font_file = *font->file();
    }

seems to fix it

carl

2023-04-08 00:06

administrator   ~0005624

@carl tests running

carl

2023-04-09 16:32

administrator   ~0005629

1c73379ed8483dcf71c5ccfc459c2c22516a9aef

Bug History

Date Modified Username Field Change
2023-04-07 22:24 carl New Bug
2023-04-07 22:25 carl Assigned To => carl
2023-04-07 22:25 carl Status new => acknowledged
2023-04-07 22:56 carl Status acknowledged => confirmed
2023-04-07 22:56 carl Reproducibility have not tried => always
2023-04-07 22:56 carl Estimated work required => Undecided
2023-04-07 23:11 carl Note Added: 0005619
2023-04-07 23:11 carl Note Added: 0005620
2023-04-07 23:22 carl Note Added: 0005621
2023-04-08 00:04 carl Status confirmed => in progress
2023-04-08 00:04 carl Branch => 2509-fonts
2023-04-08 00:06 carl Note Added: 0005624
2023-04-09 16:32 carl Status in progress => resolved
2023-04-09 16:32 carl Resolution open => fixed
2023-04-09 16:32 carl Note Added: 0005629
2023-09-01 21:53 carl Status resolved => closed