classicui_pub/fonts_api/tsrc/src/testsdkfontsblocksfontaccess.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  test fonts api
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // [INCLUDE FILES]
       
    21 #include <e32svr.h>
       
    22 #include <stifparser.h>
       
    23 #include <stiftestinterface.h>
       
    24 
       
    25 #include <aknfontaccess.h> 
       
    26 #include <stringloader.h> 
       
    27 #include <gdi.h>
       
    28 
       
    29 #include "testsdkfonts.h"
       
    30 
       
    31 // CONSTANTS
       
    32 _LIT( Kstring, "test item");
       
    33 
       
    34 // ============================ MEMBER FUNCTIONS ===============================
       
    35 
       
    36 // -----------------------------------------------------------------------------
       
    37 // CTestSdkFonts::TestFAGetFont
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 
       
    41 TInt CTestSdkFonts::TestFAGetFont(CStifItemParser& /*aItem*/)
       
    42     {
       
    43     CWsScreenDevice* screenDev = CCoeEnv::Static()->ScreenDevice();
       
    44     TFontStyle fontStyle;
       
    45     TInt foundIndex( KErrNotFound );
       
    46     iFontAccess->GetFont( *screenDev,fontStyle,foundIndex,AknFontAccess::EAknFontFamilySansSerif );
       
    47     return KErrNone;
       
    48     }
       
    49 
       
    50 // -----------------------------------------------------------------------------
       
    51 // CTestSdkFonts::TestFAGetFontDesc
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 
       
    55 TInt CTestSdkFonts::TestFAGetFontDesc(CStifItemParser& /*aItem*/)
       
    56     {
       
    57     CWsScreenDevice* screenDev = CCoeEnv::Static()->ScreenDevice();
       
    58     TFontStyle fontStyle;
       
    59     TInt foundIndex( KErrNotFound );
       
    60     TDesC16 tmp = Kstring;
       
    61     iFontAccess->GetFont( *screenDev,fontStyle,foundIndex,tmp );
       
    62     return KErrNone;
       
    63     }
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // CTestSdkFonts::TestFAGetClosestFont
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 
       
    70 TInt CTestSdkFonts::TestFAGetClosestFont(CStifItemParser& /*aItem*/)
       
    71     {
       
    72     CWsScreenDevice* screenDev = CCoeEnv::Static()->ScreenDevice();
       
    73     TFontStyle fontStyle;
       
    74     TInt foundIndex( KErrNotFound );
       
    75     iFontAccess->GetClosestFont( *screenDev,fontStyle,foundIndex,AknFontAccess::EAknFontFamilySansSerif );
       
    76     return KErrNone;
       
    77     
       
    78     }
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // CTestSdkFonts::TestFAGetClosestFontDesc
       
    82 // -----------------------------------------------------------------------------
       
    83 //
       
    84 
       
    85 TInt CTestSdkFonts::TestFAGetClosestFontDesc(CStifItemParser& /*aItem*/)
       
    86     {
       
    87     CWsScreenDevice* screenDev = CCoeEnv::Static()->ScreenDevice();
       
    88     TFontStyle fontStyle;
       
    89     TInt foundIndex( KErrNotFound );
       
    90     TDesC16 tmp = Kstring;
       
    91     iFontAccess->GetClosestFont( *screenDev,fontStyle,foundIndex,tmp );
       
    92     return KErrNone;
       
    93     
       
    94     }
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CTestSdkFonts::TestFACreateLayoutFontFromSpecificationL
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 
       
   101 TInt CTestSdkFonts::TestFACreateLayoutFontFromSpecificationL(CStifItemParser& /*aItem*/)
       
   102     {
       
   103     CWsScreenDevice* screenDev = CCoeEnv::Static()->ScreenDevice();
       
   104     TAknFontSpecification fontSpecification( 1 );
       
   105     iFontAccess->CreateLayoutFontFromSpecificationL( *screenDev, fontSpecification );
       
   106     return KErrNone;
       
   107     
       
   108     }
       
   109 // -----------------------------------------------------------------------------
       
   110 // CTestSdkFonts::TestFACreateLayoutFontFromSpecificationTTypefaceL
       
   111 // -----------------------------------------------------------------------------
       
   112 //
       
   113 
       
   114 TInt CTestSdkFonts::TestFACreateLayoutFontFromSpecificationTTypefaceL(CStifItemParser& /*aItem*/)
       
   115     {
       
   116     TTypeface* typeface=new ( ELeave )TTypeface();
       
   117     CleanupStack::PushL( typeface );
       
   118     CWsScreenDevice* screenDev = CCoeEnv::Static()->ScreenDevice();
       
   119     TAknFontSpecification fontSpecification( 1 );
       
   120     iFontAccess->CreateLayoutFontFromSpecificationL( *screenDev, *typeface, fontSpecification );
       
   121     CleanupStack::PopAndDestroy( typeface );
       
   122     return KErrNone;
       
   123     }
       
   124 
       
   125 // End of File