×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    119

    Using the font from setting list in custom listbox

    Hello,

    In my application I have a standard settings list and a custom listbox (I provide my own implementation of the item drawer). I would like my custom listbox to use the same fonts as the settings list does (primary and secondary). How can I retrieve the CFont that the settings list uses? Currently I am using this code:

    Code:
    const CAknLayoutFont * priFont = AknLayoutUtils::LayoutFontFromId (EAknLogicalFontPrimaryFont);
    const CAknLayoutFont * secFont = AknLayoutUtils::LayoutFontFromId (EAknLogicalFontPrimarySmallFont);
    But the font drawed is larger the the font used by the settings list and it is more bolded...

    EDIT:

    I've found out that the problem is due to phone settings - whether the font size is set to small, normal or large. Only when the size is set to normal, setting the custom list font through:

    const CAknLayoutFont * priFont = AknLayoutUtils::LayoutFontFromId (EAknLogicalFontPrimaryFont);
    const CAknLayoutFont * secFont = AknLayoutUtils::LayoutFontFromId (EAknLogicalFontSecondaryFont);

    ... gives correct results. However when the font size is set to small or large, the standard settings list reflects that and the custom list doesn't. I just want the custom list font to behave exactly like in a standard component.

    EDIT2:

    This is definitely a problem with the Logical Font API - it doesn't take into account the phone settings (font size small/normal/large) when returning a font. It always returns a normal size font.

    Any ideas how to work this issue out?

    Thanks for your help.
    Maciej
    Last edited by alav; 2008-01-28 at 12:31.

  2. #2
    Registered User
    Join Date
    Nov 2003
    Posts
    6

    Re: Using the font from setting list in custom listbox

    You can get access global zoom settings using the below code:

    TAknUiZoom currentGlobalZoom;
    CAknEnv::Static()->GetCurrentGlobalUiZoom( currentGlobalZoom );

    that code can be executed from: HandleResourceChangeL when you get the notification about the font change.

    then based on the returned value you can calculate desired font height and assign it to font spec.

    i.e.
    TFontSpec fontSpec = primarySmallFont->FontSpecInTwips();
    fontSpec.iHeight = calculateZoomedFontHeight( currentGlobalZoom, primarySmallFont->FontSpecInTwips().iHeight );

Similar Threads

  1. Enable Skin with Custom List Box
    By hmleung in forum Symbian User Interface
    Replies: 5
    Last Post: 2007-11-12, 09:55
  2. Partly dynamically setting list problem
    By kaiten-sushi in forum Symbian User Interface
    Replies: 3
    Last Post: 2007-05-09, 16:22
  3. Open Setting List when click on menu/submenu command ???
    By chandantheracer in forum Symbian User Interface
    Replies: 1
    Last Post: 2007-01-29, 09:29
  4. Using skins! Custom Listbox / Custom ListItemDrawer
    By akrapacs in forum Symbian User Interface
    Replies: 1
    Last Post: 2007-01-22, 10:05
  5. Get Value of Setting List
    By hendrawan.ashari in forum Symbian C++
    Replies: 4
    Last Post: 2006-12-22, 04:32

Posting Permissions

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