os/textandloc/fontservices/textshaperplugin/IcuSource/layout/ThaiLayoutEngine.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
sl@0
     2
/*
sl@0
     3
 *
sl@0
     4
 * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
sl@0
     5
 *
sl@0
     6
 */
sl@0
     7
sl@0
     8
#ifndef __THAILAYOUTENGINE_H
sl@0
     9
#define __THAILAYOUTENGINE_H
sl@0
    10
sl@0
    11
#include "LETypes.h"
sl@0
    12
#include "LEFontInstance.h"
sl@0
    13
#include "LayoutEngine.h"
sl@0
    14
sl@0
    15
#include "ThaiShaping.h"
sl@0
    16
sl@0
    17
U_NAMESPACE_BEGIN
sl@0
    18
sl@0
    19
class LEGlyphStorage;
sl@0
    20
sl@0
    21
/**
sl@0
    22
 * This class implements layout for the Thai script, using the ThaiShapingClass.
sl@0
    23
 * All existing Thai fonts use an encoding which assigns character codes to all
sl@0
    24
 * the variant forms needed to display accents and tone marks correctly in context.
sl@0
    25
 * This class can deal with fonts using the Microsoft, Macintosh, and WorldType encodings.
sl@0
    26
 *
sl@0
    27
 * @internal
sl@0
    28
 */
sl@0
    29
class ThaiLayoutEngine : public LayoutEngine
sl@0
    30
{
sl@0
    31
public:
sl@0
    32
    /**
sl@0
    33
     * This constructs an instance of ThaiLayoutEngine for the given font, script and
sl@0
    34
     * language. It examines the font, using LEFontInstance::canDisplay, to set fGlyphSet
sl@0
    35
     * and fErrorChar. (see below)
sl@0
    36
     *
sl@0
    37
     * @param fontInstance - the font
sl@0
    38
     * @param scriptCode - the script
sl@0
    39
     * @param languageCode - the language
sl@0
    40
     *
sl@0
    41
     * @see LEFontInstance
sl@0
    42
     * @see ScriptAndLanguageTags.h for script and language codes
sl@0
    43
     *
sl@0
    44
     * @internal
sl@0
    45
     */
sl@0
    46
    ThaiLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags);
sl@0
    47
sl@0
    48
    /**
sl@0
    49
     * The destructor, virtual for correct polymorphic invocation.
sl@0
    50
     *
sl@0
    51
     * @internal
sl@0
    52
     */
sl@0
    53
    virtual ~ThaiLayoutEngine();
sl@0
    54
sl@0
    55
    /**
sl@0
    56
     * ICU "poor man's RTTI", returns a UClassID for the actual class.
sl@0
    57
     *
sl@0
    58
     * @stable ICU 2.8
sl@0
    59
     */
sl@0
    60
    virtual UClassID getDynamicClassID() const;
sl@0
    61
sl@0
    62
    /**
sl@0
    63
     * ICU "poor man's RTTI", returns a UClassID for this class.
sl@0
    64
     *
sl@0
    65
     * @stable ICU 2.8
sl@0
    66
     */
sl@0
    67
    static UClassID getStaticClassID();
sl@0
    68
sl@0
    69
protected:
sl@0
    70
    /**
sl@0
    71
     * A small integer indicating which Thai encoding
sl@0
    72
     * the font uses.
sl@0
    73
     *
sl@0
    74
     * @see ThaiShaping
sl@0
    75
     *
sl@0
    76
     * @internal
sl@0
    77
     */
sl@0
    78
    le_uint8 fGlyphSet;
sl@0
    79
sl@0
    80
    /**
sl@0
    81
     * The character used as a base for vowels and
sl@0
    82
     * tone marks that are out of sequence. Usually
sl@0
    83
     * this will be Unicode 0x25CC, if the font can
sl@0
    84
     * display it.
sl@0
    85
     *
sl@0
    86
     * @see ThaiShaping
sl@0
    87
     *
sl@0
    88
     * @internal
sl@0
    89
     */
sl@0
    90
    LEUnicode fErrorChar;
sl@0
    91
sl@0
    92
    /**
sl@0
    93
     * This method performs Thai layout. It calls ThaiShaping::compose to
sl@0
    94
     * generate the correct contextual character codes, and then calls
sl@0
    95
     * mapCharsToGlyphs to generate the glyph indices.
sl@0
    96
     *
sl@0
    97
     * Input parameters:
sl@0
    98
     * @param chars - the input character context
sl@0
    99
     * @param offset - the index of the first character to process
sl@0
   100
     * @param count - the number of characters to process
sl@0
   101
     * @param max - the number of characters in the input context
sl@0
   102
     * @param rightToLeft - <code>TRUE</code> if the text is in a right to left directional run
sl@0
   103
     * @param glyphStorage - the glyph storage object. The glyph and char index arrays will be set.
sl@0
   104
     *
sl@0
   105
     * Output parameters:
sl@0
   106
     * @param success - set to an error code if the operation fails
sl@0
   107
     *
sl@0
   108
     * @return the number of glyphs in the glyph index array
sl@0
   109
     *
sl@0
   110
     * @see ThaiShaping
sl@0
   111
     *
sl@0
   112
     * @internal
sl@0
   113
     */
sl@0
   114
    virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
sl@0
   115
        LEGlyphStorage &glyphStorage, LEErrorCode &success);
sl@0
   116
sl@0
   117
};
sl@0
   118
sl@0
   119
U_NAMESPACE_END
sl@0
   120
#endif
sl@0
   121