×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Apr 2005
    Posts
    162

    How to get the name of the used font

    Hi everybody,

    I want to get the fontype of a label. my sourcecode:

    ......

    iLabel = new (ELeave) CEikLabel;
    iLabel -> SetContainerWindowL(*this);
    iLabel -> SetTextL( _L("Example Text"));

    const CFont * font;
    font = iLabel -> Font();

    /*** according to the class reference of symbian this creates a new object called font with the attributes of the class CFont.
    Furthermore this new object contains the font-attributes of the label iLabel.
    I wanted to print the name of the used font.
    ****/

    //the question marks are for the unknown method
    //which get-method gives me the name of the font?
    //the result type has to be a char (i think)

    TText font_var = font.???;

    //create a buffer to fill with the name of the font:

    TBuf16<16> font_buffer(font_var);
    TPtrC font_zeiger;
    font_zeiger.Set(font_buffer);

    //create a new label for printing the name of the font:

    fontLabel = new (ELeave) CEikLabel;
    fontLabel -> SetContainerWindowL(*this);
    fontLabel -> SetTextL( _L(font_zeiger));

    ......


    If you knew a better way to get the name of a used font, tell me please or give me a documentation about it.

    Please help me, i think it's easy for you.

    Best regards

    Christian

  2. #2
    Regular Contributor
    Join Date
    Oct 2004
    Posts
    321

    Smile Re: How to get the name of the used font

    Hi,

    this may help u


    TFontSpec oFontSpec = poFont->FontSpecInTwips() ;

    oFontSpec.iTypeface.iName will give u the font name.


    BR
    VK

Posting Permissions

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