mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 14:11:15 +00:00
Merge pull request #46045 from bruvzg/text_server_bmp_create
[TextServer] Restores bitmap font dynamic construction functions.
This commit is contained in:
commit
a527c6856b
20 changed files with 415 additions and 142 deletions
|
|
@ -148,6 +148,39 @@ RID TextServerFallback::create_font_memory(const uint8_t *p_data, size_t p_size,
|
|||
return font_owner.make_rid(fd);
|
||||
}
|
||||
|
||||
RID TextServerFallback::create_font_bitmap(float p_height, float p_ascent, int p_base_size) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
FontDataFallback *fd = memnew(BitmapFontDataFallback);
|
||||
Error err = fd->bitmap_new(p_height, p_ascent, p_base_size);
|
||||
if (err != OK) {
|
||||
memdelete(fd);
|
||||
return RID();
|
||||
}
|
||||
|
||||
return font_owner.make_rid(fd);
|
||||
}
|
||||
|
||||
void TextServerFallback::font_bitmap_add_texture(RID p_font, const Ref<Texture> &p_texture) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
FontDataFallback *fd = font_owner.getornull(p_font);
|
||||
ERR_FAIL_COND(!fd);
|
||||
fd->bitmap_add_texture(p_texture);
|
||||
}
|
||||
|
||||
void TextServerFallback::font_bitmap_add_char(RID p_font, char32_t p_char, int p_texture_idx, const Rect2 &p_rect, const Size2 &p_align, float p_advance) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
FontDataFallback *fd = font_owner.getornull(p_font);
|
||||
ERR_FAIL_COND(!fd);
|
||||
fd->bitmap_add_char(p_char, p_texture_idx, p_rect, p_align, p_advance);
|
||||
}
|
||||
|
||||
void TextServerFallback::font_bitmap_add_kerning_pair(RID p_font, char32_t p_A, char32_t p_B, int p_kerning) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
FontDataFallback *fd = font_owner.getornull(p_font);
|
||||
ERR_FAIL_COND(!fd);
|
||||
fd->bitmap_add_kerning_pair(p_A, p_B, p_kerning);
|
||||
}
|
||||
|
||||
float TextServerFallback::font_get_height(RID p_font, int p_size) const {
|
||||
_THREAD_SAFE_METHOD_
|
||||
const FontDataFallback *fd = font_owner.getornull(p_font);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue