Font sizes can be specified in a variety of measurement units.
There are some issues to do with font sizes that make fonts very difficult to control across platforms. This is affected by several factors:
Font digitizing
Font design (x-height)
Bitmap vs. Adobe vs. TrueType
Pixel DPI settings
Different defaults for symbolic sizes
There are differences between the way that fonts are rendered. Considering that the Macintosh supports at least three simultaneous font rendering models at a time and historically there have been several radically different font management schemes, it is amazing that fonts ever appear in the way they were intended. The Windows platform must provide at least half as many again, while the X-Windows support on the Linux platform supports a completely different font rendering model.
Certain font families appear to render larger than others for the same point size. This difference is due to the different x-height for the characters.
The differences between the Macintosh and the Windows environment are due to the 72 DPI vs. 96 DPI default pixel resolution of the screen displays. The latest versions of MSIE for the Macintosh provide a 96 DPI switch to work round this.
The symbolic names for font sizes do not render identically across platforms nor do they render the same across browsers within the same platform. These are the symbolic font size names for absolute sizes:
xx-small
x-small
small
medium
large
x-large
xx-large
You can use numeric values with suffixes to indicate the units of measure:
px
em
percentage
The px suffix means pixels while the em value means the width of an em-dash in the current font. You can use floating point values for measurements in em units. You can also use floating point values for percentage values. The percentage relates to the containing parent object's font settings.
Two additional symbolic names are reserved for relative font sizes:
larger
smaller
The larger and smaller keywords index up and down the scale defined by the absolute size keywords.
Be very careful when defining styles with relative settings. This can cascade recursively in some cases and you will end up with text that reduces or increases in size as it goes down the page.
Prev | Home | Next |
style.fontFamily | Up | style.fontSizeAdjust |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |