[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: Get advance width of a String in a Font.

I try to use the Eric's solution but I have a new problem, as I don't use a String but a StyledText (with italic, bold...). It is possible to get the advance of my StyledText with a GC object?

Regards,
David.

Matthew Hall a écrit :
David wrote:
Thanks for your help.

In fact, to get the size, I create a StyledText with the specific font, and I set the text with my specific String. Then, I get its size, and I dispose the StyledText.

Regards,
David.


If performance starts to suffer I recommend following Eric's approach. What you're doing is extremely heavyweight for such a simple operation.


Matthew