Symbian3/SDK/Source/GUID-90644B52-69D7-595C-95E3-D6F7A30C060D.dita
changeset 7 51a74ef9ed63
child 8 ae94777fff8f
equal deleted inserted replaced
6:43e37759235e 7:51a74ef9ed63
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-90644B52-69D7-595C-95E3-D6F7A30C060D" xml:lang="en"><title>Font
       
    13 and Text Services Collection Overview</title><shortdesc>A font is a set of characters of matching size (height) and appearance.
       
    14 In order to be displayed each character must ultimately be drawn as a series
       
    15 of pixels (a bitmap). Symbian can store fonts in bitmap or vector form. A
       
    16 vector font (for example, an OpenType font) must be converted to bitmaps (or
       
    17 rasterized) before it can be drawn. Symbian caches and shares bitmaps for
       
    18 performance and memory efficiency. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    19 <ul>
       
    20 <li id="GUID-DB17AE5F-54E9-5288-89DB-7A38473D9C94"><p> <b>Application developers</b> can
       
    21 use Font and Text Services for selecting fonts for displaying text according
       
    22 to various criteria (size and typeface). </p> </li>
       
    23 <li id="GUID-ECFA8635-D278-5A1F-A8E8-8BADB73FE092"><p> <b> Device creators</b> can
       
    24 add fonts and font rasterizers. Fonts can be included in the ROM or installed
       
    25 on user drives. </p> </li>
       
    26 </ul>
       
    27 <section id="GUID-9F33DD34-F5E5-5EA0-8559-7A933D230129"><title>Concepts and
       
    28 terms</title> <dl>
       
    29 <dlentry>
       
    30 <dt>Points, twips and pixels</dt>
       
    31 <dd><p>Points (1/72th inch) and twips (a twentieth of a point) are absolute
       
    32 measurements of distance and specify device-independent size. Pixel sizes
       
    33 are only relevant for a specific graphics device. Each graphics device (screen
       
    34 or printer) must provide a mechanism for converting between pixels and twips. </p> </dd>
       
    35 </dlentry>
       
    36 <dlentry>
       
    37 <dt>Font</dt>
       
    38 <dd><p>A named set of characters of matching size (height) and <b>font style</b> (normal,
       
    39 bold, italic, underline). <b>Times Roman 14 point bold</b> is an example of
       
    40 a font. </p> </dd>
       
    41 </dlentry>
       
    42 <dlentry>
       
    43 <dt>Typeface</dt>
       
    44 <dd><p>A group of fonts with similar appearance. The typeface does not include
       
    45 the size or font style. <b>Times</b> is an example of a typeface. Typefaces
       
    46 are sometimes referred to as <b>font families</b>. </p> <p>Typefaces are grouped
       
    47 generically as mono-spaced, variable width, serif, sans-serif and symbol.
       
    48 This allows the grouping of typefaces that have similar characteristics, so
       
    49 that an alternative font can be selected when an exact match is not found.
       
    50 This means that applications can display text relatively accurately when a
       
    51 specific font is not available. </p> </dd>
       
    52 </dlentry>
       
    53 <dlentry>
       
    54 <dt>OpenType font </dt>
       
    55 <dd><p>A font that is stored as vector data, which can be rasterized to any
       
    56 pixel size. OpenType fonts are sometimes simply called <b>open fonts</b>.
       
    57 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
       
    58 rasterized fonts into bitmap form. </p> <p>OpenType is an open source vector
       
    59 font format, which is similar to TrueType. Like TrueType fonts, OpenType fonts
       
    60 can contain font hinting information. However the font rasterizer's use of
       
    61 the font hinting information in OpenType fonts is restricted by a software
       
    62 patent. </p> </dd>
       
    63 </dlentry>
       
    64 <dlentry>
       
    65 <dt>Character</dt>
       
    66 <dd><p>A single element (such as a letter, number, ligature, symbol or punctuation
       
    67 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>
       
    68 </dlentry>
       
    69 <dlentry>
       
    70 <dt>Glyph</dt>
       
    71 <dd><p>A graphical representation of a character in a specific font. The mapping
       
    72 between a character and a glyph is not always direct. For example, a character
       
    73 may be represented by different glyphs, depending on the context. </p> </dd>
       
    74 </dlentry>
       
    75 <dlentry>
       
    76 <dt>Font metrics</dt>
       
    77 <dd><p>Measurements (such as maximum height) that are common to all of the
       
    78 characters in a font. </p> </dd>
       
    79 </dlentry>
       
    80 <dlentry>
       
    81 <dt>Character metrics</dt>
       
    82 <dd><p>Measurements (such as character width) that apply to an individual
       
    83 character within a font. </p> </dd>
       
    84 </dlentry>
       
    85 <dlentry>
       
    86 <dt>Bitmap font</dt>
       
    87 <dd><p>A font stored as bitmap glyphs. The size of a font is described in
       
    88 pixels. However, the actual size is dependent on the pixel size of the graphics
       
    89 device. </p> </dd>
       
    90 </dlentry>
       
    91 <dlentry>
       
    92 <dt>Rasterizing</dt>
       
    93 <dd><p>The process of converting drawing instructions into bitmap data. Fonts
       
    94 provided in vector form (OpenType fonts) must be rasterized into fixed size
       
    95 fonts before they can be used. </p> </dd>
       
    96 </dlentry>
       
    97 <dlentry>
       
    98 <dt>Linked font</dt>
       
    99 <dd><p>A virtual font or typeface created from characters from other fonts.
       
   100 The component fonts must be open fonts or other linked fonts. Linked fonts
       
   101 are typically used where a preferred font does not contain all of the characters
       
   102 in the character set. One of the typefaces in a linked font must be designated
       
   103 as the principal typeface from which any unspecified default metrics or characters
       
   104 are used. </p> </dd>
       
   105 </dlentry>
       
   106 <dlentry>
       
   107 <dt>Contextual shaping</dt>
       
   108 <dd><p>In some scripts some characters are drawn differently depending on
       
   109 the adjacent characters. This means that different glyphs are used to represent
       
   110 a particular character in different contexts. Contextual shaping is the selection
       
   111 of the appropriate glyph from several glyphs that represent a particular character
       
   112 depending on the context. </p> <p>In Latin scripts, contextual shaping is
       
   113 normally used only when simulating handwriting. For example, the glyph used
       
   114 for the letter <b>p</b> might depend on whether the letter is at the start,
       
   115 middle or end of a word, as shown in the following diagram. For example, when
       
   116 it is in the middle of the word, it might have a "tail" on both sides to join
       
   117 it to the letters that appear before and after. </p> <fig id="GUID-30A9DA99-E1C5-5EE5-AEB3-0BCD6DB0A692">
       
   118 <title>                   Figure 1: Handwriting simulation might use different
       
   119 glyphs for                   the letter p depending on its position in a word
       
   120                  </title>
       
   121 <image href="GUID-8F19C257-9A41-5D38-BC8A-285D0EB16E1B_d0e402675_href.png" placement="inline"/>
       
   122 </fig> <p>Contextual shaping is an essential feature of some scripts, including
       
   123 Arabic and many Indian and East Asian scripts, such as Devanagari, Kannada,
       
   124 Telugu, Tamil, Bengali, Malayalam and Gurmukhi. For this reason, support for
       
   125 contextual shaping is sometimes referred to as <b>Brahmic support</b>. </p> </dd>
       
   126 </dlentry>
       
   127 <dlentry>
       
   128 <dt>Text shaper</dt>
       
   129 <dd><p>A plug-in that performs the contextual shaping for scripts that require
       
   130 this feature. Text shapers are font and language specific. </p> </dd>
       
   131 </dlentry>
       
   132 <dlentry>
       
   133 <dt>System font</dt>
       
   134 <dd><p>A default font that is used when no font is specified. </p> </dd>
       
   135 </dlentry>
       
   136 </dl> </section>
       
   137 <section><title>Architectural relationships</title> <p>The Font and Text Services
       
   138 components are closely integrated with the Font and Bitmap Server, GDI, BitGDI
       
   139 and Window Server components in the <xref href="GUID-975CBC70-81E6-5FA2-80CE-88DD2ABE9595.dita">Graphics
       
   140 package</xref>. Font size is only meaningful in the context of the current
       
   141 graphics device and its pixel size. Open fonts must be rasterized in the context
       
   142 of the current graphics device. The diagram below shows how BitGDI implements
       
   143 Graphics Devices and Contexts. </p> <fig id="GUID-36165480-E5BC-50F3-B205-5668EA7F0306">
       
   144 <title>              Figure 2: The Graphics Device and Context Architecture.
       
   145            </title>
       
   146 <desc><p>Note that the names of the BitGDI classes begin with <codeph>CFbs</codeph>. </p> </desc>
       
   147 <image href="GUID-9D6D07D3-A93C-5290-AC08-15750AD34802_d0e402733_href.png" placement="inline"/>
       
   148 </fig> <p>Applications access font services through the <xref href="GUID-71DADA82-3ABC-52D2-8360-33FAEB2E5DE9.dita">Font
       
   149 and Bitmap Server (FBSERV)</xref> which caches font bitmaps in a shared heap.
       
   150 The Font and Bitmap Server ensures that there is only ever a single instance
       
   151 of a particular glyph bitmap in memory. However, eXecute In Place (XIP) ROM-based
       
   152 bitmaps (including fonts) are used in place and are not copied into the heap. </p> <p>Use
       
   153 of the Font and Bitmap Server is transparent to clients of the Window Server.
       
   154 The Window Server client session (<xref href="GUID-643DDA78-C7A7-386D-AB3F-8710141DDDA9.dita"><apiname>RWsSession</apiname></xref>) automatically
       
   155 creates an <xref href="GUID-E5B29AC0-4953-385F-84C5-13EE6CB77D46.dita"><apiname>RFbsSession</apiname></xref> and stores it in thread local storage
       
   156 (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
       
   157 Server are therefore automatically clients of the Font and Bitmap Server and
       
   158 need perform no explicit session management. </p> <p>Classes representing
       
   159 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
       
   160 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
       
   161 the <xref href="GUID-71DADA82-3ABC-52D2-8360-33FAEB2E5DE9.dita">Font and Bitmap
       
   162 Server</xref> and contains all of the fonts on the device and the font rasterizers
       
   163 required to render them. The Font Store loads font files when the phone starts
       
   164 up. It scans all of the drives on the device so that new fonts can be installed
       
   165 from user drives. Font files can be loaded by the Font Store while the phone
       
   166 is running. However, font rasterizers can only be installed by restarting
       
   167 the phone. If a new font requires a font rasterizer to be installed, the phone
       
   168 must be restarted before the font can be used. </p> <p>Open font rasterizers
       
   169 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>)
       
   170 can contain one or more open fonts in proprietary vector format. A corresponding
       
   171 font rasterizer plug-in (<xref href="GUID-CA16238D-478A-302A-9671-97B62B0E738A.dita"><apiname>COpenFontRasterizer</apiname></xref>) must convert
       
   172 the vector data into bitmaps that the Font and Bitmap Server can cache and
       
   173 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.
       
   174 Applications use rasterized open fonts by using <xref href="GUID-DE966D8B-6E00-39B6-B136-6CF29EA384D3.dita"><apiname>CFbsFont</apiname></xref> in
       
   175 exactly the same way as native bitmap fonts. The open font framework means
       
   176 that Symbian can support any font in any format. There is a performance impact
       
   177 associated with open fonts, however, as they must be rasterized. </p> <p>Text
       
   178 shapers (<xref href="GUID-FF3DFCCC-DCFE-3DD9-B497-B96C46B4FDD1.dita"><apiname>CShaper</apiname></xref>) are used for contextual scripts, which
       
   179 require their glyphs to be modified according to the adjacent characters.
       
   180 Text shapers are font and language specific. </p> </section>
       
   181 <section><title>Components</title> <p>The Font and Text Services collection
       
   182 is made up of the following components: </p> <ul>
       
   183 <li id="GUID-0C4363B1-4340-5638-8A59-ECDF2AFFA088"><p><xref href="GUID-B798C19D-4030-564A-A208-D84738259D72.dita">Font
       
   184 Store</xref>. This manages font matching, ownership and rasterizing. </p> </li>
       
   185 <li id="GUID-AAE1BCA4-B9B4-5AD1-AC79-3308F231FCE7"><p> <xref href="GUID-75C5A614-CEC1-5832-ACEA-E3C31B8A0DE8.dita">FreeType
       
   186 Font Rasterizer</xref>. This open source plug-in rasterizes OpenType fonts.
       
   187 More information can be found at <xref href="http://www.freetype.org/" scope="external">www.freetype.org</xref>.
       
   188 This rasterizer is normally loaded by default. </p> </li>
       
   189 <li id="GUID-7EB97752-0F44-5625-8474-FDCF64654AE6"><p><xref href="GUID-DB453F9B-55B6-50C7-984D-7154F1E84AE6.dita">ICU
       
   190 Layout Engine Component</xref>. A plug-in that performs contextual shaping
       
   191 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
       
   192 text in one of these scripts, internally a text shaper is used to convert
       
   193 the string of characters into the appropriate series of glyphs. </p> </li>
       
   194 <li id="GUID-DED869DB-C45B-51A6-B594-BA1321BC272B"><p><xref href="GUID-F4C53728-B54B-5680-82FC-9A365B45F4B5.dita">Reference
       
   195 Fonts</xref>. This provides a collection of reference font files including
       
   196 bitmap and OpenType fonts. By default the Symbian platform supports the DejaVu
       
   197 OpenType typeface (which includes variable-width, monospaced, serif and sans
       
   198 serif fonts) and legacy Calculator and Agenda symbols (which are bitmap fonts). </p> </li>
       
   199 </ul> <p> <i>Note</i>: The <xref href="GUID-771AC6EC-348D-5535-9D91-5A0232BB9576.dita"> iType
       
   200 Font Rasterizer</xref> is an OpenType font rasterizer from MonoType ImagingĀ®.
       
   201 This provides additional features compared to the FreeType font rasterizer,
       
   202 such as four color blending, which is required for outline and shadow fonts.
       
   203 This component is not provided by the Symbian Foundation because it belongs
       
   204 to Monotype. However, the Symbian platform has test cases for the four color
       
   205 blending that the iType Font Rasterizer provides. These test cases can be
       
   206 used by device creators who obtain this font rasterizer from MonoType. </p> </section>
       
   207 </conbody><related-links>
       
   208 <link href="GUID-71DADA82-3ABC-52D2-8360-33FAEB2E5DE9.dita"><linktext>Font and
       
   209 Bitmap Server Component Overview </linktext></link>
       
   210 <link href="GUID-416A3756-B5D5-5BCD-830E-2371C5F6B502.dita"><linktext> Font Store
       
   211 Component Overview</linktext></link>
       
   212 </related-links></concept>