Font Size In Pixels [message #568176] |
Fri, 10 September 2010 10:43  |
Eclipse User |
|
|
|
A couple times now I've run into a layout issue where I really need to know the height of a font. After poking around I found the CompartmentPattern in the examples. It has the same problem, since it's doing the same thing I want to do. It has to make layout decisions based on the size of a font. CompartmentPattern solves the problem by hard coding a pixel height.
That approach might be reasonable for some cases, but if the user has control of the typeface or the size of the font, then knowing the height when the code is compiled is tricky. Also, I imagine that font sizes (at least in physical pixels) might vary across platforms.
Is there a better solution?
Also, having seen CompartmentPattern, I'm now curious about Patterns. :)
|
|
|
|
|
|
Re: Font Size In Pixels [message #569636 is a reply to message #569613] |
Thu, 16 September 2010 09:21  |
Eclipse User |
|
|
|
I believe that it does work as I expect. Thank you very much. I incorporated it into my layout and now I can read all my labels!
I should note, for those following the thread, that the size attribute of a font does not correspond to its height. My size 6 font, for instance, requires 10 pixels of height to render.
|
|
|
Powered by
FUDForum. Page generated in 0.04041 seconds