summaryrefslogtreecommitdiff
path: root/src/wx/fonts_dialog.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-06-01 13:03:38 +0200
committerCarl Hetherington <cth@carlh.net>2022-06-07 17:01:06 +0200
commit5a820bb8fae34591be5ac6d19a73461b9dab532a (patch)
tree098e2dc959b6df0fefa62b2976976afc9f81b96b /src/wx/fonts_dialog.cc
parent9a7b67aee32a40539f29bc2d7017edd4a4f65f11 (diff)
Rearrange subtitle font management.
With this change each subtitle coming out of the player has a reference to a dcpomatic::Font that belongs to the TextContent. This hopefully solves a few problems which all basically stemmed from the fact that previously the decoders/player were deciding what the font ID in the output DCP would be - they can't do that properly.
Diffstat (limited to 'src/wx/fonts_dialog.cc')
-rw-r--r--src/wx/fonts_dialog.cc16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/wx/fonts_dialog.cc b/src/wx/fonts_dialog.cc
index e81f4a853..4ca338709 100644
--- a/src/wx/fonts_dialog.cc
+++ b/src/wx/fonts_dialog.cc
@@ -101,9 +101,11 @@ FontsDialog::setup ()
wxListItem item;
item.SetId (n);
_fonts->InsertItem (item);
- _fonts->SetItem (n, 0, std_to_wx (i->id ()));
+ auto const id = i->id().empty() ? _("Unspecified") : std_to_wx(i->id());
+ _fonts->SetItem(n, 0, id);
+ _fonts->SetItemData(n, i->id().empty());
if (i->file()) {
- _fonts->SetItem (n, 1, i->file()->leaf().string ());
+ _fonts->SetItem(n, 1, i->file()->leaf().string());
}
++n;
}
@@ -137,14 +139,8 @@ FontsDialog::edit_clicked ()
}
int const item = _fonts->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
- auto const id = wx_to_std (_fonts->GetItemText(item, 0));
- shared_ptr<Font> font;
- for (auto i: caption->fonts()) {
- if (i->id() == id) {
- font = i;
- }
- }
-
+ auto const id = _fonts->GetItemData(item) ? "" : wx_to_std(_fonts->GetItemText(item, 0));
+ auto font = caption->get_font(id);
if (!font) {
return;
}