Symbian中设置屏幕字体大小以及样式
来源:互联网 发布:如何监测办公室网络 编辑:程序博客网 时间:2024/05/04 21:53
(1)改变屏幕字体显示的大小:
首先,设置一个CFbsBitGc的指针和CFbsScreenDevice的指针:
CFbsBitGc *iFbsBitGc;
CFbsScreenDevice* iFbsScreenDevice;
然后,再二段构造中对这两个指针进行NewL()处理,如下:
iFbsBitGc = CFbsBitGc::NewL();
iFbsScreenDevice=CFbsScreenDevice::NewL(0, EColor256);
其中0表示使用系统自带的字体Lib库,而EColor256是显示模式,系统支持的模式有
ENone
No display mode
EGray2
Monochrome display mode (1 bpp)
EGray4
Four grayscales display mode (2 bpp)
EGray16
16 grayscales display mode (4 bpp)
EGray256
256 grayscales display mode (8 bpp)
EColor16
“Low colour” EGA 16 colour display mode (4 bpp)
EColor256
256 colour display mode (8 bpp)
EColor64K
64,000 colour display mode (16 bpp)
EColor16M
“True colour” display mode (24 bpp)
ERgb
(Not an actual display mode — used for moving buffers containing bitmaps)
EColor4K
4096 colour display (12 bpp).
注:EColor4K模式效果最好,颜色多样
设置完成后激活它iFbsBitGc->Activate(iFbsScreenDevice);
最后,在Draw()函数中:
_LIT(KMyFontName,"Swiss");
TFontSpec myFontSpec1(KMyFontName,200);
CFont* myFont1;
//加粗
myFontSpec1.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
//斜体
myFontSpec1.iFontStyle.SetPosture(EPostureItalic);
//阳文
myFontSpec1.iFontStyle.SetEffects(FontEffect::EEmbossed,ETrue);
//获取字体
iFbsScreenDevice->GetNearestFontToMaxHeightInTwips(myFont1, myFontSpec1, 220);
//选择字体
iFbsBitGc->UseFont(myFont1);
//设置画笔颜色为红色
iFbsBitGc->SetPenColor(KRgbRed);
_LIT(KText, "This is a Test!");
TBufC<20> text (KText);
iFbsBitGc ->DrawText(KText, TPoint(120, 120));
iFbsScreenDevice->Update();
// Discard and destroy the font
iFbsScreenDevice->ReleaseFont(myFont1);
(2)不通过资源直接使用汉字及其他字体格式
myFont=ApacPlain16();
gc.UseFont( myFont );
baseH+=myFont->HeightInPixels()+1;
gc.DrawText(_L("/x671D/x5916/x5927/x8857"),TPoint(x,baseH));
gc.DiscardFont();
myFont=ApacPlain12();
gc.UseFont( myFont );
baseH+=myFont->HeightInPixels()+1;
gc.DrawText(_L("/x671D/x5916/x5927/x8857"),TPoint(x,baseH));
gc.DiscardFont();
其中/x671D/x5916/x5927/x8857为自己手动转化成UTF8得到,转化工具自己找很小,
- Symbian中设置屏幕字体大小以及样式
- XShell调整字体大小以及样式
- myeclipse中设置字体大小
- myeclipse中设置字体大小
- eclipse中设置字体大小
- MyEclipse中设置字体大小
- eclipse中设置字体大小
- XCode中设置字体大小
- eclipse中设置字体大小
- myeclipse中设置字体大小
- myeclipse中设置字体大小
- myeclipse中设置字体大小
- myeclipse中设置字体大小
- myeclipse中设置字体大小
- myeclipse中设置字体大小
- myeclipse中设置字体大小
- myeclipse中设置字体大小
- eclipse中设置字体大小
- NUMA与英特尔下一代Xeon处理器学习心得(1)
- 实现s3c2510拨号全过程,基于uclinux
- 《监控》之“躲”在北京
- 转发:一个总经理的11个经典面试问题
- 关于 M8的出厂日期
- Symbian中设置屏幕字体大小以及样式
- [转]创新与市场:中国本土IC设计公司突围之道
- ASP.NET FileUpload应用实例
- classpath和环境变量设置
- 十、NHIbernate之使用视图
- 拖动表格
- char[]:strlen和sizeof的区别
- 补10.21
- 计算机端口