Symbian3/SDK/Source/GUID-6DF52DDC-B03C-5971-94C8-0E9BAAB949FD.dita
changeset 8 ae94777fff8f
parent 7 51a74ef9ed63
child 13 48780e181b38
--- a/Symbian3/SDK/Source/GUID-6DF52DDC-B03C-5971-94C8-0E9BAAB949FD.dita	Wed Mar 31 11:11:55 2010 +0100
+++ b/Symbian3/SDK/Source/GUID-6DF52DDC-B03C-5971-94C8-0E9BAAB949FD.dita	Fri Jun 11 12:39:03 2010 +0100
@@ -1,41 +1,41 @@
-<?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-6DF52DDC-B03C-5971-94C8-0E9BAAB949FD"><title>Drawing Text</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>This topic provides examples that demonstrate how to draw a line of text and text in a colored box. </p> <section><title>Text</title> <p>The basic way to draw text is to call <codeph>CGraphicsContext::DrawText()</codeph> with a point specifying the bottom left position, as shown below: </p> <fig id="GUID-0FE5E011-9C1D-5F36-AAC2-5F05B023CF84"><image href="GUID-E24F15B4-D767-5B79-B0EB-88294B9BC16A_d0e207084_href.png" placement="inline"/></fig> <p>Before calling, you must use the graphics context to: </p> <ol id="GUID-EA1605BB-1FD6-5E08-9D24-C8DEAB625A96"><li id="GUID-5CB9A7BD-ABFE-550A-BF43-E12BAF72BB27"><p>Set the font to use </p> </li> <li id="GUID-BB8A0DF7-AD80-5718-8646-2B4E8836FFC7"><p>Set the pen color for the text </p> </li> </ol> <codeblock id="GUID-C3E7D82E-CBE6-5131-B6BA-14F341DB331E" xml:space="preserve">// In this example, we use one of the standard font styles
-CFont* fontUsed = iEikonEnv-&gt;TitleFont();
-gc.UseFont(fontUsed);
-    
-gc.SetPenColor(KRgbBlack);
-    
-TPoint pos(50,50);
-_LIT(KExampleText,"blacktext");
-gc.DrawText(KExampleText,pos);</codeblock> </section> <section><title>Text in a box</title> <p>To draw text in a box, you must specify: </p> <ul><li id="GUID-77C31EC3-67D6-5DFD-954D-E4008990E97D"><p>a rectangle to draw the text in </p> </li> <li id="GUID-9F13BCA1-D087-51CE-80D9-9DD908933BDD"><p>an offset from the top of the rectangle to the text baseline: to center the text, add half the height of the rectangle to half the height of the font's ascent </p> </li> <li id="GUID-DCAF0EFD-FD6B-56DA-89FA-05CEB6684F2D"><p>the text alignment mode: in the example, left alignment is used </p> </li> <li id="GUID-431998D7-53E6-5899-B072-89B1DF5C01E8"><p>a margin: the left margin for left-aligned text, or the right margin for right-aligned text </p> </li> </ul> <p>The following figure show how these fit together: </p> <fig id="GUID-2C7ED0E6-3667-56E4-B776-9EF9C085D746"><image href="GUID-F82675C4-C2FD-50E2-BEDA-EB454FF1C57E_d0e207138_href.png" placement="inline"/></fig> <p>In addition to the font and pen color, you can also set the brush for filling the box. </p> <codeblock id="GUID-21B1E44E-AA77-5489-9C57-AEE33519F958" xml:space="preserve">...
-// Draw some text left justified in a box,
-// Offset so text is just inside top of box
-    
-TRect box(20,20,250,100);
-TInt baseline = box.Height() /2 + fontUsed-&gt;FontMaxAscent()/2; 
-    
-TInt margin=10; // left margin is ten pixels
-    
-gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
-gc.SetBrushColor(KRgbDarkGray);
-gc.SetPenColor(KRgbWhite);
-    
-_LIT(KExampleText,"Whitetextleftjustified");
-gc.DrawText(KExampleText,
- box,
- baseline,
- CGraphicsContext::ELeft,
- margin);
-    
-...</codeblock> </section> </conbody><related-links><link href="GUID-55C8C429-1BEC-5A58-94EC-DA1E51F62867.dita"><linktext>Drawing
+<?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-6DF52DDC-B03C-5971-94C8-0E9BAAB949FD"><title>Drawing Text</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>This topic provides examples that demonstrate how to draw a line of text and text in a colored box. </p> <section><title>Text</title> <p>The basic way to draw text is to call <codeph>CGraphicsContext::DrawText()</codeph> with a point specifying the bottom left position, as shown below: </p> <fig id="GUID-0FE5E011-9C1D-5F36-AAC2-5F05B023CF84"><image href="GUID-E24F15B4-D767-5B79-B0EB-88294B9BC16A_d0e202076_href.png" placement="inline"/></fig> <p>Before calling, you must use the graphics context to: </p> <ol id="GUID-EA1605BB-1FD6-5E08-9D24-C8DEAB625A96"><li id="GUID-5CB9A7BD-ABFE-550A-BF43-E12BAF72BB27"><p>Set the font to use </p> </li> <li id="GUID-BB8A0DF7-AD80-5718-8646-2B4E8836FFC7"><p>Set the pen color for the text </p> </li> </ol> <codeblock id="GUID-C3E7D82E-CBE6-5131-B6BA-14F341DB331E" xml:space="preserve">// In this example, we use one of the standard font styles
+CFont* fontUsed = iEikonEnv-&gt;TitleFont();
+gc.UseFont(fontUsed);
+    
+gc.SetPenColor(KRgbBlack);
+    
+TPoint pos(50,50);
+_LIT(KExampleText,"blacktext");
+gc.DrawText(KExampleText,pos);</codeblock> </section> <section><title>Text in a box</title> <p>To draw text in a box, you must specify: </p> <ul><li id="GUID-77C31EC3-67D6-5DFD-954D-E4008990E97D"><p>a rectangle to draw the text in </p> </li> <li id="GUID-9F13BCA1-D087-51CE-80D9-9DD908933BDD"><p>an offset from the top of the rectangle to the text baseline: to center the text, add half the height of the rectangle to half the height of the font's ascent </p> </li> <li id="GUID-DCAF0EFD-FD6B-56DA-89FA-05CEB6684F2D"><p>the text alignment mode: in the example, left alignment is used </p> </li> <li id="GUID-431998D7-53E6-5899-B072-89B1DF5C01E8"><p>a margin: the left margin for left-aligned text, or the right margin for right-aligned text </p> </li> </ul> <p>The following figure show how these fit together: </p> <fig id="GUID-2C7ED0E6-3667-56E4-B776-9EF9C085D746"><image href="GUID-F82675C4-C2FD-50E2-BEDA-EB454FF1C57E_d0e202130_href.png" placement="inline"/></fig> <p>In addition to the font and pen color, you can also set the brush for filling the box. </p> <codeblock id="GUID-21B1E44E-AA77-5489-9C57-AEE33519F958" xml:space="preserve">...
+// Draw some text left justified in a box,
+// Offset so text is just inside top of box
+    
+TRect box(20,20,250,100);
+TInt baseline = box.Height() /2 + fontUsed-&gt;FontMaxAscent()/2; 
+    
+TInt margin=10; // left margin is ten pixels
+    
+gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
+gc.SetBrushColor(KRgbDarkGray);
+gc.SetPenColor(KRgbWhite);
+    
+_LIT(KExampleText,"Whitetextleftjustified");
+gc.DrawText(KExampleText,
+ box,
+ baseline,
+ CGraphicsContext::ELeft,
+ margin);
+    
+...</codeblock> </section> </conbody><related-links><link href="GUID-55C8C429-1BEC-5A58-94EC-DA1E51F62867.dita"><linktext>Drawing
                 to a Graphics Context Tutorials</linktext> </link> <link href="GUID-E3AC8F3E-9D5C-5E7D-9760-023B77C7C8A8.dita"><linktext>Drawing and Graphics Contexts</linktext> </link> </related-links></concept>
\ No newline at end of file