Skip to main content

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.

Jump to: navigation, search

Difference between revisions of "18 Fonts"

(Class FontMetrics)
Line 14: Line 14:
 
Drawing text is based on the Graphics Context, see [[16._Graphics_Fundamentals.]]
 
Drawing text is based on the Graphics Context, see [[16._Graphics_Fundamentals.]]
  
===Class FontMetrics===
+
=== Class FontMetrics ===
Not applicable.
+
 
 +
The SWT class <code>FontMetrics</code> 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 (<code>FontSizeEstimation</code>) 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.

Revision as of 05:15, 13 February 2007

Back to RWTOverview

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.

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.

Back to the top