os/textandloc/fontservices/textshaperplugin/IcuSource/layout/GXLayoutEngine.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
sl@0
     2
/*
sl@0
     3
 *
sl@0
     4
 * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
sl@0
     5
 *
sl@0
     6
 */
sl@0
     7
sl@0
     8
#ifndef __GXLAYOUTENGINE_H
sl@0
     9
#define __GXLAYOUTENGINE_H
sl@0
    10
sl@0
    11
#include "LETypes.h"
sl@0
    12
#include "LayoutEngine.h"
sl@0
    13
sl@0
    14
#include "MorphTables.h"
sl@0
    15
sl@0
    16
U_NAMESPACE_BEGIN
sl@0
    17
sl@0
    18
class LEFontInstance;
sl@0
    19
class LEGlyphStorage;
sl@0
    20
sl@0
    21
/**
sl@0
    22
 * This class implements layout for QuickDraw GX or Apple Advanced Typograyph (AAT)
sl@0
    23
 * fonts. A font is a GX or AAT font if it contains a 'mort' table. See Apple's
sl@0
    24
 * TrueType Reference Manual (http://fonts.apple.com/TTRefMan/index.html) for details.
sl@0
    25
 * Information about 'mort' tables is in the chapter titled "Font Files."
sl@0
    26
 *
sl@0
    27
 * @internal
sl@0
    28
 */
sl@0
    29
class GXLayoutEngine : public LayoutEngine
sl@0
    30
{
sl@0
    31
public:
sl@0
    32
    /**
sl@0
    33
     * This is the main constructor. It constructs an instance of GXLayoutEngine for
sl@0
    34
     * a particular font, script and language. It takes the 'mort' table as a parameter since
sl@0
    35
     * LayoutEngine::layoutEngineFactory has to read the 'mort' table to know that it has a
sl@0
    36
     * GX font.
sl@0
    37
     *
sl@0
    38
     * Note: GX and AAT fonts don't contain any script and language specific tables, so
sl@0
    39
     * the script and language are ignored.
sl@0
    40
     *
sl@0
    41
     * @param fontInstance - the font
sl@0
    42
     * @param scriptCode - the script
sl@0
    43
     * @param langaugeCode - the language
sl@0
    44
     * @param morphTable - the 'mort' table
sl@0
    45
     *
sl@0
    46
     * @see LayoutEngine::layoutEngineFactory
sl@0
    47
     * @see ScriptAndLangaugeTags.h for script and language codes
sl@0
    48
     *
sl@0
    49
     * @internal
sl@0
    50
     */
sl@0
    51
    GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const MorphTableHeader *morphTable);
sl@0
    52
sl@0
    53
    /**
sl@0
    54
     * The destructor, virtual for correct polymorphic invocation.
sl@0
    55
     *
sl@0
    56
     * @internal
sl@0
    57
     */
sl@0
    58
    virtual ~GXLayoutEngine();
sl@0
    59
sl@0
    60
    /**
sl@0
    61
     * ICU "poor man's RTTI", returns a UClassID for the actual class.
sl@0
    62
     *
sl@0
    63
     * @stable ICU 2.8
sl@0
    64
     */
sl@0
    65
    virtual UClassID getDynamicClassID() const;
sl@0
    66
sl@0
    67
    /**
sl@0
    68
     * ICU "poor man's RTTI", returns a UClassID for this class.
sl@0
    69
     *
sl@0
    70
     * @stable ICU 2.8
sl@0
    71
     */
sl@0
    72
    static UClassID getStaticClassID();
sl@0
    73
sl@0
    74
protected:
sl@0
    75
sl@0
    76
    /**
sl@0
    77
     * The address of the 'mort' table
sl@0
    78
     *
sl@0
    79
     * @internal
sl@0
    80
     */
sl@0
    81
    const MorphTableHeader *fMorphTable;
sl@0
    82
sl@0
    83
    /**
sl@0
    84
     * This method does GX layout using the font's 'mort' table. It converts the
sl@0
    85
     * input character codes to glyph indices using mapCharsToGlyphs, and then
sl@0
    86
     * applies the 'mort' table.
sl@0
    87
     *
sl@0
    88
     * Input parameters:
sl@0
    89
     * @param chars - the input character context
sl@0
    90
     * @param offset - the index of the first character to process
sl@0
    91
     * @param count - the number of characters to process
sl@0
    92
     * @param max - the number of characters in the input context
sl@0
    93
     * @param rightToLeft - <code>TRUE</code> if the text is in a right to left directional run
sl@0
    94
     * @param glyphStorage - the glyph storage object. The glyph and char index arrays will be set.
sl@0
    95
     *
sl@0
    96
     * Output parameters:
sl@0
    97
     * @param success - set to an error code if the operation fails
sl@0
    98
     *
sl@0
    99
     * @return the number of glyphs in the glyph index array
sl@0
   100
     *
sl@0
   101
     * @internal
sl@0
   102
     */
sl@0
   103
    virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
sl@0
   104
        LEGlyphStorage &glyphStorage, LEErrorCode &success);
sl@0
   105
sl@0
   106
    /**
sl@0
   107
     * This method adjusts the glyph positions using the font's
sl@0
   108
     * 'kern', 'trak', 'bsln', 'opbd' and 'just' tables.
sl@0
   109
     *
sl@0
   110
     * Input parameters:
sl@0
   111
     * @param glyphStorage - the object holding the glyph storage. The positions will be updated as needed.
sl@0
   112
     *
sl@0
   113
     * Output parameters:
sl@0
   114
     * @param success - set to an error code if the operation fails
sl@0
   115
     *
sl@0
   116
     * @internal
sl@0
   117
     */
sl@0
   118
    virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse,
sl@0
   119
                                      LEGlyphStorage &glyphStorage, LEErrorCode &success);
sl@0
   120
sl@0
   121
};
sl@0
   122
sl@0
   123
U_NAMESPACE_END
sl@0
   124
#endif
sl@0
   125