Java: Getting a font with a specific height in pixels -


it’s easy determine rendered height of font using fontmetrics, other way around? how can obtain font fit specific height in pixels?

"give me verdana in size 30 pixels high ascender descender."

how ask java this?

jen,

i don't think there's "direct" way find font height; indirect way... looping through sizes, , testing height of each <= required height.

if you're doing once, loop through them... if you've doing "on fly" binary search, it'll quicker.

cheers. keith.


Comments

Popular posts from this blog

Python __call__ special method practical example -

arrays - jQuery - Retrieve values from HTML elements and return their sum -