Symbian3/SDK/Source/GUID-90644B52-69D7-595C-95E3-D6F7A30C060D.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 11 Jun 2010 12:39:03 +0100
changeset 8 ae94777fff8f
parent 7 51a74ef9ed63
child 13 48780e181b38
permissions -rw-r--r--
Week 23 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 2714, Bug 462.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-90644B52-69D7-595C-95E3-D6F7A30C060D" xml:lang="en"><title>Font
and Text Services Collection Overview</title><shortdesc>A font is a set of characters of matching size (height) and appearance.
In order to be displayed each character must ultimately be drawn as a series
of pixels (a bitmap). Symbian can store fonts in bitmap or vector form. A
vector font (for example, an OpenType font) must be converted to bitmaps (or
rasterized) before it can be drawn. Symbian caches and shares bitmaps for
performance and memory efficiency. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<ul>
<li id="GUID-DB17AE5F-54E9-5288-89DB-7A38473D9C94"><p> <b>Application developers</b> can
use Font and Text Services for selecting fonts for displaying text according
to various criteria (size and typeface). </p> </li>
<li id="GUID-ECFA8635-D278-5A1F-A8E8-8BADB73FE092"><p> <b> Device creators</b> can
add fonts and font rasterizers. Fonts can be included in the ROM or installed
on user drives. </p> </li>
</ul>
<section id="GUID-9F33DD34-F5E5-5EA0-8559-7A933D230129"><title>Concepts and
terms</title> <dl>
<dlentry>
<dt>Points, twips and pixels</dt>
<dd><p>Points (1/72th inch) and twips (a twentieth of a point) are absolute
measurements of distance and specify device-independent size. Pixel sizes
are only relevant for a specific graphics device. Each graphics device (screen
or printer) must provide a mechanism for converting between pixels and twips. </p> </dd>
</dlentry>
<dlentry>
<dt>Font</dt>
<dd><p>A named set of characters of matching size (height) and <b>font style</b> (normal,
bold, italic, underline). <b>Times Roman 14 point bold</b> is an example of
a font. </p> </dd>
</dlentry>
<dlentry>
<dt>Typeface</dt>
<dd><p>A group of fonts with similar appearance. The typeface does not include
the size or font style. <b>Times</b> is an example of a typeface. Typefaces
are sometimes referred to as <b>font families</b>. </p> <p>Typefaces are grouped
generically as mono-spaced, variable width, serif, sans-serif and symbol.
This allows the grouping of typefaces that have similar characteristics, so
that an alternative font can be selected when an exact match is not found.
This means that applications can display text relatively accurately when a
specific font is not available. </p> </dd>
</dlentry>
<dlentry>
<dt>OpenType font </dt>
<dd><p>A font that is stored as vector data, which can be rasterized to any
pixel size. OpenType fonts are sometimes simply called <b>open fonts</b>.
An open font can only be used with a corresponding font rasterizer. The <xref href="GUID-A03FB1BF-F67B-519D-A904-74CA3F8375D9.dita">Font and Bitmap Server</xref> caches
rasterized fonts into bitmap form. </p> <p>OpenType is an open source vector
font format, which is similar to TrueType. Like TrueType fonts, OpenType fonts
can contain font hinting information. However the font rasterizer's use of
the font hinting information in OpenType fonts is restricted by a software
patent. </p> </dd>
</dlentry>
<dlentry>
<dt>Character</dt>
<dd><p>A single element (such as a letter, number, ligature, symbol or punctuation
mark) of written language. Each character has a unique number (its <xref href="http://www.unicode.org/standard/WhatIsUnicode.html" scope="external">Unicode</xref> code point). </p> </dd>
</dlentry>
<dlentry>
<dt>Glyph</dt>
<dd><p>A graphical representation of a character in a specific font. The mapping
between a character and a glyph is not always direct. For example, a character
may be represented by different glyphs, depending on the context. </p> </dd>
</dlentry>
<dlentry>
<dt>Font metrics</dt>
<dd><p>Measurements (such as maximum height) that are common to all of the
characters in a font. </p> </dd>
</dlentry>
<dlentry>
<dt>Character metrics</dt>
<dd><p>Measurements (such as character width) that apply to an individual
character within a font. </p> </dd>
</dlentry>
<dlentry>
<dt>Bitmap font</dt>
<dd><p>A font stored as bitmap glyphs. The size of a font is described in
pixels. However, the actual size is dependent on the pixel size of the graphics
device. </p> </dd>
</dlentry>
<dlentry>
<dt>Rasterizing</dt>
<dd><p>The process of converting drawing instructions into bitmap data. Fonts
provided in vector form (OpenType fonts) must be rasterized into fixed size
fonts before they can be used. </p> </dd>
</dlentry>
<dlentry>
<dt>Linked font</dt>
<dd><p>A virtual font or typeface created from characters from other fonts.
The component fonts must be open fonts or other linked fonts. Linked fonts
are typically used where a preferred font does not contain all of the characters
in the character set. One of the typefaces in a linked font must be designated
as the principal typeface from which any unspecified default metrics or characters
are used. </p> </dd>
</dlentry>
<dlentry>
<dt>Contextual shaping</dt>
<dd><p>In some scripts some characters are drawn differently depending on
the adjacent characters. This means that different glyphs are used to represent
a particular character in different contexts. Contextual shaping is the selection
of the appropriate glyph from several glyphs that represent a particular character
depending on the context. </p> <p>In Latin scripts, contextual shaping is
normally used only when simulating handwriting. For example, the glyph used
for the letter <b>p</b> might depend on whether the letter is at the start,
middle or end of a word, as shown in the following diagram. For example, when
it is in the middle of the word, it might have a "tail" on both sides to join
it to the letters that appear before and after. </p> <fig id="GUID-30A9DA99-E1C5-5EE5-AEB3-0BCD6DB0A692">
<title>                   Figure 1: Handwriting simulation might use different
glyphs for                   the letter p depending on its position in a word
                 </title>
