jdk/src/share/native/sun/font/layout/HangulLayoutEngine.h
author kvn
Tue, 28 Jan 2014 14:57:41 -0800
changeset 22607 ba232b417248
parent 16891 91e99bed64ae
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7486
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
     1
/*
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
     2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
     3
 *
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
     6
 * published by the Free Software Foundation.  Oracle designates this
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
     7
 * particular file as subject to the "Classpath" exception as provided
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
     8
 * by Oracle in the LICENSE file that accompanied this code.
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
     9
 *
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    14
 * accompanied this code).
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    15
 *
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    19
 *
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    22
 * questions.
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    23
 *
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    24
 */
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    25
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    26
/*
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    27
 *
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    28
 * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    29
 *
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    30
 */
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    31
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    32
#ifndef __HANGULAYOUTENGINE_H
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    33
#define __HANGULAYOUTENGINE_H
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    34
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    35
#include "LETypes.h"
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    36
#include "LEFontInstance.h"
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    37
#include "LEGlyphFilter.h"
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    38
#include "LayoutEngine.h"
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    39
#include "OpenTypeLayoutEngine.h"
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    40
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    41
#include "GlyphSubstitutionTables.h"
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    42
#include "GlyphDefinitionTables.h"
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    43
#include "GlyphPositioningTables.h"
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    44
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    45
U_NAMESPACE_BEGIN
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    46
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    47
class MPreFixups;
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    48
class LEGlyphStorage;
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    49
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    50
/**
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    51
 * This class implements OpenType layout for Old Hangul OpenType fonts, as
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    52
 * specified by Microsoft in "Creating and Supporting OpenType Fonts for
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    53
 * The Korean Hangul Script" (http://www.microsoft.com/typography/otfntdev/hangulot/default.htm)
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    54
 *
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    55
 * This class overrides the characterProcessing method to do Hangul character processing.
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    56
 * (See the MS spec. for more details)
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    57
 *
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    58
 * @internal
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    59
 */
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    60
class HangulOpenTypeLayoutEngine : public OpenTypeLayoutEngine
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    61
{
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    62
public:
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    63
    /**
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    64
     * This is the main constructor. It constructs an instance of HangulOpenTypeLayoutEngine for
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    65
     * a particular font, script and language. It takes the GSUB table as a parameter since
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    66
     * LayoutEngine::layoutEngineFactory has to read the GSUB table to know that it has an
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    67
     * Hangul OpenType font.
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    68
     *
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    69
     * @param fontInstance - the font
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    70
     * @param scriptCode - the script
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    71
     * @param langaugeCode - the language
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    72
     * @param gsubTable - the GSUB table
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    73
     * @param success - set to an error code if the operation fails
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    74
     *
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    75
     * @see LayoutEngine::layoutEngineFactory
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    76
     * @see OpenTypeLayoutEngine
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    77
     * @see ScriptAndLangaugeTags.h for script and language codes
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    78
     *
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    79
     * @internal
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    80
     */
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    81
    HangulOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
16891
91e99bed64ae 8001031: Better font processing
prr
parents: 7486
diff changeset
    82
                               le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success);
7486
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    83
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    84
    /**
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    85
     * This constructor is used when the font requires a "canned" GSUB table which can't be known
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    86
     * until after this constructor has been invoked.
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    87
     *
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    88
     * @param fontInstance - the font
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    89
     * @param scriptCode - the script
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    90
     * @param langaugeCode - the language
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    91
     * @param success - set to an error code if the operation fails
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    92
     *
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    93
     * @see OpenTypeLayoutEngine
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    94
     * @see ScriptAndLangaugeTags.h for script and language codes
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    95
     *
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    96
     * @internal
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    97
     */
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    98
    HangulOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
    99
                              le_int32 typoFlags, LEErrorCode &success);
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   100
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   101
    /**
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   102
     * The destructor, virtual for correct polymorphic invocation.
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   103
     *
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   104
     * @internal
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   105
     */
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   106
   virtual ~HangulOpenTypeLayoutEngine();
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   107
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   108
    /**
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   109
     * ICU "poor man's RTTI", returns a UClassID for the actual class.
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   110
     *
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   111
     * @stable ICU 2.8
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   112
     */
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   113
    virtual UClassID getDynamicClassID() const;
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   114
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   115
    /**
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   116
     * ICU "poor man's RTTI", returns a UClassID for this class.
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   117
     *
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   118
     * @stable ICU 2.8
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   119
     */
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   120
    static UClassID getStaticClassID();
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   121
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   122
protected:
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   123
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   124
    /**
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   125
     * This method does Hangul OpenType character processing. It assigns the OpenType feature
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   126
     * tags to the characters, and may compose a character sequence into a modern Hangul syllable,
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   127
     * or decompose a modern Hangul syllable if it forms part of an old Hangul syllable.
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   128
     *
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   129
     * Input parameters:
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   130
     * @param chars - the input character context
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   131
     * @param offset - the index of the first character to process
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   132
     * @param count - the number of characters to process
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   133
     * @param max - the number of characters in the input context
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   134
     * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   135
     * @param glyphStorage - the glyph storage object. The glyph and character index arrays will be set.
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   136
     *                       the auxillary data array will be set to the feature tags.
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   137
     *
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   138
     * Output parameters:
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   139
     * @param success - set to an error code if the operation fails
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   140
     *
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   141
     * @return the output character count
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   142
     *
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   143
     * @internal
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   144
     */
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   145
    virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   146
            LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   147
};
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   148
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   149
U_NAMESPACE_END
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   150
#endif
6a36b1ebc620 6886358: layout code update
srl
parents:
diff changeset
   151