Home > Articles > Web Development > ASP.NET

  • Print
  • + Share This
Like this article? We recommend Text Enhancements

Text Enhancements

Traditionally Silverlight has delivered a powerful user interface for user interaction but has been unable to provide a quality document-based experience out of the box. The support for creating on-screen text has been severely limited compared to Silverlight’s desktop-focused alternative, Windows Presentation Foundation (WPF). Applications that focused on the presentation of rich, document-based data were difficult to develop because most of the key features such as creating columns or position text had to be done manually.

Silverlight 5 introduces the concept of text overflow or linked text boxes. This enables the developer to position multiple text areas on the display surface and specify one as the target for overflow from the other (see Figure 1). Creating two- or three-column layouts is as simple as positioning three text blocks and specifying the overflow parameter. It also allows for more exotic layouts as any standard transformation or effect can be applied to the containers that host the text.

Figure 1 Text overflow

The post-beta addition of control over pixel snapping will make it easier to produce quality documents. Pixel snapping eliminates artifacts created when text that is partially aligned is rendered with anti-aliasing. Because the layout engine is a decimal-based engine, computed offsets can fall on fractional pixel boundaries. Anti-aliasing refers to the shading of a pixel to simulate a half-pixel layout (instead of a single pixel—for example, two adjacent pixels can be created at half intensity to produce the illusion of a single, centered pixel). This can produce undesired side effects and cause text to appear chopped or blurry. Turning on pixel snapping ensures that all text is rounded or snapped to the nearest pixel boundary to avoid anti-aliasing and cut-off pixels.

Character spacing (see Figure 2) provides precise control over the spacing between glyphs of text in a control. The unit of measure is 1/1000th of a pixel. Applying the value to a control will pad the space between glyphs for any text within that control. The result is that a short line of text can span the entire with of the screen with consistent spacing between characters.

Figure 2 Example of character spacing

  • + Share This
  • 🔖 Save To Your Account