{"action":"created","issue":{"url":"https://api.github.com/repos/godotengine/godot/issues/10546","repository_url":"https://api.github.com/repos/godotengine/godot","labels_url":"https://api.github.com/repos/godotengine/godot/issues/10546/labels{/name}","comments_url":"https://api.github.com/repos/godotengine/godot/issues/10546/comments","events_url":"https://api.github.com/repos/godotengine/godot/issues/10546/events","html_url":"https://github.com/godotengine/godot/pull/10546","id":251971666,"number":10546,"title":"[WIP] Add support for bidi text output","user":{"login":"bruvzg","id":7645683,"avatar_url":"https://avatars0.githubusercontent.com/u/7645683?v=4","gravatar_id":"","url":"https://api.github.com/users/bruvzg","html_url":"https://github.com/bruvzg","followers_url":"https://api.github.com/users/bruvzg/followers","following_url":"https://api.github.com/users/bruvzg/following{/other_user}","gists_url":"https://api.github.com/users/bruvzg/gists{/gist_id}","starred_url":"https://api.github.com/users/bruvzg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bruvzg/subscriptions","organizations_url":"https://api.github.com/users/bruvzg/orgs","repos_url":"https://api.github.com/users/bruvzg/repos","events_url":"https://api.github.com/users/bruvzg/events{/privacy}","received_events_url":"https://api.github.com/users/bruvzg/received_events","type":"User","site_admin":false},"labels":[{"id":73330068,"url":"https://api.github.com/repos/godotengine/godot/labels/feature%20proposal","name":"feature proposal","color":"1144ff","default":false},{"id":279097966,"url":"https://api.github.com/repos/godotengine/godot/labels/topic:core","name":"topic:core","color":"ffdd44","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-08-22T14:13:46Z","updated_at":"2017-09-02T18:00:05Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/godotengine/godot/pulls/10546","html_url":"https://github.com/godotengine/godot/pull/10546","diff_url":"https://github.com/godotengine/godot/pull/10546.diff","patch_url":"https://github.com/godotengine/godot/pull/10546.patch"},"body":"This is a work in progress (**DON'T MERGE**).\r\n\r\nNot optimized, require cleanup and I am still unsure about overall design.\r\n\r\nThis PR uses portions of [ICU](http://site.icu-project.org/) and [HarfBuzz](https://www.freedesktop.org/wiki/Software/HarfBuzz/) libraries, to implement rendering of bi-direction text, complex scripts and OpenType typographic features.\r\n\r\n**Custom drawing:**\r\n```\r\nfunc _draw():\r\n        draw_bidi_string(font, pos, text, base_direction, features, script, lang, color);\r\n```\r\n`features` - Comma-separated list of 4-letter [typographic feature](https://en.wikipedia.org/wiki/List_of_typographic_features#OpenType_typographic_features) tags\r\n`script` - [ISO 15924](https://en.wikipedia.org/wiki/ISO_15924) script code\r\n`language` - [ISO 639](https://en.wikipedia.org/wiki/ISO_639) language code\r\n\r\n**Controls tracker:**\r\n- [x] line_edit (works)\r\n- [x] label (works)\r\n- [ ] text_edit\r\n- [ ] rich_text_label\r\n- [ ] item_list\r\n\r\n![bidi](https://user-images.githubusercontent.com/7645683/29567494-196cea78-8756-11e7-9164-2887332898b6.png)\r\n\r\nTested on macOS 10.12, Windows 10 x64 and Debian 9.1 x64.\r\n\r\n**Demo projects:**\r\nCustom draw: [BidiTest.zip](https://github.com/godotengine/godot/files/1242197/BidiTest.zip)\r\nControls (LineEdit, Label): [BidiEditTest.zip](https://github.com/godotengine/godot/files/1253659/BidiEditTest.zip)\r\n\r\n**Related:**\r\n#3081, #9961"},"comment":{"url":"https://api.github.com/repos/godotengine/godot/issues/comments/326760323","html_url":"https://github.com/godotengine/godot/pull/10546#issuecomment-326760323","issue_url":"https://api.github.com/repos/godotengine/godot/issues/10546","id":326760323,"user":{"login":"mrezai","id":5120436,"avatar_url":"https://avatars0.githubusercontent.com/u/5120436?v=4","gravatar_id":"","url":"https://api.github.com/users/mrezai","html_url":"https://github.com/mrezai","followers_url":"https://api.github.com/users/mrezai/followers","following_url":"https://api.github.com/users/mrezai/following{/other_user}","gists_url":"https://api.github.com/users/mrezai/gists{/gist_id}","starred_url":"https://api.github.com/users/mrezai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrezai/subscriptions","organizations_url":"https://api.github.com/users/mrezai/orgs","repos_url":"https://api.github.com/users/mrezai/repos","events_url":"https://api.github.com/users/mrezai/events{/privacy}","received_events_url":"https://api.github.com/users/mrezai/received_events","type":"User","site_admin":false},"created_at":"2017-09-02T18:00:05Z","updated_at":"2017-09-02T18:00:05Z","author_association":"CONTRIBUTOR","body":"I did some tests on BidiEditTest project:\r\n- After change \"Text Preset\" to Arabic and font to Amiri, text rendered out of the TextEdit. By moving slider a little it rendered correctly:\r\n\r\n![1](https://user-images.githubusercontent.com/5120436/29997554-73f487f2-902b-11e7-8d75-878e526d8ecd.png)\r\nAfter moving slider:\r\n![2](https://user-images.githubusercontent.com/5120436/29997555-7e41852a-902b-11e7-9fe4-6557f778f33e.png)\r\n\r\n- Change direction of main label to RTL. Run the project and move slider to the left until line breaking starting. This cause a crash with this backtrace:\r\n\r\n```\r\nERROR: operator[]: FATAL: Index p_index out of size (size()).\r\n   At: core/list.h:401.\r\n\r\nThread 1 \"godot.x11.tools\" received signal SIGILL, Illegal instruction.\r\n0x00000000019dce07 in List<GlyphInfo, DefaultAllocator>::operator[] (this=0x7033330, p_index=35) at core/list.h:401\r\n401\t\t\tCRASH_BAD_INDEX(p_index, size());\r\n(gdb) bt full\r\n#0  0x00000000019dce07 in List<GlyphInfo, DefaultAllocator>::operator[] (this=0x7033330, p_index=35) at core/list.h:401\r\n        __FUNCTION__ = \"operator[]\"\r\n        I = 0x6fce970\r\n        c = 1\r\n#1  0x0000000001e5e850 in Font::find_break_charpos (this=0x6f902b0, p_runs=..., x_line_width=350) at scene/resources/font.cpp:52\r\n        j = 0\r\n        i = 1\r\n        last_safe_break_glyph = 35\r\n        last_safe_break_run = 0\r\n        x_ofs = 342\r\n#2  0x00000000019f9887 in Label::_text_changed (this=0x6fbcd30) at scene/gui/label.cpp:774\r\n        wrap_point = -21648\r\n        width = 350\r\n        wrap_point_prev = -1\r\n        rem_text = {<Vector<wchar_t>> = {_ptr = 0x7030060 L\"@b != 1 ..< 2; ->> .-::<=|> www ***\\\\ 22\"}, <No data fields>}\r\n        shaped_text = {reference = 0x6fce7c0}\r\n        i = 0\r\n        font = {reference = 0x6f902b0}\r\n        line_text = {_ptr = 0x45d0990}\r\n        line_spacing = 32767\r\n#3  0x00000000019f86db in Label::_notification (this=0x6fbcd30, p_what=40) at scene/gui/label.cpp:360\r\nNo locals.\r\n#4  0x00000000018ced48 in Label::_notificationv (this=0x6fbcd30, p_notification=40, p_reversed=false) at ./scene/gui/label.h:39\r\nNo locals.\r\n#5  0x00000000022c8a22 in Object::notification (this=0x6fbcd30, p_notification=40, p_reversed=false) at core/object.cpp:849\r\nNo locals.\r\n#6  0x0000000001a3f38f in Control::_size_changed (this=0x6fbcd30) at scene/gui/control.cpp:1259\r\n        parent_size = {{x = 899, width = 899}, {y = 511, height = 511}}\r\n        margin_pos = {150, 60, 500, 177}\r\n        new_pos_cache = {{x = 150, width = 150}, {y = 60, height = 60}}\r\n        new_size_cache = {{x = 350, width = 350}, {y = 117, height = 117}}\r\n        minimum_size = {{x = 1, width = 1}, {y = 1, height = 1}}\r\n        pos_changed = false\r\n        size_changed = true\r\n#7  0x0000000001a4045b in Control::set_size (this=0x6fbcd30, p_size=...) at scene/gui/control.cpp:1578\r\n        new_size = {{x = 350, width = 350}, {y = 117, height = 117}}\r\n        min = {{x = 1, width = 1}, {y = 1, height = 1}}\r\n        pw = 899\r\n        ph = 511\r\n        x = 150\r\n        y = 60\r\n---Type <return> to continue, or q <return> to quit---\r\n        w = 350\r\n        h = 117\r\n#8  0x0000000000f77280 in MethodBind1<Vector2 const&>::call (this=0x4719de0, p_object=0x6fbcd30, p_args=0x7fffffffac30, p_arg_count=1, \r\n    r_error=...) at core/method_bind.gen.inc:729\r\n        __FUNCTION__ = \"call\"\r\n        instance = 0x6fbcd30\r\n#9  0x0000000002259820 in ClassDB::set_property (p_object=0x6fbcd30, p_property=..., p_value=..., r_valid=0x7fffffffb950)\r\n    at core/class_db.cpp:963\r\n        arg = {0x7fffffffadd8}\r\n        ce = {error = Variant::CallError::CALL_OK, argument = 32767, expected = Variant::NIL}\r\n        psg = 0x4723f88\r\n        type = 0x4733cd8\r\n        check = 0x4718588\r\n#10 0x00000000022c6085 in Object::set (this=0x6fbcd30, p_name=..., p_value=..., r_valid=0x7fffffffb950) at core/object.cpp:421\r\nNo locals.\r\n#11 0x0000000002342969 in Variant::set_named (this=0x7fffffffada8, p_index=..., p_value=..., r_valid=0x7fffffffb950)\r\n    at core/variant_op.cpp:984\r\nNo locals.\r\n#12 0x0000000000e4cd6b in GDFunction::call (this=0x6fa1f30, p_instance=0x4f66e30, p_args=0x7fffffffc190, p_argcount=1, r_err=..., p_state=0x0)\r\n    at modules/gdscript/gd_function.cpp:485\r\n        dst = 0x7fffffffada8\r\n        value = 0x7fffffffadd8\r\n        indexname = 1\r\n        index = 0x6f9ff88\r\n        valid = true\r\n        last_opcode = 4\r\n        err_file = {<Vector<wchar_t>> = {_ptr = 0x4e5d0000 <error: Cannot access memory at address 0x4e5d0000>}, <No data fields>}\r\n        self = {type = Variant::OBJECT, _data = {_bool = 176, _int = 117153456, _real = 5.788149790117406e-316, _transform2d = 0x6fb9eb0, \r\n            _rect3 = 0x6fb9eb0, _basis = 0x6fb9eb0, _transform = 0x6fb9eb0, _resource = 0x6fb9eb0, _ptr = 0x6fb9eb0, \r\n            _mem = \"\\260\\236\\373\\006\", '\\000' <repeats 11 times>}}\r\n        retvalue = {type = Variant::NIL, _data = {_bool = 104, _int = 140737257224808, _real = 6.9533443884700406e-310, \r\n            _transform2d = 0x7ffff2393a68, _rect3 = 0x7ffff2393a68, _basis = 0x7ffff2393a68, _transform = 0x7ffff2393a68, \r\n            _resource = 0x7ffff2393a68, _ptr = 0x7ffff2393a68, _mem = \"h:9\\362\\377\\177\\000\\000xA\\243\\003\\000\\000\\000\"}}\r\n        stack = 0x7fffffffad90\r\n        call_args = 0x7fffffffadf0\r\n        defarg = 0\r\n        alloca_size = 104\r\n        _class = 0x6f8e540\r\n        ip = 36\r\n        line = 61\r\n        err_text = {<Vector<wchar_t>> = {_ptr = 0x0}, <No data fields>}\r\n```\r\n"}}
{"actor":{"display_login":"mrezai"}}