Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:第三版中自定义字体文件将无法正常工作

From Wiki
Jump to: navigation, search

Archived.png存档: 这篇文章是存档,因为考虑到今天它与第三方开发者建立商业解决方案不相关。

Article Metadata

兼容于
平台: S60 3rd Edition
S60 3rd Edition (initial release)

文章
翻译:
hoolee
最后由 hamishwillee 在 23 Aug 2012 编辑

详细描述

自定义的字体(TTF或GDR)可以通过CWsScreenDevice::AddFile()来添加。但在S60第三版中,增加新字体只能第一次有效,当程序重启后,增加的字体就会失效(被系统字体取代)

如何重现

上述问题可以使用下列代码重现

CFont* font; TInt fontId;
CWsScreenDevice* dev = CEikonEnv::Static()->ScreenDevice();
dev->AddFile( _L("c:\\data\\sample.ttf"), fontId );
const CFont* logicalFont = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont );
TFontSpec fontSpec = logicalFont->FontSpecInTwips();
TFontSpec myFontSpec( _L("MyTypeface"), fontSpec.iHeight );<br> dev->GetNearestFontToDesignHeightInTwips( font, myFontSpec );

解决方案

这个问题已经在第三版FP1及后继版本予以修复

受影响手机的解决方案

受其影响的手机可以在启动程序时做一次检测,看字体文件是否已经准备好。即仅调用一次AddFile()

This page was last modified on 23 August 2012, at 05:39.
332 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×