Example #1
0
void CWindow::ConstructL(const TRect& aRect, const TRgb& aColor,
        CWindow* aParent)
    {
    _LIT(KFontName,"Swiss");
    // If a parent window was specified, use it; if not, use the window group
    // (aParent defaults to 0).
    RWindowTreeNode* parent =
            aParent
                    ? (RWindowTreeNode*) &(aParent->Window())
                       : &(iClient->iGroup);
    // Allocate and construct the window
    iWindow = RWindow(iClient->iWs);
    User::LeaveIfError(iWindow.Construct(*parent, (TUint32) this));
    // Store the window's extent
    iRect = aRect;
    // Set up the new window's extent
    iWindow.SetExtent(iRect.iTl, iRect.Size());
    // Set its background color
    iWindow.SetBackgroundColor(aColor);
    // Set up font for displaying text
    TFontSpec fontSpec(KFontName, 200);
    User::LeaveIfError(iClient->iScreen->GetNearestFontInTwips(iFont,
            fontSpec));
    // Activate the window
    iWindow.Activate();
    }
Example #2
0
void CBackedUpWindow::ConstructL (const TRect& aRect, CWindow* aParent)
	{
	_LIT(KFontName,"Swiss");
	// If a parent window was specified, use it; if not, use the window group
	// (aParent defaults to 0).
	RWindowTreeNode* parent= aParent ? (RWindowTreeNode*) &(aParent->Window()) : &(iClient->iGroup);
	// Allocate and construct the window
	iWindow=RBackedUpWindow(iClient->iWs);
	User::LeaveIfError(iWindow.Construct(*parent, EGray4, (TUint32)this));
	// Store the window's extent
	iRect = aRect;
	// Set up the new window's extent
	User::LeaveIfError(iWindow.SetExtentErr(iRect.iTl, iRect.Size()));
	// Set its background color
	iWindow.AllocPointerMoveBuffer(KPointerMoveBufferSize, 0);
	iWindow.DisablePointerMoveBuffer();
	iWindow.PointerFilter(EPointerFilterDrag, 0);
	// Set pointer grab to enable drag and drop
	iWindow.SetPointerGrab (ETrue);
	// Set up font for displaying text
	TFontSpec fontSpec(KFontName,200);
	User::LeaveIfError(iClient->iScreen->GetNearestFontInTwips(iFont,fontSpec));
	// Activate the window
	iWindow.Activate();
	}
Example #3
0
EXPORT_C void CXzePicture::Draw(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,MGraphicsDeviceMap* aMap) const
// Draw this simple picture.
//
{
    aGc.Reset();
    aGc.SetClippingRect(aClipRect);
    TSize size;  // Size of graphics device in pixels
    GetSizeInPixels(aMap,size);
    TRect box;  // The rectangle that exactly fits the picture
    box.iTl=aTopLeft;
    box.iBr.iX=aTopLeft.iX+size.iWidth;
    box.iBr.iY=aTopLeft.iY+size.iHeight;
    TRgb white(255,255,255);
// First draw outer box and fill in rest of box.
    aGc.SetBrushColor(white);
    aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
    aGc.DrawRect(box);
// Now draw label
    CFont* font;
    TFontSpec fontSpec(_L("Arial"),213);
    if (aMap->GetNearestFontInTwips(font,fontSpec)<0)
    {
        return;
    }
    aGc.UseFont(font);
    TBuf<1> label;
    label.Append(iLabel);
    TInt baselineOffset=(box.Height()+font->AscentInPixels())/2;
    aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
    aGc.DrawText(label,box,baselineOffset,CGraphicsContext::ECenter);
    aGc.DiscardFont();
    aMap->ReleaseFont(font);
}
TInt CTestSdkFonts::TestTDMTAknTextDecorationMetricsSpecL(CStifItemParser& /*aItem*/)
    {
    TAknFontSpecification fontSpec( ELatinPlain12 );
    TAknTextDecorationMetrics* textDecorationMetrics = new ( ELeave ) TAknTextDecorationMetrics( fontSpec );
    CleanupStack::PushL( textDecorationMetrics );
    STIF_ASSERT_NOT_NULL( textDecorationMetrics );
    CleanupStack::PopAndDestroy( textDecorationMetrics );
    return KErrNone;
    }
