当前位置: 首页>>代码示例>>C++>>正文


C++ CFont::FontSpecInTwips方法代码示例

本文整理汇总了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);
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:16,代码来源:talphablend.cpp

示例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;
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:38,代码来源:EIKLBED.CPP

示例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
//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:101,代码来源:TSCRDEV.CPP


注:本文中的CFont::FontSpecInTwips方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。