03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

.mbms can be built into ROM in a format corresponding to bitmap layout of the Symbian OS<br />

device's normal screen mode – this makes blitting from them particularly efficient. Bitmaps<br />

delivered with non-ROM components can be built into a compressed<br />

.mbm file from which bitmaps are loaded into the FBS's shared heap as needed, before<br />

being blitted elsewhere. Offscreen bitmaps may be allocated by applications: they reside in<br />

the FBS's shared heap.<br />

15.2.2 More on Fonts<br />

Symbian OS can use both bitmap fonts, for which character bitmaps at various sizes are<br />

stored and scalable fonts, for which algorithms to draw characters are stored. Bitmap fonts<br />

are stored in a preset range of sizes; for other sizes they can be algorithmically scaled, but<br />

the quality is unlikely to be good. Scalable fonts, however, as the name implies, can produce<br />

any size to be produced with equal quality.<br />

For Western locales, scalable fonts are clearly useful, but for Far Eastern they are the<br />

difference between night and day, since the font information for even a single point size is<br />

enormous. By using scalable font technology, information is only needed for one size. Other<br />

sizes and rasterization for printers, can be handled by the scalable font system.<br />

A number of systems for scalable fonts have been invented, well- known instances being<br />

Apple's TrueType, and the open-source FreeType. Symbian OS has a framework called the<br />

Open Font System, that allows rasterizer plug-ins DLLs to be supplied that support particular<br />

systems. Such a plug-in recognizes and reads font files stored in a particular format, and<br />

generates character bitmaps, which are then handled exactly as bitmap fonts.<br />

However, scalable fonts are not always required. For example, the P800 uses only a small<br />

and fixed number of bitmap fonts. This is because it has no application requirement for a<br />

large set of fonts, such as a word processor. All applications will generally know which<br />

font/size they require for any specific widget. As such fonts 'could be' requested by UID<br />

rather than a device-independent TFontSpec specification. This is an optimization issue.<br />

If using TFontSpecs, whether a font originated as a bitmap, or from a scalable font<br />

rasterizer, is transparent to clients. The same method that we have already seen is always<br />

used:<br />

� You use a TFontSpec (and its supporting classes) to specify a font in a deviceindependent<br />

way.<br />

� You use an MGraphicsDeviceMap, which ultimately leads to a CGraphicsDevice,<br />

to get a device-dependent font, using GetN-earestFontInTwips() and the<br />

TFontSpec.<br />

You can find out what fonts are available on a device through its typeface store,<br />

implemented by CTypefaceStore. You can ask how many typefaces there are, iterate<br />

through them all, and get their properties. The FontsShell example in the SDK<br />

(\examples\graphics\ fonts\FontsShell.mmp) does exactly this.<br />

Fonts for the screen (and offscreen bitmaps) are managed by the font and bitmap server<br />

(FBS). When you allocate a font, using GetNearestFont...() or similar functions, it<br />

creates a small client-side CFont* for the device, and also ensures that the bitmaps for the<br />

font are available for blitting to the screen (or offscreen bitmap). For built-in bitmap fonts, the<br />

font bitmaps can be in ROM, in which case the CFont* acts as a handle to the memory<br />

address. Getting a font is a low-cost operation for such fonts. Alternatively, fonts that are<br />

installed or generated are loaded into RAM and made accessible so that all programs can

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!