TInt CTestSdkFonts::TestTDMBaselineToUnderlineOffsetL(CStifItemParser& /*aItem*/)
    {
    TAknFontSpecification fontSpec( ELatinPlain12 );
    TAknTextDecorationMetrics* textDecorationMetrics = new ( ELeave ) TAknTextDecorationMetrics( fontSpec );
    CleanupStack::PushL( textDecorationMetrics );
    textDecorationMetrics->BaselineToUnderlineOffset();
    CleanupStack::PopAndDestroy( textDecorationMetrics );
    return KErrNone;
    }
void CDirectPrintPreviewView::DoActivateL(const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/)
	{
	LOG("CDirectPrintPreviewView::DoActivateL BEGIN");
	CAknToolbar* toolbar = AppUi()->CurrentFixedToolbar();
	toolbar->SetToolbarObserver(this);
	// set the title pane
	SetActiveTitleL(R_DIRECTPRINT_PREVIEW_TITLE);

	if (!iPrevCtrl)
		{
		CDirectPrintAppAppUi* appui = static_cast<CDirectPrintAppAppUi*>( AppUi() );
		CDirectPrintEngine* engine = appui->Engine();

		const TInt KPanelGutter=5;
		const TInt KShadowWidth=2;
		const TInt KLabelFontHeight=12;

		TFontSpec normalFontSpec = CEikonEnv::Static()->NormalFont()->FontSpecInTwips();
		TFontSpec fontSpec(normalFontSpec);
		fontSpec.iHeight = KLabelFontHeight;
		iPrintPreviewFormat.iLabelFontSpecInPixels=fontSpec;
		iPrintPreviewFormat.iMinPanelGutterInPixels=TSize(KPanelGutter,KPanelGutter);
		iPrintPreviewFormat.iPanelShadowWidthInPixels=KShadowWidth;
		iPrintPreviewFormat.iPanelShadowColor=KRgbDarkGray;
		iPrintPreviewFormat.iPanelMarginColor=KRgbGray;
		iPrintPreviewFormat.iLabelOffsetInPixels=5;

		iPrevCtrl = CDirectPrintPreviewControl::NewL(NULL);
		iPrevCtrl->SetMopParent(this);

		//iNumPagesInDoc = engine->MaxPageNum();
		iNumPagesInDoc = 3;
		iFirstPageToDisplay = 1;
		iNumPagesToView = 1;
		iNumBands = 2;
		iMarginState = CPrintPreviewImage::EShowMargins;

		engine->StartPrintPreviewL();

		iPrevCtrl->InitializeFormat(*(engine->PrintSetup()),
									*(engine->PageRegionPrinter()),
									iPrintPreviewFormat,
									iNumPagesInDoc,
									iFirstPageToDisplay,
									iNumPagesToView,
									iMarginState);
		iPrevCtrl->ActivateL();
		iPrevCtrl->SetNumBands(2);
		}
	iPrevCtrl->SetRect(ClientRect());
	iPrevCtrl->SetDrawFlag(ETrue);
	iPrevCtrl->MakeVisible(ETrue);
	iPrevCtrl->DrawDeferred();
	AppUi()->AddToStackL(*this, iPrevCtrl);
	ChangeVisibleState();
	LOG("CDirectPrintPreviewView::DoActivateL END");
	}
