×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    9

    So Weird when I add a font file in project

    Hi friends.
    I need you help.
    The problem that i want to talk let me break down.
    I want to use a custom font in my program.so i add a font file(ttf format) in the construct funtion.it was work ,program print some string using my font style, but the problem is it just work on the first time ,when i second time start the program it don't work ,thease string can't print using my font style,i found my font is can't add in system.but when i restart Emulator,it was the same ,the first time i start the program ,it was no problem, but when i close the program,open the program again,it don't work!!!
    I had try many times,over and over again.
    here is my code,my Emulator is S60 3Rd mr
    // in construct funtion
    _LIT(KMyFont,"c:\\temp\\fonts\\simfang.ttf");
    _LIT(KFontName,"FangSong");
    CWsScreenDevice* sScreenDevice = CEikonEnv::Static()->ScreenDevice();
    TInt sNum = sScreenDevice->NumTypefaces();//sNum = 7 ,the number of system font is 7
    TInt sResult = sScreenDevice->AddFile(KFontsimfang, iFontId); //every time the sResult is 0
    sNum = sScreenDevice->NumTypefaces();
    //when i start the program ,the first time sNum is 8,mean i add the font file success,
    //but when i close the program ,start this program again ,the sNum alway is 7 mean that
    // i add the font file is failed.what happen ? why the only first time is ok?
    TFontSpec sSpec(KFontName, 150);
    sScreenDevice->GetNearestFontInTwips(iMyFont, sSpec);//iMyFont is a CFont variable pointer
    ............
    // in destructor funtion
    CEikonEnv::Static()->ScreenDevice()->ReleaseFont( iMyFont );
    iNormalFont = NULL;
    CCoeEnv::Static()->ScreenDevice()->RemoveFile(iFontId);


    in the sdk the ttf format font file is support.
    why the program first time start is ok,but second time ,third time ... can't work!!!
    when i restart my Emulator , it do so again.
    some one can tell me?

  2. #2
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,348

    Re: So Weird when I add a font file in project

    What panic or error you are getting while trying to call AddFile() at second launch?

    Also this might be helpful - Using application-specific custom fonts

  3. #3
    Registered User
    Join Date
    Jul 2004
    Posts
    9

    Re: So Weird when I add a font file in project

    Quote Originally Posted by A.A.M. View Post
    What panic or error you are getting while trying to call AddFile() at second launch?

    Also this might be helpful - Using application-specific custom fonts
    no panic and no error ,the return value of AddFile() is zero,the sdk says is success,
    even so,but some char is missing ,
    for instance,first time the program print the message"您好" using my font style,
    but the second time it only print the message "好”,the char"您" is missing!!!

Similar Threads

  1. Error with makesis.exe and creating the .pkg file
    By gramya87 in forum Symbian Tools & SDKs
    Replies: 7
    Last Post: 2007-10-10, 13:53
  2. Replies: 1
    Last Post: 2005-05-26, 14:22
  3. Cannot add .lib file to VC6 project (Series 60 SDK)
    By ngabordh in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2004-03-25, 15:13
  4. Replies: 0
    Last Post: 2002-06-10, 12:24

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×