Comments (3)
All Godot controls can act as a container, for the buttons (and similar controls) you can always add TLLabel
as a child, set it to fill parent control size and ignore mouse input and get fully functional controls.
Another option without porting controls (this will work as module, won't work as GDNative and essentially what was done in shaping PRs) is to add a wrapper for the new font system, most controls draw text by calling .draw(text)
from the font and do not care about font internals.
Here's test branch: https://github.com/bruvzg/godot_tl/tree/font_wrapper, but it requires tiny change to the core engine:
diff --git a/scene/resources/font.h b/scene/resources/font.h
index 9b99b85d22..dcedc602ee 100644
--- a/scene/resources/font.h
+++ b/scene/resources/font.h
@@ -49,12 +49,12 @@ public:
virtual float get_descent() const = 0;
virtual Size2 get_char_size(CharType p_char, CharType p_next = 0) const = 0;
- Size2 get_string_size(const String &p_string) const;
+ virtual Size2 get_string_size(const String &p_string) const;
Size2 get_wordwrap_string_size(const String &p_string, float p_width) const;
virtual bool is_distance_field_hint() const = 0;
- void draw(RID p_canvas_item, const Point2 &p_pos, const String &p_text, const Color &p_modulate = Color(1, 1, 1), int p_clip_w = -1, const Color &p_outline_modulate = Color(1, 1, 1)) const;
+ virtual void draw(RID p_canvas_item, const Point2 &p_pos, const String &p_text, const Color &p_modulate = Color(1, 1, 1), int p_clip_w = -1, const Color &p_outline_modulate = Color(1, 1, 1)) const;
void draw_halign(RID p_canvas_item, const Point2 &p_pos, HAlign p_align, float p_width, const String &p_text, const Color &p_modulate = Color(1, 1, 1), const Color &p_outline_modulate = Color(1, 1, 1)) const;
virtual bool has_outline() const { return false; }
This should work with everything except ItemList
in the icon view mode, Label
, LineEdit
, TextEdit
and RichTextLabel
.
from godot_tl.
You are very productive, I'm speechless so I'm typing:)
I will test font_wrapper branch tomorrow.
Thanks
from godot_tl.
I tested font_wrapper branch and I got these errors when I want to set custom fonts but text rendered fine:
ERROR: set_base_font: Type mismatch
At: modules/godot_tl/src/resources/tl_shaped_string.cpp:838.
ERROR: load: Can't open dynamic font file: ""
At: modules/godot_tl/src/resources/tl_dynamic_font.cpp:466.
Maybe it's a good idea to mention this branch in README of project because I think using libgdtl as module with this patch is best option for someone that want support CTL languages in games.
from godot_tl.
Related Issues (18)
- How to use this module in a `Label` control ? HOT 2
- Problem in ctrls_builtin demo HOT 4
- Demos problems HOT 2
- ERROR: start: Timer was not added to the SceneTree. Either add it or set autostart to true. At: scene/main/timer.cpp:111. HOT 2
- patch_le.diff doesn't apply to Godot 3.2.1 HOT 1
- Underline style doesn't render correctly for different font in the same line HOT 1
- How alignments work in TLRichTextEdit? HOT 2
- Scene and inspector docks rendered incorrectly after patch_editor_fonts_3_2_1.diff applied
- Tooltips rendered incorrectly when patch_lbl_3_2_x.diff applied
- Export templates can't be compiled when patch_lbl_3_2_x.diff applied
- In inspector, some properties's LineEdits doesn't align correctly to others
- Same bug in building export template as reported in #31
- is there a way to add outlines to the font?
- Why Godot is giving error?
- Cannot compile module after "patch_lbl_3.x.x.diff" is applied HOT 2
- Cannot remove base font in Label and TLLabel
- Godot crash on clicking godot icon twice
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from godot_tl.