Example #7
0
//--------------------------------------------------------------
// create a font from "arial-10-b-i" style fontspec
const mgFont* mgGenSurface::createFont(
  const char* spec)
{
  // parse fontSpec
  mgString faceName;
  int size = 12;
  BOOL bold = false;
  BOOL italic = false;
  
  // parse fontSpec as facename-size-B-I
  mgString fontSpec(spec);
  int posn = fontSpec.find(0, "-");
  if (posn < fontSpec.length())
  {
    fontSpec.substring(faceName, 0, posn);
    posn = fontSpec.nextLetter(posn);
  }
  else faceName = fontSpec;

  mgString digits;

  if (posn < fontSpec.length())
  {
    int dash2 = fontSpec.find(posn, "-");
    if (dash2 != -1)
    {
      fontSpec.substring(digits, posn, dash2-posn);
      posn = dash2;
    }
    else 
    {
      fontSpec.substring(digits, posn);
      posn = fontSpec.length();
    }
    if (1 != sscanf((const char*) digits, "%d", &size))
      throw new mgErrorMsg("2dBadFontSpec", "spec", "%s", (const char*) fontSpec);
  }

  char letter[MG_MAX_LETTER];
  while (posn < fontSpec.length())
  {
    posn = fontSpec.nextLetter(posn, letter);
    if (strcmp(letter, "-") != 0)
      throw new mgErrorMsg("2dBadFontSpec", "spec", "%s", (const char*) fontSpec);

    posn = fontSpec.nextLetter(posn, letter);
    if (_stricmp(letter, "B") == 0)
      bold = true;
    else if (_stricmp(letter, "I") == 0)
      italic = true;
    else throw new mgErrorMsg("2dBadFontSpec", "spec", "%s", (const char*) fontSpec);
  }
  
  return createFont(faceName, size, bold, italic);
}
CFont *QFontEngineS60::fontWithSize(qreal size) const
{
    CFont *result = 0;
    TFontSpec fontSpec(qt_QString2TPtrC(QFontEngine::fontDef.family), TInt(size));
    fontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
    fontSpec.iFontStyle.SetPosture(QFontEngine::fontDef.style == QFont::StyleNormal?EPostureUpright:EPostureItalic);
    fontSpec.iFontStyle.SetStrokeWeight(QFontEngine::fontDef.weight > QFont::Normal?EStrokeWeightBold:EStrokeWeightNormal);
    const TInt errorCode = S60->screenDevice()->GetNearestFontToDesignHeightInPixels(result, fontSpec);
    Q_ASSERT(result && (errorCode == 0));
    return result;
}
TInt CTestSdkFonts::TestTDMGetLeftAndRightMarginsL(CStifItemParser& /*aItem*/)
    {
    TAknFontSpecification fontSpec( ELatinPlain12 );
    TAknTextDecorationMetrics* textDecorationMetrics = new ( ELeave ) TAknTextDecorationMetrics( fontSpec );
    CleanupStack::PushL( textDecorationMetrics );
    TInt left( 1 ); 
    TInt right( 2 );
    textDecorationMetrics->GetLeftAndRightMargins( left,right );
    CleanupStack::PopAndDestroy( textDecorationMetrics );
    return KErrNone;
    }
TInt CTestSdkFonts::TestTDMGetTopAndBottomMarginsL(CStifItemParser& /*aItem*/)
    {
    TAknFontSpecification fontSpec( ELatinPlain12 );
    TAknTextDecorationMetrics* textDecorationMetrics = new ( ELeave ) TAknTextDecorationMetrics( fontSpec );
    CleanupStack::PushL( textDecorationMetrics );
    TInt top( 1 ); 
    TInt bottom( 2 );
    textDecorationMetrics->GetTopAndBottomMargins( top,bottom );
    CleanupStack::PopAndDestroy( textDecorationMetrics );

    return KErrNone;
    }
