×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    2

    Custom font becomes the default font (Nokia 9210/9500)

    I have tried to install a custom .ttf font either by copying it to c:\system\fonts or by loading it manually using CWsScreenDevice::AddFile(). The font works in my application (I use CEikRichTextEditor), but it also becomes the default font in the help viewer and the built-in spreadsheet application. This is not acceptable, since my font contains symbols mapped to letters.

    Why is this happening and is there a way to prevent this? I'd like to use a custom font in my application without affecting other applications.

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166
    just use CGraphicsDevice and load the font to CFont and use it as a font when needed.

    yucca

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    2
    Thanks for the suggestion.

    I have considered using CFont, but I can't find a way of using CFont with a CEikRichTextEditor object. Reworking my code to not depend on CEikRichTextEditor would be a lot of work.

    I think I would need to replace the CTextView instance used by CEikRichTextEditor with a custom instance that provided the needed CFont object, but I'm not sure if that is possible.

    Another interesting piece of information: After some experimentation it seems that only some true type fonts replace the default font. I am trying to find another font that works, but so far I haven't been lucky.

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166
    ok, here's something abit similar, so try to modify this to fit into your purpose:

    //-- start of code
    void CMGMessageContainer::SetMyFontL(TInt aResourceID)
    {
    if(!iGTextEd)
    return;

    TFontSpec* fontSpec = CreateFontSpecFromResourceL(aResourceID);
    CleanupStack::PushL(fontSpec);

    TCharFormat charFormat;
    TCharFormatMask charFormatMask;
    CFont* editorFont = iCoeEnv->CreateScreenFontL(*fontSpec);
    CleanupStack::PushL(editorFont);

    charFormat.iFontSpec = editorFont->FontSpecInTwips();
    charFormatMask.SetAll();

    iGTextEd->ApplyCharFormatL(charFormat, charFormatMask);

    iCoeEnv->ReleaseScreenFont(editorFont);

    CleanupStack::Pop(2);// editorFont,fontSpec
    delete fontSpec;

    iGTextEd->DrawNow();
    }

    //-- end of code

    yucca

Posting Permissions

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