You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-12 13:20:55 +00:00
[Font] Add option to disable embedded bitmaps loading.
This commit is contained in:
@@ -1201,7 +1201,7 @@ _FORCE_INLINE_ bool TextServerAdvanced::_ensure_glyph(FontAdvanced *p_font_data,
|
||||
if (p_font_data->force_autohinter) {
|
||||
flags |= FT_LOAD_FORCE_AUTOHINT;
|
||||
}
|
||||
if (outline) {
|
||||
if (outline || (p_font_data->disable_embedded_bitmaps && !FT_HAS_COLOR(fd->face))) {
|
||||
flags |= FT_LOAD_NO_BITMAP;
|
||||
} else if (FT_HAS_COLOR(fd->face)) {
|
||||
flags |= FT_LOAD_COLOR;
|
||||
@@ -2177,6 +2177,25 @@ TextServer::FontAntialiasing TextServerAdvanced::_font_get_antialiasing(const RI
|
||||
return fd->antialiasing;
|
||||
}
|
||||
|
||||
void TextServerAdvanced::_font_set_disable_embedded_bitmaps(const RID &p_font_rid, bool p_disable_embedded_bitmaps) {
|
||||
FontAdvanced *fd = _get_font_data(p_font_rid);
|
||||
ERR_FAIL_NULL(fd);
|
||||
|
||||
MutexLock lock(fd->mutex);
|
||||
if (fd->disable_embedded_bitmaps != p_disable_embedded_bitmaps) {
|
||||
_font_clear_cache(fd);
|
||||
fd->disable_embedded_bitmaps = p_disable_embedded_bitmaps;
|
||||
}
|
||||
}
|
||||
|
||||
bool TextServerAdvanced::_font_get_disable_embedded_bitmaps(const RID &p_font_rid) const {
|
||||
FontAdvanced *fd = _get_font_data(p_font_rid);
|
||||
ERR_FAIL_NULL_V(fd, false);
|
||||
|
||||
MutexLock lock(fd->mutex);
|
||||
return fd->disable_embedded_bitmaps;
|
||||
}
|
||||
|
||||
void TextServerAdvanced::_font_set_generate_mipmaps(const RID &p_font_rid, bool p_generate_mipmaps) {
|
||||
FontAdvanced *fd = _get_font_data(p_font_rid);
|
||||
ERR_FAIL_NULL(fd);
|
||||
@@ -4997,6 +5016,7 @@ RID TextServerAdvanced::_find_sys_font_for_text(const RID &p_fdef, const String
|
||||
}
|
||||
|
||||
_font_set_antialiasing(sysf.rid, key.antialiasing);
|
||||
_font_set_disable_embedded_bitmaps(sysf.rid, key.disable_embedded_bitmaps);
|
||||
_font_set_generate_mipmaps(sysf.rid, key.mipmaps);
|
||||
_font_set_multichannel_signed_distance_field(sysf.rid, key.msdf);
|
||||
_font_set_msdf_pixel_range(sysf.rid, key.msdf_range);
|
||||
|
||||
Reference in New Issue
Block a user