Example #11
0
void CFontControl::Draw(const TRect& /* aRect */) const
	{
	// setup screen for example
	CWindowGc& gc = SystemGc();
	gc.Clear();

	// create a centered rectangle of the default size
	TRect drawRect = Rect();

	// set up absolute font-spec and text box for 300 twips font
	TFontSpec fontSpec(iCurrentFont, 300);
	// find the nearest font to the specified one
	CFont* drawFont;
	iDeviceMap->GetNearestFontInTwips(drawFont, fontSpec);
	// use it for this graphics context
	gc.UseFont(drawFont);

	// get font height
	TInt textHeight = drawFont->HeightInPixels();

	// set up the positioning of the character set rows
	TInt exampleMargin = 0;
	TInt currentOffset = ((drawRect.Height() + textHeight) / 2) - (TInt) (textHeight * 2.4);

	// set up descriptors to hold Unicode characters 32 to 255
	TBuf<50> buffer;
	TInt endPoint[6] =
		{
		64, 96, 138, 182, 216, 255
		};
	TInt count = 32;
	for (TInt pass = 0; pass <= 5; pass++)
		{
		while (count <= endPoint[pass])
			{
			buffer.Append((TUint) count);
			count++;
			}
		// draw the row in the current font
		gc.DrawText(buffer, drawRect, currentOffset,
				CGraphicsContext::ECenter, exampleMargin);
		currentOffset = currentOffset + (TInt) (textHeight * 1.2);
		buffer.Zero();
		}

	// discard and release font
	gc.DiscardFont();
	iDeviceMap->ReleaseFont(drawFont);
	}
Example #12
0
/**
  Second Phase constructor for the CTestCoeGridAppUi class.\n
  Gets the current zoom factor.\n
  Sets the grid cell settings like font and zoom factor.\n 
  Constructs a GridTable. It is an interface providing row and column info.\n
  Initializes a GridLay passing the gridtable and null gridimage. \n
  The GridLay object is used to handle the layout of a grid,
  and controls how columns, rows and selections appear.\n
  Initializes a GridImage with gridcell settings which is used to draw cell contents.\n
  A Grid Window is formed containing using GridTable,GridLay and GridImage objects.\n
  The GridWindow offers handlers to pointer and key events.\n
  Sets the current cursor position and activates the Grid Window.\n
*/
void CTestCoeGridAppUi::ConstructL()
    {
    CTestCoeAppUi::ConstructL();

	iUndoColors = EFalse;
	CGraphicsDevice* device=iCoeEnv->ScreenDevice();
	//iCoeEnv->WsSession().SetAutoFlush(ETrue);
	iZoomFactor = new(ELeave) TZoomFactor(device);
    User::Heap().Check();

	const CFont* font = iCoeEnv->NormalFont();
	iTestCellImg = new(ELeave) CTestCellImg(font);

	TFontSpec fontSpec(_L("Swiss"),240);
	iTestLabelImg = new(ELeave) CTestLabelImg(fontSpec,iZoomFactor);
	iTestLabelImg->ConstructL();
    User::Heap().Check();

	iGridLay = new(ELeave) CGridLay(iZoomFactor);
	iGridImg = CGridImg::NewL(device,iTestCellImg,iGridLay);
	iGridImg->SetGridLabelImg(iTestLabelImg);
	iGridTable = new(ELeave) CTestGridTable();
	iGridLay->ConstructL(iGridTable,iGridImg,ENoCols);

	iGridWin = CGridWin::NewL(NULL,iGridLay,iGridImg);
	AddToStackL(iGridWin);

	//
	iGridWin->SetRect((TRect(10,10,630,230)));
	iGridWin->ActivateL();
	iGridWin->DrawNow();
	//
	iGridLay->SetMinRowHeightInPixels(15);	// If ENoRows is not used, a minRowHeight is recommended
	iGridLay->SetColumnBursting(ETrue);
	iGridLay->SetRowPermanentlySelectedL(ETrue);
	iGridLay->SetColumnSelectionDisabled(ETrue);
	iGridLay->SetCursorVisible(EFalse);
	iGridLay->SetHighlightVisible(EFalse);
    iGridLay->SetGridLabelSeparators(EFalse);
	iGridLay->SetAutoClearGridCells(EFalse);

	LoadL();	// Get Persistent data
    User::Heap().Check();
	iGridWin->ActivateL();
    User::Heap().Check();
	
	AutoTestManager().StartAutoTest();

	}
