classicui_pub/fonts_api/tsrc/src/testsdkfontsblockslayoutfont.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 "testsdkfonts.h"
       
    26 
       
    27 
       
    28 // ============================ MEMBER FUNCTIONS ===============================
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CTestSdkFonts::TestLFUpdateL
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 
       
    35 TInt CTestSdkFonts::TestLFUpdateL(CStifItemParser& /*aItem*/)
       
    36     {
       
    37     TAknFontSpecification fontSpec( ELatinPlain12 );
       
    38     CAknLayoutFont* layoutFont = AknLayoutUtils::
       
    39         CreateLayoutFontFromSpecificationL( fontSpec ); 
       
    40     layoutFont->Update();
       
    41     return KErrNone;
       
    42     
       
    43     }
       
    44 
       
    45 // -----------------------------------------------------------------------------
       
    46 // CTestSdkFonts::TestLFMaxAscentL
       
    47 // -----------------------------------------------------------------------------
       
    48 //
       
    49 
       
    50 TInt CTestSdkFonts::TestLFMaxAscentL(CStifItemParser& /*aItem*/)
       
    51     {
       
    52     TAknFontSpecification fontSpec( ELatinPlain12 );
       
    53     CAknLayoutFont* layoutFont = AknLayoutUtils::
       
    54                                 CreateLayoutFontFromSpecificationL( fontSpec ); 
       
    55     layoutFont->MaxAscent();
       
    56     return KErrNone;
       
    57     
       
    58     }
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // CTestSdkFonts::TestLFMaxDescentL
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 
       
    65 TInt CTestSdkFonts::TestLFMaxDescentL(CStifItemParser& /*aItem*/)
       
    66     {
       
    67     TAknFontSpecification fontSpec( ELatinPlain12 );
       
    68     CAknLayoutFont* layoutFont = AknLayoutUtils::
       
    69         CreateLayoutFontFromSpecificationL( fontSpec ); 
       
    70     layoutFont->MaxDescent();
       
    71     return KErrNone;
       
    72     
       
    73     }
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // CTestSdkFonts::TestLFTextPaneTopToBaselineL
       
    77 // -----------------------------------------------------------------------------
       
    78 //
       
    79 
       
    80 TInt CTestSdkFonts::TestLFTextPaneTopToBaselineL(CStifItemParser& /*aItem*/)
       
    81     {
       
    82     TAknFontSpecification fontSpec( ELatinPlain12 );
       
    83     CAknLayoutFont* layoutFont = AknLayoutUtils::
       
    84         CreateLayoutFontFromSpecificationL( fontSpec ); 
       
    85     layoutFont->TextPaneTopToBaseline();
       
    86     return KErrNone;
       
    87     
       
    88     }
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // CTestSdkFonts::TestLFBaselineToTextPaneBottomL
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 
       
    95 TInt CTestSdkFonts::TestLFBaselineToTextPaneBottomL(CStifItemParser& /*aItem*/)
       
    96     {
       
    97     TAknFontSpecification fontSpec( ELatinPlain12 );
       
    98     CAknLayoutFont* layoutFont = AknLayoutUtils::
       
    99                                 CreateLayoutFontFromSpecificationL( fontSpec ); 
       
   100     layoutFont->BaselineToTextPaneBottom();
       
   101     return KErrNone;
       
   102     
       
   103     }
       
   104 
       
   105 // -----------------------------------------------------------------------------
       
   106 // CTestSdkFonts::TestLFTextPaneHeightL
       
   107 // -----------------------------------------------------------------------------
       
   108 //
       
   109 
       
   110 TInt CTestSdkFonts::TestLFTextPaneHeightL(CStifItemParser& /*aItem*/)
       
   111     {
       
   112     TAknFontSpecification fontSpec( ELatinPlain12 );
       
   113     CAknLayoutFont* layoutFont = AknLayoutUtils::
       
   114                                 CreateLayoutFontFromSpecificationL( fontSpec ); 
       
   115     layoutFont->TextPaneHeight();
       
   116     return KErrNone;
       
   117     
       
   118     }
       
   119 
       
   120 // -----------------------------------------------------------------------------
       
   121 // CTestSdkFonts::TestLFAscentForCharacterL
       
   122 // -----------------------------------------------------------------------------
       
   123 //
       
   124 
       
   125 TInt CTestSdkFonts::TestLFAscentForCharacterL(CStifItemParser& /*aItem*/)
       
   126     {
       
   127     TAknFontSpecification fontSpec( ELatinPlain12 );
       
   128     CAknLayoutFont* layoutFont = AknLayoutUtils::
       
   129                                 CreateLayoutFontFromSpecificationL( fontSpec ); 
       
   130     layoutFont->TextPaneHeight();
       
   131     return KErrNone;
       
   132     
       
   133     }
       
   134 
       
   135 // -----------------------------------------------------------------------------
       
   136 // CTestSdkFonts::TestLFAsCAknLayoutFontOrNullL
       
   137 // -----------------------------------------------------------------------------
       
   138 //
       
   139 
       
   140 TInt CTestSdkFonts::TestLFAsCAknLayoutFontOrNullL(CStifItemParser& /*aItem*/)
       
   141     {
       
   142     const CFont* afont = CEikonEnv::Static()->NormalFont();
       
   143     TAknFontSpecification fontSpec( ELatinPlain12 );
       
   144     CAknLayoutFont* layoutFont = AknLayoutUtils::
       
   145                                 CreateLayoutFontFromSpecificationL( fontSpec ); 
       
   146     layoutFont->AsCAknLayoutFontOrNull( afont );
       
   147     return KErrNone;
       
   148     
       
   149     }
       
   150 // -----------------------------------------------------------------------------
       
   151 // CTestSdkFonts::TestLFTextDecorationMetricsL
       
   152 // -----------------------------------------------------------------------------
       
   153 //
       
   154 
       
   155 TInt CTestSdkFonts::TestLFTextDecorationMetricsL(CStifItemParser& /*aItem*/)
       
   156     {
       
   157     TAknFontSpecification fontSpec( ELatinPlain12 );
       
   158     CAknLayoutFont* layoutFont = AknLayoutUtils::
       
   159                                 CreateLayoutFontFromSpecificationL( fontSpec ); 
       
   160     layoutFont->TextDecorationMetrics();
       
   161     return KErrNone;
       
   162     
       
   163     }
       
   164 
       
   165 // -----------------------------------------------------------------------------
       
   166 // CTestSdkFonts::TestLFFontCategoryL
       
   167 // -----------------------------------------------------------------------------
       
   168 //
       
   169 
       
   170 TInt CTestSdkFonts::TestLFFontCategoryL(CStifItemParser& /*aItem*/)
       
   171     {
       
   172     TAknFontSpecification fontSpec( ELatinPlain12 );
       
   173     CAknLayoutFont* layoutFont = AknLayoutUtils::
       
   174                                 CreateLayoutFontFromSpecificationL( fontSpec ); 
       
   175     layoutFont->FontCategory();
       
   176     return KErrNone;
       
   177     }
       
   178 
       
   179 // -----------------------------------------------------------------------------
       
   180 // CTestSdkFonts::TestLFFontCategoryL
       
   181 // -----------------------------------------------------------------------------
       
   182 //
       
   183 
       
   184 TInt CTestSdkFonts::TestLFFontSpecificationL(CStifItemParser& /*aItem*/)
       
   185     {
       
   186     TAknFontSpecification fontSpec( ELatinPlain12 );
       
   187     CAknLayoutFont* layoutFont = AknLayoutUtils::
       
   188                                 CreateLayoutFontFromSpecificationL( fontSpec ); 
       
   189     layoutFont->FontSpecification();
       
   190     return KErrNone;
       
   191     }
       
   192 
       
   193 
       
   194 
       
   195 // End of File