--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/SDK/Source/GUID-72986B3C-047C-5411-8F15-BC9C65C3289C.dita Thu Jan 21 18:18:20 2010 +0000
@@ -0,0 +1,78 @@
+<?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 xml:lang="en" id="GUID-72986B3C-047C-5411-8F15-BC9C65C3289C"><title>Using Typefaces </title><prolog><metadata><keywords/></metadata></prolog><conbody><p>Typefaces are stored in the Font Store. Each typeface in the store has an index number. </p> <p>You can examine the contents of the typeface store using functions in <xref href="GUID-B6AB1A2A-705C-3ABA-8BBB-C36F3319501F.dita"><apiname>CGraphicsDevice.</apiname></xref> </p> <p>To find the number of typefaces available: </p> <codeblock id="GUID-DD17B13B-29E0-5584-B85E-639FD2BAB7DF" xml:space="preserve">
+// Find the number of typefaces
+TInt numTypefaces = iCoeEnv->ScreenDevice()->NumTypefaces();</codeblock> <p>You can find out about a type face using the <codeph>TypefaceSupport</codeph> function which returns a <xref href="GUID-39BEE3B2-6A44-33EC-8F93-31E633844086.dita"><apiname>TTypeFaceSupport</apiname></xref>. Each typeface can have a number of sizes or be scalable between a minimum and maximum size. </p> <codeblock id="GUID-B47975BF-3B7A-57B2-854E-1D59166A47A3" xml:space="preserve">
+class TTypefaceSupport
+ {
+public:
+ TTypeface iTypeface ; // The name and attributes of the typeface.
+ TInt iNumHeights; // The number of distinct font heights available in the typeface.
+ TInt iMinHeightInTwips; // The typeface's minimum font height, in twips.
+ TInt iMaxHeightInTwips; // The typeface's maximum font height, in twips.
+ TBool iIsScalable; // ETrue if scalable, otherwise EFalse.
+ };
+
+class TTypeface
+ {
+public:
+ enum
+ {
+ EProportional = 1, // (e.g. Swiss)
+ ESerif = 2, // (e.g. Times )
+ ESymbol = 4, // (e.g. Symbol )
+ };
+public:
+ ...
+ IMPORT_C TBool IsProportional() const;
+ IMPORT_C TBool IsSerif() const;
+ IMPORT_C TBool IsSymbol() const;
+
+ TBufC<KMaxTypefaceNameLength> iName;
+ ....
+ };
+</codeblock> <p>The code below illustrates a simple iteration through the typeface store (see also <xref href="GUID-78FB26E2-AA60-5531-B2FE-4FA6C88F2D47.dita">selecting a font</xref>). </p> <codeblock id="GUID-368C7CBB-254E-5904-A3C5-51BB1FA94931" xml:space="preserve">...
+
+CGraphicsDevice* gDev = iCoeEnv->ScreenDevice() ;
+CWindowGc& gc = SystemGc() ;
+TPoint textPosition ( 0 , 0 ) ; // Start position for drawing text.
+
+// display a list of typefaces - with each in its own typeface
+for ( index = 0 ; index < numTypefaces ; index++ )
+ {
+ // get the next typeface
+ TTypefaceSupport typeface ;
+ gDev->TypefaceSupport( typeface, index ) ;
+ TPtrC fontName = typeface.iTypeface.iName.Des() ;
+
+ // use the typeface to get a font
+ TFontSpec fontSpec( fontName, 300 ) ; // 300 twips font height
+ CFont* font ;
+ gDev->GetNearestFontToMaxHeightInTwips( font , fontSpec ) ;
+
+ // use the font in the graphics context
+ gc.UseFont( font ) ;
+
+ // display the name of the font
+ textPosition.iTL.iY += font.iAscentInPixels ;
+ gc.DrawText( fontName, textPosition ) ; // draw text on baseline
+ textPosition.iTL.iY += ( font.iDescentInPixels + KWhiteSpaceBetweenLines ) ;
+
+ //
+ gc.DiscardFont( font ) ;
+ gDev->ReleaseFont( font ) ;
+
+ }
+...</codeblock> </conbody><related-links><link href="GUID-C1B080D9-9C6C-520B-B73E-4EB344B1FC5E.dita"><linktext>GDI Collection Overview</linktext> </link> <link href="GUID-90644B52-69D7-595C-95E3-D6F7A30C060D.dita"><linktext> Font and Text Services Collection
+ Overview</linktext> </link> <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>
\ No newline at end of file