jdk/src/share/native/sun/font/layout/IndicLayoutEngine.h
author ohair
Tue, 25 May 2010 15:58:33 -0700
changeset 5506 202f599c92aa
parent 3935 afcdb712a9c5
child 7486 6a36b1ebc620
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3935
diff changeset
     6
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3935
diff changeset
     8
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3935
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3935
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3935
diff changeset
    22
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
#ifndef __INDICLAYOUTENGINE_H
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
#define __INDICLAYOUTENGINE_H
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
#include "LETypes.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
#include "LEFontInstance.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
#include "LEGlyphFilter.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
#include "LayoutEngine.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
#include "OpenTypeLayoutEngine.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
#include "GlyphSubstitutionTables.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
#include "GlyphDefinitionTables.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
#include "GlyphPositioningTables.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    46
U_NAMESPACE_BEGIN
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    47
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
class MPreFixups;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
class LEGlyphStorage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * This class implements OpenType layout for Indic OpenType fonts, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * specified by Microsoft in "Creating and Supporting OpenType Fonts for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * Indic Scripts" (http://www.microsoft.com/typography/otspec/indicot/default.htm)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * This class overrides the characterProcessing method to do Indic character processing
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * and reordering, and the glyphProcessing method to implement post-GSUB processing for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * left matras. (See the MS spec. for more details)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
class IndicOpenTypeLayoutEngine : public OpenTypeLayoutEngine
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
public:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * This is the main constructor. It constructs an instance of IndicOpenTypeLayoutEngine for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * a particular font, script and language. It takes the GSUB table as a parameter since
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * LayoutEngine::layoutEngineFactory has to read the GSUB table to know that it has an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * Indic OpenType font.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * @param fontInstance - the font
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * @param scriptCode - the script
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * @param langaugeCode - the language
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * @param gsubTable - the GSUB table
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * @see LayoutEngine::layoutEngineFactory
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * @see OpenTypeLayoutEngine
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * @see ScriptAndLangaugeTags.h for script and language codes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    82
    IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    83
                            le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * This constructor is used when the font requires a "canned" GSUB table which can't be known
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * until after this constructor has been invoked.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * @param fontInstance - the font
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * @param scriptCode - the script
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * @param langaugeCode - the language
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * @see OpenTypeLayoutEngine
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * @see ScriptAndLangaugeTags.h for script and language codes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    98
    IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    99
                              le_int32 typoFlags);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * The destructor, virtual for correct polymorphic invocation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
   virtual ~IndicOpenTypeLayoutEngine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   108
    /**
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   109
     * ICU "poor man's RTTI", returns a UClassID for the actual class.
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   110
     *
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   111
     * @stable ICU 2.8
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   112
     */
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   113
    virtual UClassID getDynamicClassID() const;
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   114
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   115
    /**
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   116
     * ICU "poor man's RTTI", returns a UClassID for this class.
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   117
     *
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   118
     * @stable ICU 2.8
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   119
     */
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   120
    static UClassID getStaticClassID();
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   121
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
protected:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * This method does Indic OpenType character processing. It assigns the OpenType feature
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * tags to the characters, and may generate output characters which have been reordered. For
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * some Indic scripts, it may also split some vowels, resulting in more output characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * than input characters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * Input parameters:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * @param chars - the input character context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * @param offset - the index of the first character to process
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * @param count - the number of characters to process
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * @param max - the number of characters in the input context
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   135
     * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   136
     * @param glyphStorage - the glyph storage object. The glyph and character index arrays will be set.
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   137
     *                       the auxillary data array will be set to the feature tags.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * Output parameters:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * @param success - set to an error code if the operation fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * @return the output character count
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   146
    virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   147
            LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * This method does character to glyph mapping, applies the GSUB table and applies
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * any post GSUB fixups for left matras. It calls OpenTypeLayoutEngine::glyphProcessing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * to do the character to glyph mapping, and apply the GSUB table.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * Note that in the case of "canned" GSUB tables, the output glyph indices may be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * "fake" glyph indices that need to be converted to "real" glyph indices by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * glyphPostProcessing method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * Input parameters:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * @param chars - the input character context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * @param offset - the index of the first character to process
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * @param count - the number of characters to process
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * @param max - the number of characters in the input context
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   163
     * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * @param featureTags - the feature tag array
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   165
     * @param glyphStorage - the glyph storage object. The glyph and char index arrays will be set.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * Output parameters:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * @param success - set to an error code if the operation fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * @return the number of glyphs in the output glyph index array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * Note: if the character index array was already set by the characterProcessing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * method, this method won't change it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   177
    virtual le_int32 glyphProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   178
            LEGlyphStorage &glyphStorage, LEErrorCode &success);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
private:
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   181
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    MPreFixups *fMPreFixups;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   185
U_NAMESPACE_END
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
#endif
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   187