Noobini Posted October 29, 2017 Share Posted October 29, 2017 so I did a proof of concept to this question... https://www.sidefx.com/forum/topic/52335/ but the OP hasn't even bothered to acknowledge if I'm on the right track or not...so...pffft....I'll post the final solution here instead... vu_fontZ.hdanc 1 Quote Link to comment Share on other sites More sharing options...
Noobini Posted October 30, 2017 Author Share Posted October 30, 2017 ver 1.01: - added Progress slider vu_fontZ.hdanc Quote Link to comment Share on other sites More sharing options...
Noobini Posted October 30, 2017 Author Share Posted October 30, 2017 oddly, some fonts create the same text in different character order....so I've added an internal sort.. ver 1.02: - added internal sort to ensure correct character parsing.. vu_fontZ.hdanc 1 Quote Link to comment Share on other sites More sharing options...
mestela Posted October 30, 2017 Share Posted October 30, 2017 nice one! Quote Link to comment Share on other sites More sharing options...
Noobini Posted October 30, 2017 Author Share Posted October 30, 2017 thanks Matt, if you or any other gurus out there can workout where it stores the line 'gap' internally, then we could do away with the Offset entirely..rather than as of now it's a bit of an eyeballing process... Must be in there some where since the font 'knows' the line spacing... Quote Link to comment Share on other sites More sharing options...
mestela Posted October 30, 2017 Share Posted October 30, 2017 No magic tricks from me I'm afraid. I assume Houdini is relying on the font itself to work out the vertical separation, but doesn't expose that in any way. Thinking out loud, You could maybe calculate it yourself. The textindex attribute jumps where there's a new line, so you could get the first character of the first line, the first character of the second, then measure the distance from the bottom of the first to the top of the second. That seems a bit loose though; if you wanted to guarantee where the first char of each line is, you could get the text from the font sop text parm directly, split on the '\n', and go from there. Just proving to myself that its possible in python (and cos its late and I shouldn't go any further with this tonight...) >>> p = hou.parm('/obj/geo1/font1/text') >>> p.eval() 'line 1\nline2' Quote Link to comment Share on other sites More sharing options...
Noobini Posted October 31, 2017 Author Share Posted October 31, 2017 (edited) thanks Matt...I did wrestle with that python...but sadly couldn't go the distance...so I resorted to my redneck hillbilliness.....hey, hillbillies can be very creative/resourceful too....especially with me cousins Anyway, ver 1.03: no more eyeballing Offset..now it's fully auto for any fonts...plus you can add manual spacing on top.... vu_fontZ.hdanc Edited October 31, 2017 by Noobini Quote Link to comment Share on other sites More sharing options...
mestela Posted October 31, 2017 Share Posted October 31, 2017 Cool! Be curious to see what you came up with; despite myself I played with detecting the line breaks in vex for another 2 hours past my bedtime, it actually got worse by the end of those 2 hours. *time passes as I look at the setup* Ah jeez, thats such a simple fix, I was waaay overcomplicating it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.