×
Namespaces

Variants
Actions
Revision as of 08:52, 27 September 2012 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Symbian: playing with fonts

From Nokia Developer 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 08:52.
37 page views in the last 30 days.
×