Font Size
| Wed, 2005-07-20 11:28 | |
|
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. |
|






Forum posts: 46
Here is some sample code based on one of the series 60 examples:
  {
  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.