MX_Master Posted November 16, 2010 Posted November 16, 2010 Sometimes in script I want to know the height of DX text, which will be drawn later with dxDrawText. dxDrawText uses wordBreak with true as value and text can be drawn as multi-line text. This height needs to draw black box (rectangle) under the text. dxGetTextWidth and dxGetFontHeight works fine, but only for one-line texts. dxDrawText uses DirectX's DrawText function with own word wrap mechanism and this is a problem. If someone already scripted this function manually, please, give it here as code example. topcnc.ru # vydrenko.ru
greacius Posted November 17, 2010 Posted November 17, 2010 Well you can check if it is text wrapping by doing: if (*TEXTWIDTH* > *WIDTH OF THE TEXT PART*) then //Now it is word wrapping because it is bigger then the width of the text part. end http://AllesOverServers.nl http://www.zakelijkthuis.nl/promoot.php?x=4179
MX_Master Posted November 17, 2010 Author Posted November 17, 2010 ((: thanks for nothing i think it's better way to write wrap function by myself... topcnc.ru # vydrenko.ru
greacius Posted November 17, 2010 Posted November 17, 2010 ((: thanks for nothingi think it's better way to write wrap function by myself... Ok i didnt understand your question but now i do. The problem is that it is determined in the dxDrawText function when and where to wrap the words. So as i said: you can use the function above to determine if wordwrapping is used and then after that do twice the font height of one line. I know it is hard to understand but i think that is what you are asking for? http://AllesOverServers.nl http://www.zakelijkthuis.nl/promoot.php?x=4179
MX_Master Posted November 18, 2010 Author Posted November 18, 2010 i already scripted custom wrap mechanism same as uses dxDrawText, while waiting for proper help (: thanks, anyway I learned one thing - it is better not ask about anything, quickly figured out answers by myself topcnc.ru # vydrenko.ru
greacius Posted November 18, 2010 Posted November 18, 2010 Well i dont know how your wrap function works so i cant help. And true, it is more usefull to watch to the code by yourself. There is nearly always a logic answer. http://AllesOverServers.nl http://www.zakelijkthuis.nl/promoot.php?x=4179
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