jdk/src/share/native/sun/font/layout/KhmerLayoutEngine.h
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 2 90ce3da70b43
child 3935 afcdb712a9c5
permissions -rw-r--r--
Initial load
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
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * by Sun in the LICENSE file that accompanied this code.
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
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * have any questions.
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
 * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * This file is a modification of the ICU file IndicLayoutEngine.h
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * by Jens Herden and Javier Sola for Khmer language
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
#ifndef __KHMERLAYOUTENGINE_H
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
#define __KHMERLAYOUTENGINE_H
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
// #include "LETypes.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
// #include "LEFontInstance.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
// #include "LEGlyphFilter.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
// #include "LayoutEngine.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
// #include "OpenTypeLayoutEngine.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
// #include "GlyphSubstitutionTables.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
// #include "GlyphDefinitionTables.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
// #include "GlyphPositioningTables.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
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 Khmer OpenType fonts, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * specified by Microsoft in "Creating and Supporting OpenType Fonts
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * for Khmer Scripts"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * (http://www.microsoft.com/typography/otspec/indicot/default.htm)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * TODO: change url
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * This class overrides the characterProcessing method to do Khmer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * character processing and reordering (See the MS spec. for more
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * details)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
class KhmerOpenTypeLayoutEngine : public OpenTypeLayoutEngine
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
public:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * This is the main constructor. It constructs an instance of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * KhmerOpenTypeLayoutEngine for a particular font, script and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * language. It takes the GSUB table as a parameter since
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * LayoutEngine::layoutEngineFactory has to read the GSUB table to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * know that it has an Khmer OpenType font.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * @param fontInstance - the font
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * @param scriptCode - the script
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * @param languageCode - the language
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * @param gsubTable - the GSUB table
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * @see LayoutEngine::layoutEngineFactory
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * @see OpenTypeLayoutEngine
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * @see ScriptAndLangaugeTags.h for script and language codes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        const GlyphSubstitutionTableHeader *gsubTable);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * This constructor is used when the font requires a "canned" GSUB
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * table which can't be known until after this constructor has
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * been invoked.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * @param fontInstance - the font
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * @param scriptCode - the script
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * @param langaugeCode - the language
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * @see OpenTypeLayoutEngine
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * @see ScriptAndLangaugeTags.h for script and language codes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * The destructor, virtual for correct polymorphic invocation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
   virtual ~KhmerOpenTypeLayoutEngine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
protected:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * This method does Khmer OpenType character processing. It
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * assigns the OpenType feature tags to the characters, and may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * generate output characters which have been reordered.  It may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * also split some vowels, resulting in more output characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * than input characters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * Input parameters:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * @param chars - the input character context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * @param offset - the index of the first character to process
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * @param count - the number of characters to process
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * @param max - the number of characters in the input context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * @param rightToLeft - <code>TRUE</code> if the characters are in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * a right to left directional run
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * @param glyphStorage - the glyph storage object. The glyph and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * character index arrays will be set.  the auxillary data array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * will be set to the feature tags.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * Output parameters:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * @param success - set to an error code if the operation fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * @return the output character count
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        le_int32 count, le_int32 max, le_bool rightToLeft,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
#endif