本文整理汇总了C++中CFont::FontSpecInTwips方法的典型用法代码示例。如果您正苦于以下问题:C++ CFont::FontSpecInTwips方法的具体用法?C++ CFont::FontSpecInTwips怎么用?C++ CFont::FontSpecInTwips使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFont
的用法示例。
在下文中一共展示了CFont::FontSpecInTwips方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckMonoTypeInstalledL
TBool CAlphaBlendTest::CheckMonoTypeInstalledL()
{
SetScreenModeL(EColor16MU);
//
TFontSpec fontSpec;
fontSpec.iTypeface.iName = KFontTypeface;
fontSpec.iHeight = 20;
fontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
fontSpec.iFontStyle.SetEffects(FontEffect::EDropShadow, ETrue);
fontSpec.iFontStyle.SetEffects(FontEffect::EOutline, ETrue);
CFont* font;
User::LeaveIfError(iScreenDevice->BitmapDevice().GetNearestFontToDesignHeightInPixels((CFont*&)font,fontSpec));
TBool monoTypeInstalled=font->FontSpecInTwips().iFontStyle.BitmapType()==EFourColourBlendGlyphBitmap;
iScreenDevice->BitmapDevice().ReleaseFont(font);
return(monoTypeInstalled);
}
示例2: UseFontL
void CEikListBoxTextEditor::UseFontL( CEikEdwin& aEditor, const CFont& aFont )
{
_AKNTRACE_FUNC_ENTER;
CGlobalText* globalText;
TCharFormatMask defaultCharFormatMask;
defaultCharFormatMask.SetAttrib(EAttFontTypeface);
defaultCharFormatMask.SetAttrib(EAttFontHeight);
TFontSpec fontspec = aFont.FontSpecInTwips();
TCharFormat defaultCharFormat( fontspec.iTypeface.iName, fontspec.iHeight );
iParaFormatLayer=CParaFormatLayer::NewL();
iCharFormatLayer=CCharFormatLayer::NewL(defaultCharFormat,defaultCharFormatMask);
globalText=CGlobalText::NewL(iParaFormatLayer,iCharFormatLayer,CEditableText::ESegmentedStorage,5);
CleanupStack::PushL(globalText);
TCharFormat charFormat;
TCharFormatMask charMask;
iCharFormatLayer->Sense(charFormat,charMask);
if ( fontspec.iFontStyle.Posture()==EPostureItalic )
{
charMask.SetAttrib(EAttFontPosture);
charFormat.iFontSpec.iFontStyle.SetPosture(EPostureItalic);
}
if ( fontspec.iFontStyle.StrokeWeight()==EStrokeWeightBold )
{
charMask.SetAttrib(EAttFontStrokeWeight );
charFormat.iFontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
}
iCharFormatLayer->SetL(charFormat,charMask);
CPlainText* old=aEditor.Text();
CleanupStack::Pop(); // globalText
CleanupStack::PushL(old); // old is pushed because we're using EUseText in the subsequent call
aEditor.SetDocumentContentL(*globalText,CEikEdwin::EUseText);
CleanupStack::PopAndDestroy(); // old
_AKNTRACE_FUNC_EXIT;
}
示例3: TwipsCacheFlushL
void CTScreenDevice::TwipsCacheFlushL()
{
RWsSession session;
CWsScreenDevice* device;
CFont* font;
CFont* font2;
const TFontSpec fontspec(KTestFontTypefaceName,250);
TPixelsTwipsAndRotation sizeAndRotation;
// create a CWsScreenDevice instance
User::LeaveIfError(session.Connect());
device=new(ELeave) CWsScreenDevice(session);
device->Construct(iTest->iScreenNumber);
// Record a font height for use by latter tests
User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(font,fontspec));
const TInt height0=font->HeightInPixels();
device->ReleaseFont(font);
// 1. find font with best-matching height in twips,
// 2. change twips size of the screen (leaving pixel-size same),
// 3. find font with best-matching height in twips,
// 4. make sure that the newly found font is not the same as previous and has the different height in pixels
device->GetDefaultScreenSizeAndRotation(sizeAndRotation);
#if defined(EXTRA_LOGGING)
_LIT(KLog1,"Font height: %d for unchanged device. pixels=%d,%d twips=%d,%d");
LOG_MESSAGE6(KLog1,height0,sizeAndRotation.iPixelSize.iWidth,sizeAndRotation.iPixelSize.iHeight
,sizeAndRotation.iTwipsSize.iWidth,sizeAndRotation.iTwipsSize.iHeight);
#endif
sizeAndRotation.iTwipsSize.iHeight=2000;
sizeAndRotation.iTwipsSize.iWidth =3000;
device->SetScreenSizeAndRotation(sizeAndRotation);
User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(font,fontspec));
TInt height=font->HeightInPixels();
#if defined(EXTRA_LOGGING)
_LIT(KLog2,"Font height: %d for device with twips set to 2000x3000");
LOG_MESSAGE2(KLog2,height);
#endif
TFontSpec returnedSpec=font->FontSpecInTwips();
sizeAndRotation.iTwipsSize.iHeight=4000;
sizeAndRotation.iTwipsSize.iWidth =6000;
device->SetScreenSizeAndRotation(sizeAndRotation);
User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(font2,fontspec));
TInt height2=font2->HeightInPixels();
TFontSpec returnedSpec2 = font2->FontSpecInTwips();
#if defined(EXTRA_LOGGING)
_LIT(KLog3,"Font height: %d for device with twips set to 4000x6000");
LOG_MESSAGE2(KLog3,height2);
#endif
TEST(font!=font2);
TEST(height!=height2);
_LIT(KLogErrM,"Font Heights in pixels match unexpectantly, height=%d");
if (height==height2)
INFO_PRINTF2(KLogErrM,height);
device->ReleaseFont(font2);
device->ReleaseFont(font);
// 1. find font with best-matching height in twips,
// 2. change pixel size of the screen (leaving twip-size same),
// 3. find font with best-matching height in twips,
// 4. make sure that the newly found font is not the same as previous and has the different height in pixels
device->GetDefaultScreenSizeAndRotation(sizeAndRotation);
sizeAndRotation.iPixelSize.iHeight=240;
sizeAndRotation.iPixelSize.iWidth =640;
device->SetScreenSizeAndRotation(sizeAndRotation);
User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(font,fontspec));
height=font->HeightInPixels();
returnedSpec=font->FontSpecInTwips();
#if defined(EXTRA_LOGGING)
_LIT(KLog4,"Font height: %d for device with pixels set to 240x640 twips=%d,%d");
LOG_MESSAGE4(KLog4,height,sizeAndRotation.iTwipsSize.iWidth,sizeAndRotation.iTwipsSize.iHeight);
#endif
sizeAndRotation.iPixelSize.iHeight=480;
sizeAndRotation.iPixelSize.iWidth =1280;
device->SetScreenSizeAndRotation(sizeAndRotation);
User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(font2,fontspec));
height2=font2->HeightInPixels();
returnedSpec2=font2->FontSpecInTwips();
#if defined(EXTRA_LOGGING)
_LIT(KLog5,"Font height: %d for device with pixels set to 480x1280");
LOG_MESSAGE2(KLog5,height2);
#endif
TEST(font!=font2);
TEST(height!=height2);
if (height==height2)
INFO_PRINTF2(KLogErrM,height);
device->ReleaseFont(font2);
device->ReleaseFont(font);
// 1. double the width and height of screen in both pixels and twips
//.........这里部分代码省略.........