本文整理汇总了C++中CFbsBitGc::UseFont方法的典型用法代码示例。如果您正苦于以下问题:C++ CFbsBitGc::UseFont方法的具体用法?C++ CFbsBitGc::UseFont怎么用?C++ CFbsBitGc::UseFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFbsBitGc
的用法示例。
在下文中一共展示了CFbsBitGc::UseFont方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RasterizeLineL
EXPORT_C void THuiFont::RasterizeLineL(const TDesC& aTextString, CFbsBitGc& aTargetContext)
{
// Retrieve the CFont object used when rasterizing this text mesh.
CFont* font = NearestFontL();
// Draw the text
aTargetContext.UseFont(font);
TInt avkonMaxAscent = 0;
if (CCoeEnv::Static())
{
const CAknLayoutFont* layoutFont = CAknLayoutFont::AsCAknLayoutFontOrNull( font );
avkonMaxAscent = layoutFont->MaxAscent() + KHuiFontVerticalShiftInPixels;
}
else
{
avkonMaxAscent = iTextPaneHeight;
}
aTargetContext.DrawText(aTextString, TPoint(0, avkonMaxAscent ));
aTargetContext.DiscardFont();
}
示例2: RasterizePictographLineL
TBool CHuiRasterizedTextMesh::RasterizePictographLineL(const TDesC& aTextLine, CFont* aFont, SRasterizedLine & aLineOut)
{
if(iUsingPreRasterizedMesh)
{
return EFalse;
}
// Retrieve the used text style.
THuiTextStyle* textStyle = CHuiStatic::Env().TextStyleManager().TextStyle(iTextStyleId);
// Calculate line extents and assign it to texture size.
TSize textureSize = textStyle->LineExtentsL(aTextLine);
if(textureSize.iWidth == 0 || !iPictographInterface || !iPictographInterface->Interface()->ContainsPictographs(aTextLine))
{
// This is an empty string or it does not contain pictographs. We will not rasterize it.
// Just add a gap.
aLineOut.iTexture = NULL;
aLineOut.iGap = textureSize.iHeight;
return !IsMaxLineCountReached();
}
// store the actual size to be assigned as the textures logical size
TSize actualsize(textureSize);
if (aLineOut.iTexture == NULL)
{
// Create a texture for storing the pictographs into.
aLineOut.iTexture = CHuiTexture::NewL();
HUI_DEBUG1(_L("CHuiRasterizedTextMesh::RasterizePictographLineL() - Registering self (0x%x) as a texture content observer."), this);
// Register one content observer for the first texture that
// is able to restore all lines in a single run
if (iLines.Count()==1)
{
aLineOut.iTexture->iContentObservers.AppendL(*this);
}
aLineOut.iGap = 0;
}
// set a name for the texture
// @todo is this needed, what names to use
aLineOut.iTexture->SetImageFileNameL(_L("Pictographs"));
TSize maxTextureSize = aLineOut.iTexture->MaxTextureSize();
textureSize.iWidth = Min(textureSize.iWidth, maxTextureSize.iWidth);
textureSize.iHeight = Min(textureSize.iHeight, maxTextureSize.iHeight);
if((textureSize.iWidth == 0) || (textureSize.iHeight == 0))
{
// Cannot draw into this tiny texture, so leave.
HUI_DEBUG2(_L("CHuiRasterizedTextMesh::RasterizePictographLineL() - texture size was too small to draw into (%i, %i)."), textureSize.iWidth, textureSize.iHeight);
User::Leave(KErrAbort);
}
User::LeaveIfError( iPictographBitmap->Resize(textureSize) );
CFbsBitmapDevice* device = CFbsBitmapDevice::NewL(iPictographBitmap);
CleanupStack::PushL(device);
CFbsBitGc* gc = 0;
User::LeaveIfError( device->CreateContext(gc) );
CleanupStack::PushL(gc);
// Prepare the bitmap for drawing...set drawmode because of EColor16MA mode...
gc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
TRgb color = KRgbWhite;
color.SetAlpha(0x00);
gc->SetBrushColor(color);
gc->Clear();
gc->UseFont(aFont);
// Draw pictorgraphs
iPictographInterface->Interface()->DrawPictographsInText(
*gc,
*aFont,
aTextLine, TPoint(0, aFont->FontMaxAscent()));
CleanupStack::PopAndDestroy(gc);
CleanupStack::PopAndDestroy(device);
aLineOut.iTexture->UploadL(*iPictographBitmap, NULL, EHuiTextureUploadFlagRetainResolution);
aLineOut.iTexture->SetSize(actualsize);
return !IsMaxLineCountReached();
}
示例3: DrawItem
// CFepLayoutChoiceList::DrawItem
// Draw a choice list item.
// (other items were commented in a header).
// ---------------------------------------------------------------------------
//
void CFepLayoutChoiceList::DrawItem(const TRect& aRect, const CFepLayoutChoiceList::SItem& aItem,
TBool aErase, TBool aFocus)
{
if(iWndControl)
return;
CFbsBitGc* gc = static_cast<CFbsBitGc*>(BitGc());
if( aErase )
{
SetBorderColor( BkColor() );
//DrawChoiceListBackground( aRect );//, EFalse);
}
if( aFocus )
{
//draw focus bitmap
TRect rtFocusRect(iItemFocusRect);
TRect rtFocusInBmp(TPoint(0,0), iItemFocusRect.Size());
rtFocusRect.Move(aRect.iTl);
TRect rtInnerRect( rtFocusRect );
rtInnerRect.Shrink( 5, 5 );
if( iSubItemSkinID.iMajor != EAknsMajorNone &&
iSubItemSkinID.iMinor != EAknsMinorNone)
{
gc->Activate( BitmapDevice() );
AknsDrawUtils::DrawFrame( AknsUtils::SkinInstance(),
*gc,
rtFocusRect,
rtInnerRect,
iSubItemSkinID,
KAknsIIDDefault );
}
else
{
//mask bitmaps-------
gc->Activate( MaskBitmapDevice() );
if( iItemFocusBmpMask )
{
DrawBitmap(rtFocusRect, rtFocusInBmp, iItemFocusBmpMask,
iItemFocusBmpMask->SizeInPixels() == rtFocusInBmp.Size());
}
//front bitmaps-------
gc->Activate( BitmapDevice() );
if( iItemFocusBmp )
{
DrawBitmap(rtFocusRect, rtFocusInBmp, iItemFocusBmp,
iItemFocusBmp->SizeInPixels() == rtFocusInBmp.Size());
}
}
}
//draw text
if (iFont)
{
gc->UseFont(iFont);
gc->SetBrushStyle( CGraphicsContext::ENullBrush );
gc->SetPenColor(iFontColor);
gc->SetPenStyle(CGraphicsContext::ESolidPen);
gc->DrawText(aItem.iText, aRect, iBaseline, CGraphicsContext::ELeft, iMargin);
gc->DiscardFont();
}
}