MTmCustom Class Reference

#include <tagma.h>

Link against: tagma.lib

class MTmCustom : public MLineBreaker, public MLineBreaker

Inherits from

  • MTmCustom

    Nested Classes and Structures

    Public Member Enumerations
    enumanonymous { EOpLineBreakClass, EClLineBreakClass, EQuLineBreakClass, EGlLineBreakClass, ..., ELineBreakClasses }
    Public Member Functions
    virtual IMPORT_C voidDrawBackground(CGraphicsContext &, const TPoint &, const TRect &, const TLogicalRgb &, TRect &)
    virtual IMPORT_C voidDrawLineGraphics(CGraphicsContext &, const TPoint &, const TRect &, const TTmLineInfo &)
    virtual IMPORT_C voidDrawPicture(CGraphicsContext &, const TPoint &, const TRect &, MGraphicsDeviceMap &, const CPicture &)
    virtual IMPORT_C voidDrawText(CGraphicsContext &, const TPoint &, const TRect &, const TTmLineInfo &, const TTmCharFormat &, const TDesC &, const TPoint &, TInt)
    virtual IMPORT_C TBoolGetLineBreakInContext(const TDesC &, TInt, TInt, TBool, TInt &)
    virtual IMPORT_C TBoolIsHangingCharacter(TUint)
    virtual IMPORT_C TUintLineBreakClass(TUint, TUint &, TUint &)
    virtual IMPORT_C TBoolLineBreakPossible(TUint, TUint, TBool)
    virtual IMPORT_C TUintMap(TUint)
    IMPORT_C voidSetBrushColor(CGraphicsContext &, TLogicalRgb)
    virtual IMPORT_C voidSetLineHeight(const TLineHeightParam &, TInt &, TInt &)
    IMPORT_C voidSetPenColor(CGraphicsContext &, TLogicalRgb)
    virtual IMPORT_C TIntStretch(TUint)
    virtual IMPORT_C TRgbSystemColor(TUint, TRgb)
    IMPORT_C TRgbSystemColor(TLogicalRgb)
    Inherited Enumerations
    MLineBreaker:@59
    Inherited Functions
    MLineBreaker::ExtendedInterface(TUid &)const
    MLineBreaker::GetLineBreak(const TDesC16 &,TInt,TInt,TBool,MContingentLineBreaker *,TInt &,TInt &)const
    MLineBreaker::GetLineBreakL(const TDesC16 &,TInt,TInt,TBool,MContingentLineBreakerL *,TInt &,TInt &)const

    Detailed Description

    The text customization interface. You can customize the colors, word spacing, line breaking, line height calculation, background drawing, and text appearance, of a text object by supplying an implementation of the MTmCustom class, either directly (as in CTmText::CustomizeL, which takes a pointer to MTmCustom) or indirectly, making use of the fact that MTmSource is derived from MTmCustom (as in CTmTextLayout::SetTextL, which takes a reference to MTmSource).

    Member Enumeration Documentation

    Enum anonymous

    The Unicode line breaking classes; see Unicode Technical Report 14. Not a named enumerated type, so that overriding applications can add new line breaking classes freely. The description of each constant gives the name of the line-breaking class, an example and a brief, imprecise description of the default behaviour of characters of that class.

    EnumeratorValueDescription
    EOpLineBreakClass

    Opening Punctuation (e.g. '['). Breaking after prohibited.

    EClLineBreakClass

    Closing Punctuation (e.g. ']'). Breaking before prohibited.

    EQuLineBreakClass

    Ambiguous Quotes (e.g. '"'). Breaking before and after prohibited.

    EGlLineBreakClass

    Glue (e.g. Non-breaking space). Breaking before and after prohibited unless spaces are present.

    ENsLineBreakClass

    Non-Starter (e.g. small Japanese kana). Breaking before prohibited if no spaces present.

    EExLineBreakClass

    Exclamation or Interrogation (e.g. '?'). Like closing punctuation except before Postfix or Non-starter.

    ESyLineBreakClass

    Symbol (e.g. '/'. Like Alphabetic, but allows breaking before Alphabetic.

    EIsLineBreakClass

    Numeric Infix Separator (e.g. ','). Forbids breaking after any and before Numeric.

    EPrLineBreakClass

    Numeric Prefix (e.g. '$'). Forbids breaking before Numeric.

    EPoLineBreakClass

    Numeric Postfix (e.g. ''). Forbids breaking after Numeric.

    ENuLineBreakClass

    Numeric (e.g. '1').

    EAlLineBreakClass

    Alphabetic (e.g. 'a').

    EIdLineBreakClass

    Ideographic (e.g. Japanese Kanji). Generally break before or after

    EInLineBreakClass

    Inseparable (e.g. ellipsis). Forbid breaks between Inseparables.

    EHyLineBreakClass

    Hyphen (e.g. '-'). Allows a break after except before Numeric.

    EBaLineBreakClass

    Break After. Generally allow a break after. Breaking between Break Afters not separated by spaces is prohibited.

    EBbLineBreakClass

    Break Before. Generally allow a break before. Breaking between Break Befores not separated by spaces is prohibited.

    EB2LineBreakClass

    Break Before and After. Generally allow a break before or after. Breaking between Break Before and Afters is prohibited, even if spaces are present.

    EZwLineBreakClass

    Zero-Width Space. Allow a break.

    ECmLineBreakClass

    Combining Mark. Takes on the class of its base class.

    EBkLineBreakClass

    Mandatory Break.

    ECrLineBreakClass

    Carriage Return. Break after unless part of a CRLF pair.

    ELfLineBreakClass

    Line Feed. Break after.

    ESgLineBreakClass

    Surrogate. Half of a surrogate pair.

    ECbLineBreakClass

    Contingent Break (e.g. embedded pictures). Uses external information

    ESpLineBreakClass

    Space. Intervening characters of class Space are indicated by aHaveSpaces in LineBreakPossible.

    ESaLineBreakClass

    Complex Context (e.g. Thai). Runs of Complex Context are passed to GetLineBreakInContext.

    EAiLineBreakClass

    Ambiguous. Characters of ambiguous East Asian width are treated as Alphabetic, unless they are resolved as being "Wide", in which case they are treated as Ideographic.

    EXxLineBreakClass

    The Xx class is used when the class is unknown; e.g.; outside the provided context.

    ELineBreakClasses

    The number of Unicode line break classes.

    Member Function Documentation

    DrawBackground ( CGraphicsContext &, const TPoint &, const TRect &, const TLogicalRgb &, TRect & )

    IMPORT_C voidDrawBackground(CGraphicsContext &aGc,
    const TPoint &aTextLayoutTopLeft,
    const TRect &aRect,
    const TLogicalRgb &aBackground,
    TRect &aRectDrawn
    )const [virtual]

    The default function to drawn the background. It fills the supplied rectangle with the background colour.

    DrawLineGraphics ( CGraphicsContext &, const TPoint &, const TRect &, const TTmLineInfo & )

    IMPORT_C voidDrawLineGraphics(CGraphicsContext &aGc,
    const TPoint &aTextLayoutTopLeft,
    const TRect &aRect,
    const TTmLineInfo &aLineInfo
    )const [virtual]

    By default no line graphics are drawn.

    DrawPicture ( CGraphicsContext &, const TPoint &, const TRect &, MGraphicsDeviceMap &, const CPicture & )

    IMPORT_C voidDrawPicture(CGraphicsContext &aGc,
    const TPoint &aTextLayoutTopLeft,
    const TRect &aRect,
    MGraphicsDeviceMap &aDevice,
    const CPicture &aPicture
    )const [virtual]

    Draw the picture onto the graphics context.

    See also: CPicture::Draw

    Parameters
    aGcThe graphics context.
    aTextLayoutTopLeftCoordinates of the top left corner pixel of the picture.
    aRectA clipping rectangle that defines the area to draw the picture.
    aDeviceThe device map for the graphics device. It provides the scaling to apply to the picture.
    aPictureThe drawable object.

    DrawText ( CGraphicsContext &, const TPoint &, const TRect &, const TTmLineInfo &, const TTmCharFormat &, const TDesC &, const TPoint &, TInt )

    IMPORT_C voidDrawText(CGraphicsContext &aGc,
    const TPoint &aTopLeft,
    const TRect &aRect,
    const TTmLineInfo &aLineInfo,
    const TTmCharFormat &aFormat,
    const TDesC &aText,
    const TPoint &aTextOrigin,
    TIntaExtraPixels
    )const [virtual]

    Draw text and its highlit background if any. The text should be drawn with its origin at aTextOrigin after optionally drawing the background in aRect; and the text should be expanded in width by aExtraPixels, normally by using letterspacing. The default function draws the text with no special effects and supports standard and rounded highlighting only. The font, colour, and text style, which are specified in aFormat, have already been selected into the graphics context.

    GetLineBreakInContext ( const TDesC &, TInt, TInt, TBool, TInt & )

    IMPORT_C TBoolGetLineBreakInContext(const TDesC &aText,
    TIntaMinBreakPos,
    TIntaMaxBreakPos,
    TBoolaForwards,
    TInt &aBreakPos
    )const [virtual]

    Reimplemented from MLineBreaker::GetLineBreakInContext(const TDesC16 &,TInt,TInt,TBool,TInt &)const

    Gets the position of the first or last possible line break position in a text string. This function is called instead of LineBreakPossible() for runs of characters of class ESaLineBreakClass. It is used for languages like Thai, Lao and Khmer that have no spaces between words, so that line breaks must be calculated using dictionary lookup or a linguistic algorithm. Only the Thai language is supported in this implementation, i.e. this function will return false for other languages.

    See also: MLineBreaker::GetLineBreakInContext()

    Parameters
    aTextA string containing characters of class ESaLineBreakClass.
    aMinBreakPosA position within aText at which to begin searching for a possible line break position.
    aMaxBreakPosA position within aText at which to stop searching for a possible line break position.
    aForwardsIf ETrue, the function gets the first possible line break position (searches forwards from aMinBreakPos); if EFalse, gets the last one (searches backwards from aMaxBreakPos).
    aBreakPosOn return, the position of the first or last possible line break within aText. This must be greater than zero and less than aText.Length()1, and must also be in the range aMinBreakPos to aMaxBreakPos.
    Return Value
    ETrue if a possible line break position is found, EFalse if not.

    IsHangingCharacter ( TUint )

    IMPORT_C TBoolIsHangingCharacter(TUintaChar)const [virtual]

    Reimplemented from MLineBreaker::IsHangingCharacter(TUint)const

    Tests whether a character may be positioned outside the right margin. This function is provided to allow customisation of the line breaking behaviour for closing punctuation in Japanese. Any characters for which this function returns ETrue are allowed to overhang the right margin. The rest will be moved to the next line.

    The default implementation of this function just returns false.

    See also: MLineBreaker::IsHangingCharacter()

    Parameters
    aCharThe Unicode character code of interest.
    Return Value
    ETrue if the character specified can overhang the right margin, EFalse if not.

    LineBreakClass ( TUint, TUint &, TUint & )

    IMPORT_C TUintLineBreakClass(TUintaCode,
    TUint &aRangeStart,
    TUint &aRangeEnd
    )const [virtual]

    Reimplemented from MLineBreaker::LineBreakClass(TUint,TUint &,TUint &)const

    Converts Unicode character into line breaking class.

    See also: MLineBreaker::LineBreakClass()

    Parameters
    aCodeInput Unicode value.
    aRangeStartReturns the start of the contiguous range of characters including aCode that have the returned line breaking class.
    aRangeEndReturns the end of the contiguous range of characters including aCode that have the returned line breaking class.
    Return Value
    The line breaking class for aCode.

    LineBreakPossible ( TUint, TUint, TBool )

    IMPORT_C TBoolLineBreakPossible(TUintaPrevClass,
    TUintaNextClass,
    TBoolaHaveSpaces
    )const [virtual]

    Reimplemented from MLineBreaker::LineBreakPossible(TUint,TUint,TBool)const

    Returns whether line break is possible between two characters.

    See also: MLineBreaker::LineBreakPossible()

    Parameters
    aPrevClassThe class before the potential line break.
    aNextClassThe class after the potential line break.
    aHaveSpacesWhether spaces separate the characters.
    Return Value
    ETrue if a line break is possible between characters with the two line break classes, EFalse if not.

    Map ( TUint )

    IMPORT_C TUintMap(TUintaChar)const [virtual]

    The default function to map a character to the character drawn, or to 0xFFFF if the character is not to be drawn.

    SetBrushColor ( CGraphicsContext &, TLogicalRgb )

    IMPORT_C voidSetBrushColor(CGraphicsContext &aGc,
    TLogicalRgbaColor
    )const

    Sets the brush colour. The brush is used for filling shapes and the background of text boxes. The brush has colour, style, pattern and pattern origin parameters. If no brush colour has been set, it defaults to white. However the default brush style is null, so when drawing to a window the default appears to be the window's background colour.

    See also: CGraphicsContext::SetDrawMode()

    Parameters
    aColorThe logical colour for the brush.

    SetLineHeight ( const TLineHeightParam &, TInt &, TInt & )

    IMPORT_C voidSetLineHeight(const TLineHeightParam &aParam,
    TInt &aAscent,
    TInt &aDescent
    )const [virtual]

    The default function to set the line height.

    SetPenColor ( CGraphicsContext &, TLogicalRgb )

    IMPORT_C voidSetPenColor(CGraphicsContext &aGc,
    TLogicalRgbaColor
    )const

    Sets the pen colour. The pen is used to draw lines, the outlines of filled shapes, and text.

    See also: CGraphicsContext::SetPenColor()

    Parameters
    aColorThe logical colour for the pen.

    Stretch ( TUint )

    IMPORT_C TIntStretch(TUintaChar)const [virtual]

    Return the level of stretchability; the relative desirability of inserting space after a character when fully justifying. A value of zero means that the character cannot be stretched. Higher values mean greater stretchability.

    SystemColor ( TUint, TRgb )

    IMPORT_C TRgbSystemColor(TUintaColorIndex,
    TRgbaDefaultColor
    )const [virtual]

    Convert a system colour index to a system colour, using or modifying the supplied default colour if desired.

    SystemColor ( TLogicalRgb )

    IMPORT_C TRgbSystemColor(TLogicalRgbaColor)const

    This function translates logical colours specified in FORM objects into real colours. It extracts the logical colour index stored in TLogicalRgb and invokes MtmCustom::SystemColor(TUint, TRgb) to convert the logical colour to real colour.

    Parameters
    aColorThe logical colour to translate.
    Return Value
    The real colour represesented by the logical colour.