View Single Post
02-08-13, 11:26 PM   #10
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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".
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.

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