×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor
    Join Date
    Sep 2007
    Posts
    71

    Custom Font Problem please help!!

    Hi

    I m trying to draw two different fonts such as Arial & Impact in my application.

    but its drawing only the Arial font, its not drawing the Impact font.

    can any one help me out

    this is the code

    //CustomFOnt ARIAL
    CFont* iFont;
    TInt iFontUid;
    CEikonEnv::Static()->ScreenDevice()->AddFile(_L("\\system\\apps\\arial.gdr"),
    iFontUid);

    const CFont* logical_font =
    AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont);

    TFontSpec font_spec = logical_font->FontSpecInTwips();
    TFontSpec myFontSpec(_L("Arial"),font_spec.iHeight);

    CEikonEnv::Static()->ScreenDevice()->GetNearestFontToDesignHeightInTwips(iFont,
    myFontSpec);
    // Using the custom font & drawing some sample text.
    gc.UseFont(iFont);
    const TPoint point(10,20);
    gc.DrawText(_L("Hi Hello how r u?"), point);



    // unloading the custom font

    CEikonEnv::Static()->ScreenDevice()->ReleaseFont(iFont);
    CEikonEnv::Static()->ScreenDevice()->RemoveFile(iFontUid);






    //CustomFOnt Impact

    CFont* iFont1;
    TInt iFontUid1;
    CEikonEnv::Static()->ScreenDevice()->AddFile(_L("\\system\\apps\\impact.gdr"),
    iFontUid1);

    const CFont* logical_font1 =
    AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont);

    TFontSpec font_spec1 = logical_font1->FontSpecInTwips();
    TFontSpec myFontSpec1(_L("Impact"),font_spec1.iHeight-15);

    CEikonEnv::Static()->ScreenDevice()->GetNearestFontToDesignHeightInTwips(iFont1,
    myFontSpec1);
    // Using the custom font & drawing some sample text.
    gc.UseFont(iFont1);
    const TPoint point1(10,60);
    gc.DrawText(_L("Hi Hello how r u?"), point1);


    // unloading the custom font
    CEikonEnv::Static()->ScreenDevice()->ReleaseFont(iFont1);
    CEikonEnv::Static()->ScreenDevice()->RemoveFile(iFontUid1);


    Waiting for more replies

    Thanks

    Hidayath

  2. #2
    Super Contributor
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

    Re: Custom Font Problem please help!!

    Hi

    first of all Discrard older Font using.

    gc.DiscardFont(iFont);

    and then use new font.

    gc.UseFont(iFont1);

    it might help you, but im not sure....

    savaj....

  3. #3
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: Custom Font Problem please help!!

    Quote Originally Posted by savaj View Post
    Hi

    first of all Discrard older Font using.

    gc.DiscardFont(iFont);

    and then use new font.

    gc.UseFont(iFont1);

    it might help you, but im not sure....

    savaj....

    even if it doesn't solve your problem, it is important to do this else it will result in mem-leak !
    Amit Kankani
    Nokia Developer Champion

  4. #4
    Regular Contributor
    Join Date
    Sep 2007
    Posts
    71

    Re: Custom Font Problem please help!!

    Hi

    even after including gc.DiscardFont()

    still i m facing the same problem.......

    plz, can any one help me out.

    my objective is to draw the different fonts in the same screen!!!!


    Thanks in Advance
    Hidayath

  5. #5
    Registered User
    Join Date
    Jun 2008
    Posts
    30

    Re: Custom Font Problem please help!!

    hi,
    my font shows in emulator and not on n73, anyone knows about this? its strange, used getNearestFontInTwips()

  6. #6
    Registered User
    Join Date
    Dec 2006
    Location
    Noida, India
    Posts
    150

    Re: Custom Font Problem please help!!

    its simple, the font you are using is not present in device.. try to use native fonts.

  7. #7
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    113

    Re: Custom Font Problem please help!!

    Quote Originally Posted by anglina View Post
    its simple, the font you are using is not present in device.. try to use native fonts.
    is that mean I can't add any font except that present in device ??

    because I used the code in that link http://wiki.forum.nokia.com/index.php/Custom_font
    and i'm not get the needed font ,
    can any one help me if there is way to add fonts that's not in deice, especially arabic fonts ?
    thanks in advance
    Last edited by Nourayn; 2009-04-06 at 08:10.

Similar Threads

  1. Uninstall problem with TTF font on 3rd edition
    By amitkankani in forum Symbian User Interface
    Replies: 0
    Last Post: 2006-12-13, 12:01
  2. N90 Font Problem
    By S.S.Sudhakar in forum Symbian User Interface
    Replies: 0
    Last Post: 2006-03-02, 04:25
  3. custom font with midp2 application
    By kmsoomro in forum Mobile Java General
    Replies: 1
    Last Post: 2006-02-20, 15:04
  4. Problem of My custom Font in NG
    By victoryzj in forum Symbian
    Replies: 1
    Last Post: 2005-08-18, 11:52
  5. Problem of my custom Font in N-Gage
    By victoryzj in forum Symbian
    Replies: 0
    Last Post: 2004-09-05, 04:31

Posting Permissions

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