void CPrimaryColoursWin::Draw()
	{
	iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
	iGc->SetPenStyle(CGraphicsContext::ESolidPen);
	iGc->SetPenColor(TRgb(255, 255, 255));
	iGc->SetBrushColor(TRgb(0, 0, 0));
	TSize winSize = Size();
	iGc->DrawRect(TRect(winSize));
	
	CFont* font;
	TFontSpec fontSpec(_L(""), 300);
	TheClient->iScreen->GetNearestFontInTwips(font, fontSpec);
	
	if (font)
		{
		iGc->UseFont(font);
		TRect r(TPoint(0, 0), Size());
		r.Shrink(kMinHeight, kMinHeight);
		iGc->DrawText(iDisplayText, r, font->AscentInPixels(), iGc->ECenter, 0);
		iGc->DiscardFont();
		TheClient->iScreen->ReleaseFont(font);
		}
	
	iNumColours = 0;
	TPoint lhsAbs = Win()->AbsPosition();
	
	for(TInt channelnum = 0, channelmul = 1, xoordinate = kPlotMargin; channelnum < KNumChannels; channelnum++, channelmul <<= 8, xoordinate += kPlotWithMargin)
		{
		TRgb lastPixel(255, 255, 255, 255);
		
		for(TInt colour = 0; colour < KNumColours; colour++)
			{
			if(!iBadPixels[channelnum][colour])
				{
				iGc->SetPenColor(TRgb(colour * channelmul));				
				}
			else
				{
				iGc->SetPenColor(TRgb(255, 255, 255));			
				}

			TPoint point = TPoint(xoordinate + (colour & 0x0f), kPlotMargin + (colour >> 4));
			iGc->Plot(point);
			}
		}
		
	iDrawn=ETrue;
	}
Example #14
0
void CButton::Message(TDes& aText,TInt aInterval)
	{
	const TInt KBetween=10;
	const TInt KFontSize = 120;
	_LIT(KFontName, "Nokia Hindi S60");
	
	CFont* font;
	TTypefaceSupport iTypefaceSupport;
	TBuf<KMaxTypefaceNameLength> fontName;
	fontName.FillZ(KMaxTypefaceNameLength);
	CEikonEnv::Static()->ScreenDevice()->TypefaceSupport(iTypefaceSupport, 0);
	fontName = iTypefaceSupport.iTypeface.iName;
		
	TFontSpec fontSpec(fontName, KFontSize);
	CEikonEnv::Static()->ScreenDevice()->GetNearestFontInTwips(font, fontSpec);
	TInt maxW;
	TInt scrX=CEikonEnv::Static()->ScreenDevice()->SizeInPixels().iWidth;
	TInt scrY=CEikonEnv::Static()->ScreenDevice()->SizeInPixels().iHeight;
	
	iLabel->SetFont(font);
	
	TInt w=iLabel->Font()->TextWidthInPixels(aText);
	TInt h=iLabel->Font()->HeightInPixels();
	TInt posX=iButton->Position().iX+(iButton->Size().iWidth/2)-(w/2);
	TInt posY=0;
	if (iButton->Position().iY>scrY/2)
		{posY=iButton->Position().iY-h-KBetween;} //bottom
	else {posY=iButton->Position().iY+iButton->Size().iHeight+KBetween;} //top 
	if (iButton->Position().iX<scrX/2)
			{maxW=2*(iButton->Position().iX+(iButton->Size().iWidth/2));} //left
		else {maxW=2*((scrX-(iButton->Position().iX+iButton->Size().iWidth))-(iButton->Size().iWidth/2));} //right
	TRgb themecolor;
	MAknsSkinInstance* skin=AknsUtils::SkinInstance();
	AknsUtils::GetCachedColor(skin,themecolor,KAknsIIDQsnTextColors,EAknsCIQsnTextColorsCG6 );
	iLabel->SetBrushStyle(CGraphicsContext::ESolidBrush);
	TRgb col=KRgbBlack;
	themecolor=KRgbWhite;
	iLabel->OverrideColorL(EColorControlBackground,col);
	iLabel->OverrideColorL(EColorLabelText,themecolor);
	iLabel->SetPosition(TPoint(posX,posY));
	iLabel->SetSize(TSize(w,h));
	iLabel->SetFont(font);
	iLabel->MakeVisible(ETrue);
	iLabel->SetTextL(aText);
	iLabel->DrawNow();
	iMsgTimer->Start(aInterval*1000,aInterval*1000,TCallBack(MsgTick,this));
	}
