View Single Post
Unread 02-08-13, 11:26 PM   #10
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,383
I didn't look at that addon's code, but since it is showing a copy of the text in a separate window, I'd guess that it is likely reading the whole text of the original font string, using string.split or string.match to identify each word, and then creating a separate font string (or maybe even a separate frame) for each word. Either that, or it's doing what I described in my last post, and guessing based on the font size and the assumed widths of individual letters. Such guesses will be fairly accurate with the default WoW font at the default size used by the addon, but if you change the font size, or change the font itself, the accuracy will drop significantly the further from the default font you go.

As I already stated, there is no API for "get the word under the cursor". There is only an API for "get the frame under the cursor", and for "get the font string on that frame", and for "get the text of that font string".
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!

Last edited by Phanx : 02-08-13 at 11:28 PM.
Phanx is offline   Reply With Quote