• Keine Ergebnisse gefunden

Dealing with Prestored Images

Im Dokument PENPOINT THE POWER OF (Seite 195-198)

By nature of their design and intended uses, many PenPoint-based com-puter systems must deal with a wide range of images. This includes not only images that are produced by the system on which PenPoint is running and by' other PenPoint systems (generally using PicSegs as described previously) but also images produced in other standard formats as well as those that are for some reason incompatible with PenPoint's graphics operations.

An example of the latter is the digitized image of a facsimile that might be received via a fax modem built into a Pen Point-based computer system. Its resolution, aspect ratio, and other characteristics may make it impossible to work with directly as text on the PenPoint-based computer system.

But PenPoint includes powerful high-level support for dealing with such images, in the form of its Sampled Image Operator (SIO). These images are pixel-based. Even relatively straightforward translations (such as a resolution conversion that converts every pixel to four to increase its visibility on an incompatible platform) tend not to work very well. To display a pixel-oriented image at anything other than its original resolution and density requires image processing. PenPoint's SIO handles simulated analog image processing.

SIO performs relatively sophisticated mapping of source pixels into destina-tion pixels and source gray levels into destinadestina-tion gray levels. It also supports run-length-compressed sources and allows easy scaling and rotation of pixel-based images.

Obviously, such pixel-based images are not editable in the same way as images constructed from PenPoint's graphics routines. However, you can design PenPoint applications that have an effect similar to editing. It is pos-sible, for example, to simulate document markup with a prestored image by capturing and storing user ink separately and just OR-ing it onto the screen.

Fonts

PenPoint supports a sophisticated font model. But fonts can be extremely memory-intensive, and on a pen-based computer that relies on memory for most of its active storage, the system must find ways around this problem.

ImagePoint: Graphics and Imaging System

PenPoint addresses this problem in two ways. First, it synthesizes some font attributes to save memory. For example, rather than store a bold version of a font, PenPoint's DC defines a flag that the system uses to underline text as if it were a separate font. Second, PenPoint stores fonts as outlines, which are far more memory-efficient than the alternative bitmapped images of the font characters.

Using outline fonts has another distinct advantage. The outlines are easily scalable to any point size, which fits nicely with the fundamental graphics concept in PenPoint that everything is scalable. Because ImagePoint can render fonts in a wide range of point sizes, even PenPoint's system user interface takes advantage of scalable fonts by allowing the user to choose the size of the system-wide PenPoint font.

When a font is specified in a DC, PenPoint will always find the closest pos-sible match to that font. Using font metrics described later in this section, Pen Point interprets your font request and determines which available font comes closest to matching those metrics.

If the system has a bitmapped font of the same name and/or 10 as the font requested, it will use that font. Otherwise, it will examine its outline font library for the best match, transforming and simulating attributes as necessary.

All fonts have standard 16-bit IDs that are registered with GO Corporation and are valid on all PenPoint-based computer systems. Thus, moving applica-tions from one system to another should not result in font display problems.

Table 9-2 summarizes the attributes of a font that describe its appearance in terms that PenPoint can understand in its efforts to match a font specification.

Table 9-2 Font Attributes

Name of the family to which the font belongs (Roman, Old English, and so forth)

Bold, normal, light, extra-bold, and so forth Condensed, normal, or extended

Indication whether or not font is italicized

Note that the size of the character is not a font attribute. In modern typogra-phy it is understood, for example, that Helvetica is a different font from Helvetica Bold or Helvetica Bold Condensed, but 24-point Helvetica and 12-point Helvetica are the same font, with different character sizes.

Font attributes are stored, along with a great deal of other information, in a structure called SYSOC_FONT _SPEC. One of the fields in this structure defines the group to which the font belongs. In PenPoint, a group is a broad categoriza-tion that describes whether the font looks more like newspaper headlines, type set in a book, handwriting, or other basic types of font "looks." If you want to use the system default font, you can define this group as sysOcGroupOefault.

In that case, PenPoint uses the current system font.

Opening a Font

Since, as pointed out in the previous section, all fonts have unique 16-bit identifiers, you might expect that opening a font would be a simple matter of passing that identifier as a parameter in a message to open that font. How-ever, that simplistic approach would ignore the probability that the user of a particular system may never have installed the font in question or may have removed it for some reason. As a result, it is not sufficient simply to supply the 10 of the font; you must also define its font attributes (see Table 9-2).

Once you have set up the font attributes correctly, you can open the font with msgOcOpenFont. PenPoint then uses the font whose 10 you provide, if it has it available. If not, it uses the group to find the font that is closest to your request.

Because PenPoint's font system is flexible in matching font requests and

b~cause PenPoint can synthesize certain font attributes, both users and program-mers are freed from being concerned with font management and determining exactly what fonts are currently loaded. For example, if you load a font that is not italic but specify in its font-attributes setting that it should be italicized, PenPoint will synthetically italicize the font as it opens it. The result is that the programmer should ask for the desired font; PenPoint will do the right thing.

ImagePoint: Graphics and Imaging System

Im Dokument PENPOINT THE POWER OF (Seite 195-198)