Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "18 Fonts"
(→Class FontMetrics) |
(→Class FontData) |
||
Line 7: | Line 7: | ||
===Class FontData=== | ===Class FontData=== | ||
Not yet implemented. | Not yet implemented. | ||
+ | <code>getName()</code>, <code>getHeight()</code>, and <code>getStyle</code> are implemented on <code>Font</code>. | ||
===Class Font=== | ===Class Font=== |
Revision as of 05:51, 13 February 2007
Contents
Fonts
We are facing similar problems with platform-independent font code as SWT does. It is even worse as we don't have access to the available fonts on the system that is displaying the application. Choose your fonts carefully.
Class FontData
Not yet implemented.
getName()
, getHeight()
, and getStyle
are implemented on Font
.
Class Font
The Font class is somewhat different from SWT. We share fonts application wide and therefore there is no constructor but a static getFont(String,int,int)
method to create and/or obtain a font. However the three parameters should be familiar as they denote the name, size and style of the font.
Drawing Text
Drawing text is based on the Graphics Context, see 16._Graphics_Fundamentals.
Class FontMetrics
The SWT class FontMetrics
provides exact information on font dimensions like distace from baseline to leading etc.
Since we don't have access to the client fonts, we cannot provide these information.
Font Size Measurements
To be able to compute the size of controls, we have to guess the extent of any contained text.
For this task, an internal class (FontSizeEstimation
) is used.
In the future, it is planned to reconcile the estimated extent with the real size of the rendered widget in a second server-side turnaround. However, the exact machanism has still to be elaborated.
By now, there is no API functionality for font size measurement.