Font Size

Login to reply to this topic.
Wed, 2005-07-20 11:28
Joined: 2005-06-11
Forum posts: 85
   Hi,

     Can anyone please tell me ....How I can change the font size?

        _LIT(KMyText,"My Text");
        const CFont* myFont=iEikonEnv->NormalFont();
        gc.UseFont(myFont);
     
    gc.SetPenColor(KRgbRed);
     gc.DrawText(KMyText, TPoint(50,30));

if I am using TFontSpec....it is giving panic....please help.......

Regards
Pankaj


Wise People talk because they have something to say . Fools talk because thay have to say somthing.


Wed, 2005-07-20 15:58
Joined: 2005-05-09
Forum posts: 46
Re: Font Size
Where are you using TFontSpec? The code you've shown does not use it.

Here is some sample code based on one of the series 60 examples:

Code:
void CAknExEditorContainer::SetSystemFontL(TInt aFontEnum)
    {
    const CFont* editorFont = LatinPlain12();

    switch (aFontEnum)
        {
        case ELatinPlain12:
            editorFont = LatinPlain12();
            break;
        case ELatinBold12:
            editorFont = LatinBold12();
            break;
        default:
            return;
        }

    TCharFormat     charFormat;
    TCharFormatMask charFormatMask;

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

    // Set font to GlobalTextEditor
    iGTextEd->ApplyCharFormatL(charFormat, charFormatMask);

    // Change label text.
    TBuf<KBufLength> sizeText;
    TBuf<KBufLength> formatText;
    iCoeEnv->ReadResource(formatText, R_AKNEXEDITOR_CONTAINER4_LABEL_FORMAT_PT);
    sizeText.Format(formatText,
                     charFormat.iFontSpec.iHeight / KTwipsPerPoint);
    TBuf<KBufLength> labelText = charFormat.iFontSpec.iTypeface.iName;
    labelText.Append(sizeText);
    iLabel->SetTextL(labelText);
    iLabel->SetExtent(GTEXTED_LABEL_POS, iLabel->MinimumSize());
    }

I Hope this helps.
  • Login to reply to this topic.