01-11-2012, 02:02 PM
Fonts & Colors
Fonts.ppt (Size: 53.5 KB / Downloads: 30)
Fonts.ppt (Size: 53.5 KB / Downloads: 30)
Java Versions
Java 2 (Java 1.2) has additional libraries that Java 1.1 did not provide
Not all browsers support Java 2.0
Ours in the lab do not
Requires a browser plug-in
Both Java 1.1 and Java 2.0 techniques will be discussed
Today's lecture is Java 1.1 compliant
Fonts and Strings
Java provides a flexible system for displaying strings
We can change the type face
We can change the size
We can change the weight or style
This takes a little bit of work on the programmers part
Baseline Observations
Notice that nearly all the letters do not extend below an imaginary line
except the letter 'g'?
This imaginary line is called the base line.
Our reference (anchor) point for a string in the y dimension is this base line.
Unlike any of the other graphics objects,
In the x direction, we start the string on the left hand side.
Font Definitions: Ascent
font ascent: This is the distance from the base line to the top of the letter.
In our example above, this is the distance from bottom to the top of the letter 'S'.
When we want to know about a specific font, we're probably interested in the maximum height for all characters we can display in this font, this is provided by the function FM_object.getMaxAscent().
Font Definitions: Decent
font descent: This is the distance below the line to the bottom of the letter.
In our example above, this is the distance from the bottom of the 'S' to the bottom of the 'g'.
As with the ascent, we're probably more interested in the Maximum Descent.
FM_object.getMaxDescent()
Definitions: Leading & Height
leading: The distance between base lines in strings is called the leading distance.
In our example above, this is the distance between the bottom of the 'g' and the top of the 'S' below.
font height: The sum of these three distances.
The Use of the Leading dimension
We are not required to use the leading and font height dimensions to place our strings on the screen.
You may have a very good reason to use a different dimension for leading that what is provided to you .
You might want a double space effect.
However, these are dimensions that are 'recommended by the experts.'