summaryrefslogtreecommitdiff
path: root/editor/import/resource_importer_dynamicfont.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-02-15 13:58:38 +0100
committerGitHub <noreply@github.com>2022-02-15 13:58:38 +0100
commit760a95e86a9d213775a6e1b87e3ed30088b0676e (patch)
tree0f96956d270ccd6ef4f73da2dfb865dbf3cd408d /editor/import/resource_importer_dynamicfont.cpp
parenta6aba6919fcfdf81eb5f9c87d62274abf8f1ddb2 (diff)
parent29199579f780f4f66350e1962926c08b2ddcf65b (diff)
Merge pull request #57877 from bruvzg/subpixel_gl_pos
Diffstat (limited to 'editor/import/resource_importer_dynamicfont.cpp')
-rw-r--r--editor/import/resource_importer_dynamicfont.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/editor/import/resource_importer_dynamicfont.cpp b/editor/import/resource_importer_dynamicfont.cpp
index 11f563a982..42be76ba12 100644
--- a/editor/import/resource_importer_dynamicfont.cpp
+++ b/editor/import/resource_importer_dynamicfont.cpp
@@ -76,6 +76,9 @@ bool ResourceImporterDynamicFont::get_option_visibility(const String &p_path, co
if (p_option == "oversampling" && bool(p_options["multichannel_signed_distance_field"])) {
return false;
}
+ if (p_option == "subpixel_positioning" && bool(p_options["multichannel_signed_distance_field"])) {
+ return false;
+ }
return true;
}
@@ -104,6 +107,7 @@ void ResourceImporterDynamicFont::get_import_options(const String &p_path, List<
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "force_autohinter"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "hinting", PROPERTY_HINT_ENUM, "None,Light,Normal"), 1));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "subpixel_positioning", PROPERTY_HINT_ENUM, "Disabled,Auto,One half of a pixel,One quarter of a pixel"), 1));
r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "oversampling", PROPERTY_HINT_RANGE, "0,10,0.1"), 0.0));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "compress"), true));
@@ -179,6 +183,7 @@ Error ResourceImporterDynamicFont::import(const String &p_source_file, const Str
bool autohinter = p_options["force_autohinter"];
int hinting = p_options["hinting"];
+ int subpixel_positioning = p_options["subpixel_positioning"];
real_t oversampling = p_options["oversampling"];
// Load base font data.
@@ -195,6 +200,7 @@ Error ResourceImporterDynamicFont::import(const String &p_source_file, const Str
font->set_opentype_feature_overrides(ot_ov);
font->set_fixed_size(0);
font->set_force_autohinter(autohinter);
+ font->set_subpixel_positioning((TextServer::SubpixelPositioning)subpixel_positioning);
font->set_hinting((TextServer::Hinting)hinting);
font->set_oversampling(oversampling);