fairyoggy Posted May 7, 2019 Share Posted May 7, 2019 memos = guiCreateMemo(15, 20, 370, 130,"Hello How are you?Hello How are you?Hello How are you?Hello How are you?Hello How are you?",false,ruless) See the end of the line - Hello How are you? He(and the rest of the word has gone beyond the region). How to fix it? Link to comment
Investor Posted May 7, 2019 Share Posted May 7, 2019 (edited) A workaround to this is forcefully cutting the line with a ZWSP (zero-width space), which is an invisible character that allows word-wrappers to break apart a line at a more convenient position. Since there's no other breaking characters in a long line of text like that one, you'll probably want to insert a ZWSP right after each punctuation sign. Ultimately, the fix must come from MTA or CEGUI developers, to make the word-wrap break after punctuation signs (that would make sense, right?). function addZWSP(str) return string.gsub(str, "%p", function(x) return x..utfChar(0x200D) end) -- replace all punctuation signs (%p) with itself followed by UTF character 0x200D (ZWSP) end This will allow the word-wrapper to break after any punctuation sign, for example, question marks. Edited May 7, 2019 by Investor Link to comment
Scripting Moderators thisdp Posted May 7, 2019 Scripting Moderators Share Posted May 7, 2019 If you can not endure bugs of cegui, there is an alternative dx lib. https://wiki.multitheftauto.com/wiki/DgsCreateMemo https://wiki.multitheftauto.com/wiki/DgsMemoSetWordWarpState 1 Link to comment
fairyoggy Posted May 8, 2019 Author Share Posted May 8, 2019 15 hours ago, thisdp said: If you can not endure bugs of cegui, there is an alternative dx lib. https://wiki.multitheftauto.com/wiki/DgsCreateMemo https://wiki.multitheftauto.com/wiki/DgsMemoSetWordWarpState How can I use this to, for example, optimize resolutions? Here are some strange numbers of coordinates Example: ruless = DGS:dgsCreateWindow(0.31,0.38,0.382,0.40,"Правила",true) There are small numbers of coordinates and I do not quite understand how it works. If in a normal window I had coordinates, for example (300,300,300,300) but here (0.31, 0.38, 0.382, 0.40) For normal windows I used optimization like that: local sW, sH = guiGetScreenSize() ((sW/2)-(300/2),(sH/2)-(300/2),300,300) I tried to do the same with the new coordinates like this (0.31,0.38,0.382,0.40) but the window disappeared or gone beyond screen radius. How it works ? Because I ran into problems at different screen resolutions. Link to comment
Scripting Moderators thisdp Posted May 8, 2019 Scripting Moderators Share Posted May 8, 2019 10 minutes ago, slapz0r said: How can I use this to, for example, optimize resolutions? Here are some strange numbers of coordinates Example: ruless = DGS:dgsCreateWindow(0.31,0.38,0.382,0.40,"Правила",true) There are small numbers of coordinates and I do not quite understand how it works. If in a normal window I had coordinates, for example (300,300,300,300) but here (0.31, 0.38, 0.382, 0.40) For normal windows I used optimization like that: local sW, sH = guiGetScreenSize() ((sW/2)-(300/2),(sH/2)-(300/2),300,300) I tried to do the same with the new coordinates like this (0.31,0.38,0.382,0.40) but the window disappeared or gone beyond screen radius. How it works ? Because I ran into problems at different screen resolutions. Absolute position = Relative position * Parent size If there is no parent, parent size will be screen size. For example, My resolution is 1920x1080, dgsCreateWindow(0.5,0.5,0.2,0.2,"test",true) The relative position of window is x:0.5, y:0.5 The absolute position of window is x:960, y:540 ( x:1920*0.5, y:1080*0.5 ) The relative size of window is x:0.2, y:0.2 The absolute size of window is x:384, y:215 ( x:1920*0.2, y:1080*0.2 ) Link to comment
fairyoggy Posted May 8, 2019 Author Share Posted May 8, 2019 (edited) 1 hour ago, thisdp said: Absolute position = Relative position * Parent size If there is no parent, parent size will be screen size. For example, My resolution is 1920x1080, dgsCreateWindow(0.5,0.5,0.2,0.2,"test",true) The relative position of window is x:0.5, y:0.5 The absolute position of window is x:960, y:540 ( x:1920*0.5, y:1080*0.5 ) The relative size of window is x:0.2, y:0.2 The absolute size of window is x:384, y:215 ( x:1920*0.2, y:1080*0.2 ) I use your code (0.5,0.5,0.2,0.2). How to get the center point for 1920/1080 resolution. The window is not centered with that coordinates done. Edited May 8, 2019 by slapz0r Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now