Example #15
0
void COokjorContainer::ConstructL(const TRect& aRect)
    {
    CreateWindowL();
	CSkinnedContainer::ConstructL();

	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
	TRgb NormalTextColor = KRgbGray;

	#ifdef EKA2
	AknsUtils::GetCachedColor(skin, NormalTextColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6);
	#else
	TAknsItemID data;
	data.Set(EAknsMajorSkin, EAknsMinorQsnComponentColorBmpCG5);
	AknsUtils::GetCachedColor(skin, NormalTextColor, data, EAknsMinorQsnComponentColorBmpCG5);
	#endif



	 _LIT(KTextLoading, "Loading...");

	 LoadBitMap();

	 iStateLabel = new (ELeave) CEikLabel;
	 iStateLabel->SetContainerWindowL( *this );
	 iStateLabel->SetTextL(KTextLoading);
	 //////font
	 {
	 CFont* font = NULL;
	 font =  (CFont*) CEikonEnv::Static()->TitleFont();
	 if(font)
	 {
	 iStateLabel->SetFont(font);
	 }
	 }
	 //////
	 iStateLabel->OverrideColorL( EColorLabelText, NormalTextColor );

	 iStatusLabel = new (ELeave) CEikLabel;
	 iStatusLabel->SetContainerWindowL( *this );
	 iStatusLabel->SetTextL(KTextLoading);
	 {
	 //////font - http://wiki.forum.nokia.com/index.php/CS000833_-_Setting_font_for_CEikLabel
	 _LIT(KFontName, "LatinPlain12");
	 const TInt KFontSize = 140;  // Height of the typeface in twips
	 TFontSpec fontSpec(KFontName, KFontSize);
	 // Find the nearest available font to the TFontSpec and assign it to CFont
	 CGraphicsDevice* screenDevice = iEikonEnv->ScreenDevice();
	 CFont* font;
	 screenDevice->GetNearestFontInTwips(font, fontSpec);
	 // Set the font for the label
	 iStatusLabel->SetFont(font);
	 // Destroy the font
	 screenDevice->ReleaseFont(font);
	 //////
	 }
	 iStatusLabel->OverrideColorL( EColorLabelText, NormalTextColor );


	 iHintLabel = new (ELeave) CEikLabel;
	 iHintLabel->SetContainerWindowL( *this );
	 iHintLabel->SetTextL(KTextLoading);
	 {
	 //////font - http://wiki.forum.nokia.com/index.php/CS000833_-_Setting_font_for_CEikLabel
	 _LIT(KFontName, "LatinPlain12");
	 const TInt KFontSize = 140;  // Height of the typeface in twips
	 TFontSpec fontSpec(KFontName, KFontSize);
	 // Find the nearest available font to the TFontSpec and assign it to CFont
	 CGraphicsDevice* screenDevice = iEikonEnv->ScreenDevice();
	 CFont* font;
	 screenDevice->GetNearestFontInTwips(font, fontSpec);
	 // Set the font for the label
	 iHintLabel->SetFont(font);
	 // Destroy the font
	 screenDevice->ReleaseFont(font);
	 //////
	 }
	 iHintLabel->OverrideColorL( EColorLabelText,NormalTextColor);


	SetRect(aRect);
	ActivateL();
    }