<image href="GUID-8F19C257-9A41-5D38-BC8A-285D0EB16E1B_d0e402513_href.png" placement="inline"/>
</fig> <p>Contextual shaping is an essential feature of some scripts, including
Arabic and many Indian and East Asian scripts, such as Devanagari, Kannada,
Telugu, Tamil, Bengali, Malayalam and Gurmukhi. For this reason, support for
contextual shaping is sometimes referred to as <b>Brahmic support</b>. </p> </dd>
</dlentry>
<dlentry>
<dt>Text shaper</dt>
<dd><p>A plug-in that performs the contextual shaping for scripts that require
this feature. Text shapers are font and language specific. </p> </dd>
</dlentry>
<dlentry>
<dt>System font</dt>
<dd><p>A default font that is used when no font is specified. </p> </dd>
</dlentry>
</dl> </section>
<section><title>Architectural relationships</title> <p>The Font and Text Services
components are closely integrated with the Font and Bitmap Server, GDI, BitGDI
and Window Server components in the <xref href="GUID-975CBC70-81E6-5FA2-80CE-88DD2ABE9595.dita">Graphics
package</xref>. Font size is only meaningful in the context of the current
graphics device and its pixel size. Open fonts must be rasterized in the context
of the current graphics device. The diagram below shows how BitGDI implements
Graphics Devices and Contexts. </p> <fig id="GUID-36165480-E5BC-50F3-B205-5668EA7F0306">
<title>              Figure 2: The Graphics Device and Context Architecture.
           </title>
