Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Symbian: playing with fonts

From Wiki
Jump to: navigation, search

This code snipped shows how to draw text using Symbian C++.

Needs-update.pngThis article needs to be updated: If you found this article useful, please fix the problems below then delete the {{ArticleNeedsUpdate}} template from the article to remove this warning.

Reasons: hamishwillee (27 Sep 2012)
The article has no explanation or links to official documentation. It should be extended minimally to link to reference documentation for Symbian C++ and also have a brief explanation of the code.

Article Metadata
Article
Created: imi.imran (06 Apr 2010)
Last edited: hamishwillee (27 Sep 2012)
LIBRARY: gdi.lib

Headers:

#include <COEFONT.H>
#include <COEFONTPROVIDER.H>

Code

void CTestAppContainer::Draw(const TRect& /*aRect*/) const
{
// Get the standard graphics context
CWindowGc& gc = SystemGc();
 
// Gets the control's extent
TRect drawRect(Rect());
 
// Clears the screen
gc.Clear(drawRect);
 
 
const CCoeFontProvider& fontProvider = FindFontProvider();
 
TCoeFont TFont15(15,TCoeFont::EBold,0);
const CFont& boldFont = fontProvider.Font(TFont15,AccumulatedZoom());
 
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
gc.SetPenStyle(CGraphicsContext::ESolidPen);
gc.SetBrushColor(KRgbDarkGreen);
gc.SetPenColor(KRgbDarkGreen);
 
gc.UseFont(&boldFont);
gc.DrawText(_L("Test Font"),TPoint(100,100));
gc.DiscardFont();
}
This page was last modified on 27 September 2012, at 05:52.
38 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×