williamr@4: /* williamr@4: * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). williamr@4: * All rights reserved. williamr@4: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@4: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@4: * williamr@4: * Initial Contributors: williamr@4: * Nokia Corporation - initial contribution. williamr@4: * williamr@4: * Contributors: williamr@4: * williamr@4: * Description: williamr@4: * Interface for Series 60 font type, incorporating principles of series 60 layout williamr@4: * williamr@4: * williamr@4: */ williamr@4: williamr@4: williamr@4: #ifndef AKNLAYOUTFONT_H williamr@4: #define AKNLAYOUTFONT_H williamr@4: williamr@4: #include williamr@4: #include williamr@4: #include williamr@4: #include williamr@4: williamr@4: class CBitmapDevice; williamr@4: williamr@4: /** williamr@4: * This abstract class is a CFbsFont that can update itself (re-bind a font) and has standard williamr@4: * Series 60 layout API available. williamr@4: * williamr@4: * Concrete classes derived from this implement constructors and Update methods that williamr@4: * supply the specification required for the initially, and newly bound font, respectively. williamr@4: * Derived classes must also implement the CreateFont framework method in order to williamr@4: * implement the font binding itself. williamr@4: * williamr@4: * @lib avkon.dll williamr@4: * @since 2.8 williamr@4: * williamr@4: * @internal williamr@4: */ williamr@4: NONSHARABLE_CLASS(CAknLayoutFont) : public CFbsFont williamr@4: { williamr@4: williamr@4: public: williamr@4: /** williamr@4: * C++ Destructor. williamr@4: */ williamr@4: virtual ~CAknLayoutFont(); williamr@4: williamr@4: public: // New functions williamr@4: /** williamr@4: * Update this object's binding to a CFbsFont, using the member data of the derived class. williamr@4: * This method only needs to be called if the client owns the CAknLayoutFont williamr@4: * object, and there has been a layout switch that may affect the font. williamr@4: * williamr@4: * It is functionally equivalent to deleting the CAknLayoutFont object, and williamr@4: * reconstructing it with the same parameters. williamr@4: */ williamr@4: IMPORT_C void Update(); williamr@4: williamr@4: /** williamr@4: * Return the maximum extent of any pixel in the font upwards from the baseline williamr@4: * Measured up, so therefore it is a positive value. williamr@4: * williamr@4: * @return maximum ascent of the font williamr@4: */ williamr@4: IMPORT_C TInt MaxAscent() const; williamr@4: williamr@4: /** williamr@4: * Return the maximum extent of any pixel in the font down the baseline williamr@4: * Measured down, so therefore it is usually a positive value. williamr@4: * williamr@4: * @return maximum descent of the font williamr@4: */ williamr@4: IMPORT_C TInt MaxDescent() const; williamr@4: williamr@4: /* williamr@4: * Position of the baseline measured down from the Series 60 layout text pane top williamr@4: * williamr@4: * @return distance from text pane top to baseline williamr@4: */ williamr@4: IMPORT_C TInt TextPaneTopToBaseline() const; williamr@4: williamr@4: /* williamr@4: * Position of the text pane bottom measured down from the baseline williamr@4: * williamr@4: * @return distance from text pane top to baseline williamr@4: */ williamr@4: IMPORT_C TInt BaselineToTextPaneBottom() const; williamr@4: williamr@4: /* williamr@4: * Series 60 text pane height. williamr@4: * Always equal to TextPaneTopToBaseline() + BaselineToTextPaneBottom() williamr@4: * williamr@4: * @return text pane height williamr@4: */ williamr@4: IMPORT_C TInt TextPaneHeight() const; williamr@4: williamr@4: /** williamr@4: * This provides the baseline relative to the top of the combined font for a specific williamr@4: * character code. This value does not include any TopShortfall. williamr@4: **/ williamr@4: TInt AscentForCharacter( TChar aCharacter ) const; williamr@4: williamr@4: /** williamr@4: * Returns if a font pointer cast to this type if the actual type conforms to this type. williamr@4: * williamr@4: * @returns NULL if the font does not conform to CAknLayoutFont. williamr@4: */ williamr@4: IMPORT_C static const CAknLayoutFont* AsCAknLayoutFontOrNull( const CFont* aFont ); williamr@4: williamr@4: /** williamr@4: * Returns an object describing how the text with this font is to be decorated williamr@4: * williamr@4: * @return text decoration metrics for the font williamr@4: */ williamr@4: IMPORT_C TAknTextDecorationMetrics TextDecorationMetrics() const; williamr@4: williamr@4: /** williamr@4: * Returns the Avkon font category (EAknFontCategoryPrimary, EAknFontCategorySecondary...) williamr@4: * that was used to generate this font. williamr@4: * williamr@4: * @return font category williamr@4: */ williamr@4: IMPORT_C TAknFontCategory FontCategory() const; williamr@4: williamr@4: /** williamr@4: * This API allows the font to provide the metrics under which the font was requested. williamr@4: * williamr@4: * @return the font specification for which the font has been supplied williamr@4: */ williamr@4: IMPORT_C TAknFontSpecification FontSpecification() const; williamr@4: williamr@4: public: // Functions from CFont williamr@4: williamr@4: public:// Functions from CFbsFont williamr@4: williamr@4: TFontSpec DoFontSpecInTwips() const; williamr@4: williamr@4: protected: williamr@4: /** williamr@4: * C++ Constructor. williamr@4: */ williamr@4: CAknLayoutFont( CBitmapDevice& aScreenDevice ); williamr@4: CBitmapDevice& BitmapDevice() const; williamr@4: williamr@4: protected: // Internal methods williamr@4: williamr@4: void SetExcessAscent( TInt aExcessAscent ); williamr@4: void SetExcessDescent( TInt aExcessDescent ); williamr@4: void SetBottomShortfall( TInt aBottomShortfall ); williamr@4: void SetTextPaneHeight( TInt aTextPaneHeight ); williamr@4: williamr@4: private: // New Framework methods williamr@4: virtual CFbsFont* SupplyFont() = 0; williamr@4: virtual TInt DoAscentForCharacter( TChar aCharacter ) const; williamr@4: virtual TAknTextDecorationMetrics DoTextDecorationMetrics() const = 0; williamr@4: virtual TAknFontSpecification DoFontSpecification() const = 0; williamr@4: virtual void CAknLayoutFont_Reserved_1(); williamr@4: williamr@4: private: williamr@4: void Register(); williamr@4: void Deregister(); williamr@4: williamr@4: private: williamr@4: williamr@4: CFbsFont* iNonDynamicFont; williamr@4: CBitmapDevice& iScreenDevice; williamr@4: TInt iExcessAscent; williamr@4: TInt iExcessDescent; williamr@4: TInt iBottomShortfall; williamr@4: TInt iTextPaneHeight; williamr@4: TInt iSpare; williamr@4: }; williamr@4: williamr@4: williamr@4: #endif //AKNLAYOUTFONT_H