Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the default font of subtitle grid; use system UI font when config font is empty #139

Open
wants to merge 1 commit into
base: feature
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/base_grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ void BaseGrid::OnHighlightVisibleChange(agi::OptionValue const& opt) {
}

void BaseGrid::UpdateStyle() {
font = *wxNORMAL_FONT;
wxString fontname = FontFace("Subtitle/Grid");
if (fontname.empty()) fontname = "Tahoma";
font.SetFaceName(fontname);
if (!fontname.empty()) font.SetFaceName(fontname);
font.SetPointSize(OPT_GET("Subtitle/Grid/Font Size")->GetInt());
font.SetWeight(wxFONTWEIGHT_NORMAL);

Expand Down
4 changes: 2 additions & 2 deletions src/libresrc/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,8 @@
{"bool" : true}
],
"Focus Allow" : true,
"Font Face" : "Tahoma",
"Font Size" : 8,
"Font Face" : "",
"Font Size" : 10,
"Hide Overrides" : 1,
"Hide Overrides Char" : "☀",
"Highlight Subtitles in Frame" : true
Expand Down
6 changes: 4 additions & 2 deletions src/preferences_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ static void browse_button(wxTextCtrl *ctrl) {
}

static void font_button(Preferences *parent, wxTextCtrl *name, wxSpinCtrl *size) {
wxFont font;
font.SetFaceName(name->GetValue());
wxFont font = *wxNORMAL_FONT;
wxString fontname = name->GetValue();
if (!fontname.empty()) font.SetFaceName(fontname);
font.SetPointSize(size->GetValue());
font = wxGetFontFromUser(parent, font);
if (font.IsOk()) {
Expand Down Expand Up @@ -251,6 +252,7 @@ void OptionPage::OptionFont(wxSizer *sizer, std::string opt_prefix) {
auto font_name = new wxTextCtrl(this, -1, to_wx(face_opt->GetString()));
font_name->SetMinSize(wxSize(160, -1));
font_name->Bind(wxEVT_TEXT, StringUpdater(face_opt->GetName().c_str(), parent));
font_name->SetHint(wxNORMAL_FONT->GetFaceName());

auto font_size = new wxSpinCtrl(this, -1, std::to_wstring((int)size_opt->GetInt()), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 3, 42, size_opt->GetInt());
font_size->Bind(wxEVT_SPINCTRL, IntUpdater(size_opt->GetName().c_str(), parent));
Expand Down
2 changes: 1 addition & 1 deletion src/subs_edit_ctrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ void SubsTextEditCtrl::SetSyntaxStyle(int id, wxFont &font, std::string const& n
}

void SubsTextEditCtrl::SetStyles() {
wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
wxFont font = *wxNORMAL_FONT;
font.SetEncoding(wxFONTENCODING_DEFAULT); // this solves problems with some fonts not working properly
wxString fontname = FontFace("Subtitle/Edit Box");
if (!fontname.empty()) font.SetFaceName(fontname);
Expand Down
Loading