Merge pull request #61205 from Calinou/default-font-tweak-fake-bold-italic

Tweak the default font's fake italic to better match Open Sans Italic
This commit is contained in:
Rémi Verschelde 2022-05-20 07:56:12 +02:00 committed by GitHub
commit 277ea1950a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1069,6 +1069,7 @@ void make_default_theme(float p_scale, Ref<Font> p_font, TextServer::SubpixelPos
bold_font.instantiate();
for (int i = 0; i < default_font->get_data_count(); i++) {
Ref<FontData> data = default_font->get_data(i)->duplicate();
// Try to match OpenSans ExtraBold.
data->set_embolden(1.2);
bold_font->add_data(data);
}
@ -1076,15 +1077,17 @@ void make_default_theme(float p_scale, Ref<Font> p_font, TextServer::SubpixelPos
bold_italics_font.instantiate();
for (int i = 0; i < default_font->get_data_count(); i++) {
Ref<FontData> data = default_font->get_data(i)->duplicate();
// Try to match OpenSans ExtraBold Italic.
data->set_embolden(1.2);
data->set_transform(Transform2D(1.0, 0.4, 0.0, 1.0, 0.0, 0.0));
data->set_transform(Transform2D(1.0, 0.2, 0.0, 1.0, 0.0, 0.0));
bold_italics_font->add_data(data);
}
italics_font.instantiate();
for (int i = 0; i < default_font->get_data_count(); i++) {
Ref<FontData> data = default_font->get_data(i)->duplicate();
data->set_transform(Transform2D(1.0, 0.4, 0.0, 1.0, 0.0, 0.0));
// Try to match OpenSans Italic.
data->set_transform(Transform2D(1.0, 0.2, 0.0, 1.0, 0.0, 0.0));
italics_font->add_data(data);
}
}