18 Fonts

From Eclipsepedia

Jump to: navigation, search

Back to RWTOverview

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.