You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +00:00
[Font] Add option to disable embedded bitmaps loading.
This commit is contained in:
@@ -636,7 +636,7 @@ _FORCE_INLINE_ bool TextServerFallback::_ensure_glyph(FontFallback *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;
|
||||
@@ -1170,6 +1170,25 @@ TextServer::FontAntialiasing TextServerFallback::_font_get_antialiasing(const RI
|
||||
return fd->antialiasing;
|
||||
}
|
||||
|
||||
void TextServerFallback::_font_set_disable_embedded_bitmaps(const RID &p_font_rid, bool p_disable_embedded_bitmaps) {
|
||||
FontFallback *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 TextServerFallback::_font_get_disable_embedded_bitmaps(const RID &p_font_rid) const {
|
||||
FontFallback *fd = _get_font_data(p_font_rid);
|
||||
ERR_FAIL_NULL_V(fd, false);
|
||||
|
||||
MutexLock lock(fd->mutex);
|
||||
return fd->disable_embedded_bitmaps;
|
||||
}
|
||||
|
||||
void TextServerFallback::_font_set_generate_mipmaps(const RID &p_font_rid, bool p_generate_mipmaps) {
|
||||
FontFallback *fd = _get_font_data(p_font_rid);
|
||||
ERR_FAIL_NULL(fd);
|
||||
@@ -3805,6 +3824,7 @@ RID TextServerFallback::_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