Talk:VariText/Script
Facinating
Interesting script. I'm going to ramble a bit. If you have skip spaces turned on and two sequential spaces, I think that neuters the skip potential. When generating the offsets in do_layout it looks like you could optimize the math... of course without grokking exactly what is going on there, where bits are being dropped intentionally or unintentionally it's folly to mess with it. As you alluded to on the main page, kerning is expensive. You may want to look at Unescape or Combined_Library#Unescape both do escape codes. As to the memory issue, I might suggest packing your extends 4 or 5 to an integer. It complicates lookup but might reduce your memory footprint. Here is one way to achieve this which would require no modifications to your code (beyond the call sites). The only issue with this method is that add_extent is really inefficient. It could be sped up by storing count in a global or calculating count on the fly (read the last list element and then find the first unused block). I didn't want to do the former because that would require modifying more of your code as you would need to reset count when you reset extents. I didn't want to do the latter as it would be ugly and more costly. The advantage of this approach is that when you nuke extents, it resets the counter at the same time. Oh and one more thing, you will need to similarly encode hardcoded font. -- Strife (talk|contribs) 00:56, 30 December 2012 (PST)
<lsl>//Released into the Public Domain by Strife Onizuka add_extent(integer value){
integer count = llList2Integer(extents, 0); integer index = 1 + (count / 5); extents = llListReplaceList(llListReplaceList(extents, [count + 1], 0, 0), [llList2Integer(extents, index) | (value << ((count % 5) * 6))], index, index);
}
integer get_extent(integer char){
return (llList2Integer(extents, 1 + (char / 5)) >> ((char % 5) * 6)) & 0x3F;
} </lsl>
P.S. It's going to take me a long time to grok your script. It is complex.
- Oh another solution to the hard coding is to hard code a remote notecard (by uuid) so on reset it reads from the notecard. -- Strife (talk|contribs) 00:59, 30 December 2012 (PST)
- I've been adding bits to the script for two years. It has come to such a complexity where I don't even grok my own script :) If there's something I can do to provide a better understanding, please feel free to speak up.
- Packing the extents would mean the maximum advance width will be limited to 64... but nobody will have characters that big, right?--Geneko Nemeth 05:13, 30 December 2012 (PST)