I want to show font family, font size, color and BG-Color of the text, I am getting text color through (GWT) Formatter.getForeColor(), but remaining i don't know how to get.
Example: <font face="Arial">Apple </font><span style="background-color: rgb(255, 0, 0);"><font face="Courier" size="5">banana</font></span><br>
if cursor at in 'Apple' it should return font family is Arial, and if cursor at 'Banana' it should return font-family: Courier and size:3 and BG-Color: Red
For me no problem if the solution in JavaScript or JQuery or GWT.
I want to do toolbar like Google docs.
If any one have Idea please help me how to get it?
I see two options. Either you build the UI using GWT components, so you can add and read the style information in the code, or you try to get the element below the mouse pointer using JSNI and then try to analyze this element.
The first, probably easier, solution looks like this:
The above sample is simplified, you'd have to make your code much smarter to handle all variations of HTML attributes, CSS style-names and direct styles.
The second option is to get the element that is currently below the mouse pointer. This can be done using some JSNI magic:
Of course you need a trigger to call the getElementFromPoint() method. You can use a MouseHandler as well or some kind of background code (a.k.a. Timer) to trigger. Once know where the mouse pointer is, get the element and analyze the style of element.