<desc><p>Note that the names of the BitGDI classes begin with <codeph>CFbs</codeph>. </p> </desc>
<image href="GUID-9D6D07D3-A93C-5290-AC08-15750AD34802_d0e402571_href.png" placement="inline"/>
</fig> <p>Applications access font services through the <xref href="GUID-71DADA82-3ABC-52D2-8360-33FAEB2E5DE9.dita">Font
and Bitmap Server (FBSERV)</xref> which caches font bitmaps in a shared heap.
The Font and Bitmap Server ensures that there is only ever a single instance
of a particular glyph bitmap in memory. However, eXecute In Place (XIP) ROM-based
bitmaps (including fonts) are used in place and are not copied into the heap. </p> <p>Use
of the Font and Bitmap Server is transparent to clients of the Window Server.
The Window Server client session (<xref href="GUID-643DDA78-C7A7-386D-AB3F-8710141DDDA9.dita"><apiname>RWsSession</apiname></xref>) automatically
creates an <xref href="GUID-E5B29AC0-4953-385F-84C5-13EE6CB77D46.dita"><apiname>RFbsSession</apiname></xref> and stores it in thread local storage
(TLS). The Font and Bitmap Server provides two client-side classes for fonts: <xref href="GUID-DE966D8B-6E00-39B6-B136-6CF29EA384D3.dita"><apiname>CFbsFont</apiname></xref> and <xref href="GUID-5E287BF6-08C1-36A2-9085-F6B61CC52550.dita"><apiname>CFbsTypefaceStore</apiname></xref>. These find and use the session in TLS automatically. Clients of the Window
Server are therefore automatically clients of the Font and Bitmap Server and
need perform no explicit session management. </p> <p>Classes representing
fonts, such as <xref href="GUID-DE966D8B-6E00-39B6-B136-6CF29EA384D3.dita"><apiname>CFbsFont</apiname></xref> (on the client side) and <xref href="GUID-25D4B920-6158-3014-8E7D-4E1C5267C5EF.dita"><apiname>CBitmapFont</apiname></xref> (on
the server side), are derived from the abstract class <xref href="GUID-2A12FE3B-47F2-3016-8161-A971CA506491.dita"><apiname>CFont</apiname></xref>. </p> <p>The <xref href="GUID-B798C19D-4030-564A-A208-D84738259D72.dita">Font Store</xref> lives in
the <xref href="GUID-71DADA82-3ABC-52D2-8360-33FAEB2E5DE9.dita">Font and Bitmap
Server</xref> and contains all of the fonts on the device and the font rasterizers
required to render them. The Font Store loads font files when the phone starts
up. It scans all of the drives on the device so that new fonts can be installed
from user drives. Font files can be loaded by the Font Store while the phone
is running. However, font rasterizers can only be installed by restarting
the phone. If a new font requires a font rasterizer to be installed, the phone
must be restarted before the font can be used. </p> <p>Open font rasterizers
are implemented as ECOM plug-ins. An open font file (represented by <xref href="GUID-FC62EDD7-A3F7-3611-A899-CA5F17BB2EEE.dita"><apiname>COpenFontFile</apiname></xref>)
can contain one or more open fonts in proprietary vector format. A corresponding
font rasterizer plug-in (<xref href="GUID-CA16238D-478A-302A-9671-97B62B0E738A.dita"><apiname>COpenFontRasterizer</apiname></xref>) must convert
the vector data into bitmaps that the Font and Bitmap Server can cache and
access using the <xref href="GUID-25D4B920-6158-3014-8E7D-4E1C5267C5EF.dita"><apiname>CBitmapFont</apiname></xref> and <xref href="GUID-039375D3-AFD9-3E31-9C1C-ACEDC10E27CE.dita"><apiname>COpenFont</apiname></xref> APIs.
Applications use rasterized open fonts by using <xref href="GUID-DE966D8B-6E00-39B6-B136-6CF29EA384D3.dita"><apiname>CFbsFont</apiname></xref> in
exactly the same way as native bitmap fonts. The open font framework means
that Symbian can support any font in any format. There is a performance impact
associated with open fonts, however, as they must be rasterized. </p> <p>Text
shapers (<xref href="GUID-FF3DFCCC-DCFE-3DD9-B497-B96C46B4FDD1.dita"><apiname>CShaper</apiname></xref>) are used for contextual scripts, which
require their glyphs to be modified according to the adjacent characters.
Text shapers are font and language specific. </p> </section>
<section><title>Components</title> <p>The Font and Text Services collection
is made up of the following components: </p> <ul>
<li id="GUID-0C4363B1-4340-5638-8A59-ECDF2AFFA088"><p><xref href="GUID-B798C19D-4030-564A-A208-D84738259D72.dita">Font
Store</xref>. This manages font matching, ownership and rasterizing. </p> </li>
<li id="GUID-AAE1BCA4-B9B4-5AD1-AC79-3308F231FCE7"><p> <xref href="GUID-75C5A614-CEC1-5832-ACEA-E3C31B8A0DE8.dita">FreeType
Font Rasterizer</xref>. This open source plug-in rasterizes OpenType fonts.
More information can be found at <xref href="http://www.freetype.org/" scope="external">www.freetype.org</xref>.
This rasterizer is normally loaded by default. </p> </li>
<li id="GUID-7EB97752-0F44-5625-8474-FDCF64654AE6"><p><xref href="GUID-DB453F9B-55B6-50C7-984D-7154F1E84AE6.dita">ICU
Layout Engine Component</xref>. A plug-in that performs contextual shaping
for specific scripts that require this feature. When a function, such as <xref href="GUID-4A501086-7EFF-376D-8901-6D9B2EB4EFF2.dita#GUID-4A501086-7EFF-376D-8901-6D9B2EB4EFF2/GUID-176B0A61-867E-35A6-AE53-0BABA48741D9"><apiname>CFbsBitGc::DrawText()</apiname></xref> draws
text in one of these scripts, internally a text shaper is used to convert
the string of characters into the appropriate series of glyphs. </p> </li>
<li id="GUID-DED869DB-C45B-51A6-B594-BA1321BC272B"><p><xref href="GUID-F4C53728-B54B-5680-82FC-9A365B45F4B5.dita">Reference
Fonts</xref>. This provides a collection of reference font files including
bitmap and OpenType fonts. By default the Symbian platform supports the DejaVu
OpenType typeface (which includes variable-width, monospaced, serif and sans
serif fonts) and legacy Calculator and Agenda symbols (which are bitmap fonts). </p> </li>
</ul> <p> <i>Note</i>: The <xref href="GUID-771AC6EC-348D-5535-9D91-5A0232BB9576.dita"> iType
Font Rasterizer</xref> is an OpenType font rasterizer from MonoType ImagingĀ®.
This provides additional features compared to the FreeType font rasterizer,
such as four color blending, which is required for outline and shadow fonts.
This component is not provided by the Symbian Foundation because it belongs
to Monotype. However, the Symbian platform has test cases for the four color
blending that the iType Font Rasterizer provides. These test cases can be
used by device creators who obtain this font rasterizer from MonoType. </p> </section>
</conbody><related-links>
<link href="GUID-71DADA82-3ABC-52D2-8360-33FAEB2E5DE9.dita"><linktext>Font and
Bitmap Server Component Overview </linktext></link>
<link href="GUID-416A3756-B5D5-5BCD-830E-2371C5F6B502.dita"><linktext> Font Store
Component Overview</linktext></link>
</related-links></concept>