Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Precise font metrics

On 03.11.2011 17:45, robert.heritage@xxxxxx wrote:
I'm not sure if it's suitable for your requirements, but I recently had a problem with metrics for strings without ascenders/descenders etc, that I needed to fit within pre-determined vertical bounds so I wrote a small method that uses a very
simplistic approach to work out the exact height  of the actual rendered text for a specific string.

It can be used to select the correct font size for the height you require in combination with the other code on this page;

http://stackoverflow.com/questions/5829703/java-getting-a-font-with-a-specific-height-in-pixels/7737840#7737840

I hope you find it useful.

Thanks a lot for trying to help me out. It's unfortunately not quite what I need. Me finding a solution to this problem has been reduced in priority for the moment, but when I return to this, I have to learn a bit more about the various frameworks convert a requested font height into a device specific font scale.

Best regards,
-Stephan




Back to the top