Giter Site home page Giter Site logo

bruvzg / godot_tl Goto Github PK

View Code? Open in Web Editor NEW
28.0 28.0 5.0 60.23 MB

BiDi, shaping and basic text layout for Godot Engine

License: The Unlicense

Python 0.95% Meson 0.17% C++ 46.38% C 47.93% Makefile 1.65% Ragel 0.12% Perl 0.13% GDScript 0.05% Shell 0.03% CMake 0.04% Hack 2.56%

godot_tl's People

Contributors

bruvzg avatar mrezai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

godot_tl's Issues

Cannot compile module after "patch_lbl_3.x.x.diff" is applied

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

Idea: port some useful controls from min-shaping branch

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:

  • LineEdit (ported, create user profile, sing in etc..)
  • Label (ported, show score, help etc...)
  • Button
  • Checkbox
  • OptionButton (select language)
  • Sliders (set sound volume etc..)
  • Dialogs (confirm, errors etc...)

Why Godot is giving error?

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)

Context

Your Environment

  • libgdtl
  • godot-cpp version used: not used
  • Godot version used: 3.2 stable
  • Operating System and version: win 10

is there a way to add outlines to the font?

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.

Export templates can't be compiled when patch_lbl_3_2_x.diff applied

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:

+ 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'])

How to use this module in a `Label` control ?

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:

  • rebuild godot with the godot-tl in modules folders : OK
  • make a new project with a simpe Label
  • make the Label arabic
  • add a Dynamic Font and a DynamicFontData arabic (NotoSansArabic-Regular.ttf)

It 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.

Cannot remove base font in Label and TLLabel

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).

Same bug in building export template as reported in #31

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"

Demos problems

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
Screenshot from 2019-10-28 21-42-17

Godot crash on clicking godot icon twice

[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 ???

Problem in ctrls_builtin demo

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:
Screenshot from 2019-10-25 22-12-19

After open it in godot editor and run:
Screenshot from 2019-10-25 22-13-56

Close editor and open it again:
Screenshot from 2019-10-25 22-21-49

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 = "اور بازار سے لے آئے اگر ٹوٹ گیا"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.