void CBCTestFontInputCase::TestFontSpecL()
    {
    // Test some API here
    TAknFontSpecification fontSpec( 3 );
    
    fontSpec.SetExactMatchRequired( ETrue );
    _LIT( stMatch, " Test SetExactMatchRequired() " );
    AssertTrueL( ETrue, stMatch );

    fontSpec.SetTextPaneHeight( TInt( 3 ) );
    _LIT( stPaneHeight, " Test SetTextPaneHeight()" );
    AssertTrueL( ETrue, stPaneHeight );

    fontSpec.SetFontCategory( EAknFontCategoryUndefined );
    _LIT( stFontCate, " Test SetFontCategory() " );
    AssertTrueL( ETrue, stFontCate );

    fontSpec.SetPosture( EPostureUpright );
    _LIT( stPost, " Test SetPosTure() " );
    AssertTrueL( ETrue, stPost );

    fontSpec.SetTextPaneHeightIsDesignHeight( ETrue );
    _LIT( stHeighIsDesHeight, " Test SetTextPaneHeightIsDesignHeight() " );
    AssertTrueL( ETrue, stHeighIsDesHeight );

    fontSpec.SetUnits( TAknFontSpecification::EPixels);
    _LIT( stUnits, " Test SetUnits()" );
    AssertTrueL( ETrue, stUnits );

    fontSpec.SetWeight( EStrokeWeightNormal );
    _LIT( stWeight, " Test SetWeight() " );
    AssertTrueL( ETrue, stWeight );

    TAknTextDecorationMetrics txtDecMetric( 3 );
    
    txtDecMetric.BaselineToUnderlineOffset();
    _LIT( bsLnToUnderLn," Test BaseLineToUnderline)ffset() " );
    AssertTrueL( ETrue, bsLnToUnderLn );

    txtDecMetric.UnderlineHeight();
    _LIT( underLnHeight," Test UnderlineHeight() " );
    AssertTrueL( ETrue, underLnHeight );
     
    TInt lef,rgt,tp,bt;     
    txtDecMetric.GetLeftAndRightMargins( lef, rgt );
    _LIT( gtLeftAndRight, " Test GetLeftAndRightMargins() " );
    AssertTrueL( ETrue, gtLeftAndRight );
          
    txtDecMetric.GetTopAndBottomMargins( tp,bt );
    _LIT( gtTandB, " Test GetTopAndBottomMargins() " );
    AssertTrueL( ETrue, gtTandB );
     
    txtDecMetric.CursorWidth();
    _LIT( CurWidth, " Test CursorWidth() " );
    AssertTrueL( ETrue, CurWidth );
     
    TAknTextDecorationMetrics txtDecMetric1( CCoeEnv::Static()->NormalFont() );
    _LIT( txtDecMetricsFont, " Test TAKnTextDecorationMetrics( Font )" );
    AssertTrueL( ETrue, txtDecMetricsFont );
     
    TAknTextDecorationMetrics txtDecMetric2( fontSpec );
    _LIT( txtDecMetricsSpec," Test TAKnTextDecorationMetrics( Font )" );
    AssertTrueL( ETrue, txtDecMetricsSpec );
    
    const CAknLayoutFont* layoutFont = 
        AknLayoutUtils::LayoutFontFromId( 3 );
        
    TInt maxAscent = layoutFont->MaxAscent();
    _LIT( KLayoutFont1, "CAknLayoutFont::MaxAscent" );
    AssertTrueL( ETrue, KLayoutFont1 );
    
    TAknTextDecorationMetrics metrics = layoutFont->TextDecorationMetrics();
    _LIT( KLayoutFont2, "CAknLayoutFont::TextDecorationMetrics" );
    AssertTrueL( ETrue, KLayoutFont2 );
    }