bruvzg / godot_tl Goto Github PK
View Code? Open in Web Editor NEWBiDi, shaping and basic text layout for Godot Engine
License: The Unlicense
BiDi, shaping and basic text layout for Godot Engine
License: The Unlicense
Godot 3.4-stable
Mac os 12.0.1 (Monterery)
Xcode 13.2.1
Build version 13C100
Mac m1 air
I am trying to compile godot_tl module for 3.4. If I only apply "patch_font_3.x.x.diff" and "patch_editor_font_3.4.x.diff", I can successfully compile the module. However, If I apply "patch_lbl_3.x.x.diff", then the following errors shows and failed to compile.
./modules/godot_tl/src/controls/tl_label.hpp:34:10: fatal error: 'resources/tl_font_family.hpp' file not found
#include "resources/tl_font_family.hpp"
I think it's some linking problem, but I don't have any knowledge to fix this.
(sorry for my poor english).
Edit: I ran the following command to compile it for osx.
scons p=osx -j8 use_font_wrapper=true
I think it's a good idea to port some useful controls from min-shaping branch to this repository. I really lost my hope that your incredible work finally merged even in Godot 4!
If we have a simple multi language game as demo we can identify which controls are most useful.
these are some controls that seems as good candidate to port:
As i said, when I import addons (libgdtl), it is giving error, not implementing files.
It is giving "Cannot get class TlFontFamily" (and label font is being empty again)
i love your work and im trying to work with it to add an hebrew option to my project (3.2.3), i even learned to compile godot to add it :).
i only need to learn how to add an outline to the font, if possible.
https://travis-ci.org/github/bruvzg/godot_tl/jobs/670287227
error: patch failed: scene/gui/line_edit.h:31
error: scene/gui/line_edit.h: patch does not apply
git apply modules/godot_tl/patch_font_3_2_x.diff
git apply modules/godot_tl/patch_editor_fonts_3_2_1.diff
git apply modules/godot_tl/patch_lbl_3_2_x.diff
scons platform=x11 tools=no target=release use_font_wrapper=yes -j4
The last command failed but if before run the last command I move these two below lines outside and before of "if" in patched file(editor/SCsub), its run fine without any issue:
godot_tl/patch_editor_fonts_3_2_1.diff
Lines 9 to 10 in 382f7a7
Hi,
first of all thank you for this huge amount of work and this great module.
I am trying to make it work and I am not sure I understand everything, maybe you can help me.
I would like my Label
component to display arabic (RTL) so here is what I did:
godot-tl
in modules
folders : OKIt didn't display right.
I have tried to use the code in the demos you gave and it prints arabic good :
var font1
var sstring1 : TLShapedString
func _init():
var face1 = TLDynamicFontFace.new()
face1.load("res://NotoSansArabic-Regular.ttf")
font1 = TLFontFamily.new()
font1.set_face("Default", face1)
sstring1 = TLShapedString.new()
sstring1.set_base_font_size(72)
sstring1.set_base_font(font1)
sstring1.set_base_font_style("Default")
sstring1.set_text("اجري")
func _draw():
var ofs = sstring1.get_ascent() + 20
sstring1.draw(get_canvas_item(), Vector2(20, ofs), Color(0, 0, 1))
I can see that the text is correctly displayed, but I don't how to integrate this in an existing project which has mostly Label
controls.
Thanks for your help.
The bug is present in both Godot 3.4 custom build and one downloaded from release section from this repo.
Steps to reproduce:
Add new Label or TLLabel.
Add "New TL FontFamily" in base font section.
Try to remove it either with reset button or clear button.
Following error prints in console:
ERROR: Type mismatch
at: set_base_font (modules/godot_tl/src/resources/tl_shaped_string.cpp:838)
Also:
Label comes with default base font which cannot be removed. Changing base font size only reflects in editor but when I run the scene, the font size is same and I need to override the font from theme properties. (TLLabel dont' have this bug).
godot_tl: master
Godot: godotengine/godot@83d950b
After apply all patches and use_font_wrapper=yes, this error will be printed after add a node to a new scene and select the node:
ERROR: start: Timer was not added to the SceneTree. Either add it or set autostart to true. At: scene/main/timer.cpp:111.
I close other old issues and open new ones for better tracking
All patch applied and:
scons platform=x11 target=release tools=no use_font_wrapper=yes -j4
Error:
In file included from ./scene/gui/line_edit.h:34:0,
from ./editor/editor_inspector.h:35,
from ./editor/editor_plugin.h:36,
from modules/csg/csg_gizmos.h:35,
from modules/csg/csg_gizmos.cpp:31:
./modules/godot_tl/src/controls/tl_line_edit.hpp:34:10: fatal error: resources/tl_font_family.hpp: No such file or directory
#include "resources/tl_font_family.hpp"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I think the problem is "tools=no" and these two lines in editor/SCsub:
env.Append(CXXFLAGS=['-DGODOT_MODULE'])
env.Append(CPPPATH=['#modules/godot_tl/src/resources', '#modules/godot_tl/src', '#modules/godot_tl/subprojects/graphite2/include', '#modules/godot_tl/subprojects/harfbuzz/src', '#modules/godot_tl/subprojects/icu4c/source/common'])
only applied when "tools=yes"
In input builtin demo, it seems alignment buttons haven't any effect on text or maybe I can't understand how they work!
1- ctrls_gdnative:
demo has some problems like ctrls_builtin that I reported in #4, bad rendering and lots of error in console:
ERROR: getornull: Condition ' !id_map.has(p_rid.get_data()) ' is true. returned: __null
At: ./core/rid.h:160.
ERROR: getornull: Condition ' !id_map.has(p_rid.get_data()) ' is true. returned: __null
At: ./core/rid.h:160.
ERROR: getornull: Condition ' !id_map.has(p_rid.get_data()) ' is true. returned: __null
At: ./core/rid.h:160.
2- input_builtin:
After type some text and press Enter, the last character will be shown in next line
[3.4 custom build]
Steps to reproduce:
Create a new empty project.
Click on godot icon twice in the "FileSsytem" panel.
It crashes.
Similar to 50725 50702. Related comment
Crashlog
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 ??? 0x7ff89d656940 ???
1 libsystem_kernel.dylib 0x7ff80d19b112 __pthread_kill + 10
2 libsystem_c.dylib 0x7ff80d11dd10 abort + 123
3 godot 0x104a2883f handle_crash(int) + 3087 (crash_handler_osx.mm:163)
4 libsystem_platform.dylib 0x7ff80d1e6e2d _sigtramp + 29
5 ??? 0x0 ???
6 godot 0x106ef8711 TexturePreview::_notificationv(int, bool) + 145 (texture_editor_plugin.h:39)
7 godot 0x108462830 Object::notification(int, bool) + 48 (object.cpp:927)
8 godot 0x1071ded58 Control::_notification(int) + 1000 (control.cpp:521)
9 godot 0x107093721 Control::_notificationv(int, bool) + 145 (control.h:47)
10 godot 0x10709b24c Container::_notificationv(int, bool) + 60 (container.h:37)
11 godot 0x1072c792c MarginContainer::_notificationv(int, bool) + 60 (margin_container.h:37)
12 godot 0x106ef86bc TexturePreview::_notificationv(int, bool) + 60 (texture_editor_plugin.h:39)
13 godot 0x108462830 Object::notification(int, bool) + 48 (object.cpp:927)
14 godot 0x1076efa00 CanvasItem::_enter_canvas() + 1680 (canvas_item.cpp:544)
15 godot 0x1076efc74 CanvasItem::_notification(int) + 324 (canvas_item.cpp:564)
16 godot 0x107093801 CanvasItem::_notificationv(int, bool) + 145 (canvas_item.h:163)
17 godot 0x1070936cc Control::_notificationv(int, bool) + 60 (control.h:47)
18 godot 0x10709b24c Container::_notificationv(int, bool) + 60 (container.h:37)
19 godot 0x1072c792c MarginContainer::_notificationv(int, bool) + 60 (margin_container.h:37)
20 godot 0x106ef86bc TexturePreview::_notificationv(int, bool) + 60 (texture_editor_plugin.h:39)
21 godot 0x108462830 Object::notification(int, bool) + 48 (object.cpp:927)
22 godot 0x1070ea2a3 Node::_propagate_enter_tree() + 403 (node.cpp:213)
23 godot 0x1070ef784 Node::_set_tree(SceneTree*) + 116 (node.cpp:2555)
24 godot 0x1070ef631 Node::_add_child_nocheck(Node*, StringName const&) + 177 (node.cpp:1119)
25 godot 0x1070f0243 Node::add_child(Node*, bool) + 2627 (node.cpp:1140)
26 godot 0x10663a663 EditorInspector::_parse_added_editors(VBoxContainer*, Ref<EditorInspectorPlugin>) + 147 (editor_inspector.cpp:1300)
27 godot 0x10663beaf EditorInspector::update_tree() + 1631 (editor_inspector.cpp:1436)
28 godot 0x106641643 EditorInspector::edit(Object*) + 275 (editor_inspector.cpp:1815)
29 godot 0x106755637 EditorPropertyResource::update_property() + 2695 (editor_properties.cpp:2483)
30 godot 0x106750faa EditorPropertyResource::_resource_selected(Ref<Resource> const&, bool) + 410 (editor_properties.cpp:2243)
31 godot 0x106774dab MethodBind2<Ref<Resource> const&, bool>::call(Object*, Variant const**, int, Variant::CallError&) + 987 (method_bind.gen.inc:1523)
32 godot 0x108466441 Object::call(StringName const&, Variant const**, int, Variant::CallError&) + 1025 (object.cpp:918)
33 godot 0x108468e1d Object::emit_signal(StringName const&, Variant const**, int) + 2093 (object.cpp:1224)
34 godot 0x108466ef4 Object::emit_signal(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) + 196 (object.cpp:1279)
35 godot 0x10678bab4 EditorResourcePicker::_resource_selected() + 276 (editor_resource_picker.cpp:111)
36 godot 0x108491deb MethodBind0::call(Object*, Variant const**, int, Variant::CallError&) + 411 (method_bind.gen.inc:59)
37 godot 0x108466441 Object::call(StringName const&, Variant const**, int, Variant::CallError&) + 1025 (object.cpp:918)
38 godot 0x108468e1d Object::emit_signal(StringName const&, Variant const**, int) + 2093 (object.cpp:1224)
39 godot 0x108466ef4 Object::emit_signal(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) + 196 (object.cpp:1279)
40 godot 0x10719c9f2 BaseButton::_pressed() + 658 (base_button.cpp:128)
41 godot 0x10719c219 BaseButton::on_action_event(Ref<InputEvent>) + 1321 (base_button.cpp:159)
42 godot 0x10719bb2a BaseButton::_gui_input(Ref<InputEvent>) + 538 (base_button.cpp:67)
43 godot 0x1071a4fe3 MethodBind1<Ref<InputEvent> >::call(Object*, Variant const**, int, Variant::CallError&) + 707 (method_bind.gen.inc:775)
44 godot 0x108464e40 Object::call_multilevel(StringName const&, Variant const**, int) + 592 (object.cpp:766)
45 godot 0x108466012 Object::call_multilevel(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) + 194 (object.cpp:863)
46 godot 0x107166f0e Viewport::_gui_call_input(Control*, Ref<InputEvent> const&) + 1582 (viewport.cpp:1652)
47 godot 0x107168fbd Viewport::_gui_input_event(Ref<InputEvent>) + 4861 (viewport.cpp:2038)
48 godot 0x107165b58 Viewport::input(Ref<InputEvent> const&) + 280 (viewport.cpp:2803)
49 godot 0x107165a06 Viewport::_vp_input(Ref<InputEvent> const&) + 230 (viewport.cpp:1421)
50 godot 0x10860e983 MethodBind1<Ref<InputEvent> const&>::call(Object*, Variant const**, int, Variant::CallError&) + 707 (method_bind.gen.inc:775)
51 godot 0x108466441 Object::call(StringName const&, Variant const**, int, Variant::CallError&) + 1025 (object.cpp:918)
52 godot 0x108465f00 Object::call(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) + 240 (object.cpp:847)
53 godot 0x1071295e0 SceneTree::call_group_flags(unsigned int, StringName const&, StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) + 1808 (scene_tree.cpp:272)
54 godot 0x10712a6bf SceneTree::input_event(Ref<InputEvent> const&) + 431 (scene_tree.cpp:431)
55 godot 0x104a59338 InputDefault::_parse_input_event_impl(Ref<InputEvent> const&, bool) + 7656 (input_default.cpp:477)
56 godot 0x104a5b4e0 InputDefault::flush_buffered_events() + 192 (input_default.cpp:698)
57 godot 0x104a3b7b8 OS_OSX::process_events() + 552 (os_osx.mm:3233)
58 godot 0x104a3c257 OS_OSX::run() + 167 (os_osx.mm:3320)
59 godot 0x104a4ca41 main + 961 (godot_main_osx.mm:71)
60 dyld 0x20eeb54fe start + 462
61 ??? 0x9 ???
OS: ubuntu 18.04
Godot: 3.1.1-stable
godot_tl: master
After compile godot with godot_tl module, import ctrls_builtin demo and Run it from in project manager(before open it in godot editor), text will be rendered correctly:
After open it in godot editor and run:
Close editor and open it again:
It seems there is a problem in importing project to editor because font properties in Control.tscn file changed like this diff:
diff --git a/demos/ctrls_builtin/Control.tscn b/demos/ctrls_builtin/Control.tscn
index 3853fe4..52cde41 100644
--- a/demos/ctrls_builtin/Control.tscn
+++ b/demos/ctrls_builtin/Control.tscn
@@ -1,25 +1,17 @@
-[gd_scene load_steps=9 format=2]
+[gd_scene load_steps=7 format=2]
[ext_resource path="res://fonts/NotoSans-Bold.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://fonts/NotoNastaliqUrdu-Regular.ttf" type="DynamicFontData" id=2]
-[sub_resource type="TLDynamicFontFace" id=1]
-font_path = "res://fonts/NotoSans-Bold.ttf"
+[sub_resource type="TLFontFamily" id=1]
-[sub_resource type="TLFontFamily" id=2]
-regular/0 = SubResource( 1 )
-
-[sub_resource type="DynamicFont" id=3]
+[sub_resource type="DynamicFont" id=2]
size = 12
font_data = ExtResource( 1 )
-[sub_resource type="TLDynamicFontFace" id=4]
-font_path = "res://fonts/NotoNastaliqUrdu-Regular.ttf"
-
-[sub_resource type="TLFontFamily" id=5]
-regular/0 = SubResource( 4 )
+[sub_resource type="TLFontFamily" id=3]
-[sub_resource type="DynamicFont" id=6]
+[sub_resource type="DynamicFont" id=4]
size = 12
font_data = ExtResource( 2 )
@@ -34,14 +26,14 @@ margin_right = 321.0
margin_bottom = 146.0
text = "test232
gdtl TLLabel"
-base_font = SubResource( 2 )
+base_font = SubResource( 1 )
[node name="Label" type="Label" parent="."]
margin_left = 401.0
margin_top = 37.0
margin_right = 611.0
margin_bottom = 151.0
-custom_fonts/font = SubResource( 3 )
+custom_fonts/font = SubResource( 2 )
text = "test232
Godot Label"
@@ -50,7 +42,7 @@ margin_left = 100.0
margin_top = 159.0
margin_right = 322.0
margin_bottom = 200.0
-base_font = SubResource( 5 )
+base_font = SubResource( 3 )
text = "اور بازار سے لے آئے اگر ٹوٹ گیا"
[node name="LineEdit" type="LineEdit" parent="."]
@@ -58,5 +50,5 @@ margin_left = 390.0
margin_top = 159.0
margin_right = 612.0
margin_bottom = 200.0
-custom_fonts/font = SubResource( 6 )
+custom_fonts/font = SubResource( 4 )
text = "اور بازار سے لے آئے اگر ٹوٹ گیا"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.