jdk/src/share/native/sun/font/layout/OpenTypeLayoutEngine.h
author prr
Thu, 07 Mar 2013 10:02:20 -0800
changeset 16891 91e99bed64ae
parent 16890 36b30720a997
child 21278 ef8a3a2a72f2
permissions -rw-r--r--
8001031: Better font processing Reviewed-by: srl, vadim
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
/*
16890
36b30720a997 8004986: Better handling of glyph table
prr
parents: 7486
diff changeset
    27
 * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#ifndef __OPENTYPELAYOUTENGINE_H
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#define __OPENTYPELAYOUTENGINE_H
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
#include "LETypes.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
#include "LEGlyphFilter.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
#include "LEFontInstance.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
#include "LayoutEngine.h"
16891
91e99bed64ae 8001031: Better font processing
prr
parents: 16890
diff changeset
    38
#include "LETableReference.h"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
#include "GlyphSubstitutionTables.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
#include "GlyphDefinitionTables.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
#include "GlyphPositioningTables.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    44
U_NAMESPACE_BEGIN
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    45
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * OpenTypeLayoutEngine implements complex text layout for OpenType fonts - that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * fonts which have GSUB and GPOS tables associated with them. In order to do this,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * the glyph processsing step described for LayoutEngine is further broken into three
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * steps:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * 1) Character processing - this step analyses the characters and assigns a list of OpenType
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 *    feature tags to each one. It may also change, remove or add characters, and change
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 *    their order.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * 2) Glyph processing - This step performs character to glyph mapping,and uses the GSUB
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 *    table associated with the font to perform glyph substitutions, such as ligature substitution.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * 3) Glyph post processing - in cases where the font doesn't directly contain a GSUB table,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 *    the previous two steps may have generated "fake" glyph indices to use with a "canned" GSUB
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 *    table. This step turns those glyph indices into actual font-specific glyph indices, and may
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 *    perform any other adjustments requried by the previous steps.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * OpenTypeLayoutEngine will also use the font's GPOS table to apply position adjustments
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * such as kerning and accent positioning.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * @see LayoutEngine
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 */
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
    71
class U_LAYOUT_API OpenTypeLayoutEngine : public LayoutEngine
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
public:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * This is the main constructor. It constructs an instance of OpenTypeLayoutEngine for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * a particular font, script and language. It takes the GSUB table as a parameter since
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * LayoutEngine::layoutEngineFactory has to read the GSUB table to know that it has an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * OpenType font.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * @param fontInstance - the font
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * @param scriptCode - the script
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * @param langaugeCode - the language
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * @param gsubTable - the GSUB table
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
    84
     * @param success - set to an error code if the operation fails
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * @see LayoutEngine::layoutEngineFactory
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * @see ScriptAndLangaugeTags.h for script and language codes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
16891
91e99bed64ae 8001031: Better font processing
prr
parents: 16890
diff changeset
    92
                            le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * This constructor is used when the font requires a "canned" GSUB table which can't be known
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * until after this constructor has been invoked.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * @param fontInstance - the font
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * @param scriptCode - the script
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   100
     * @param langaugeCode - the language
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   101
     * @param success - set to an error code if the operation fails
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   105
    OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   106
                         le_int32 typoFlags, LEErrorCode &success);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * The destructor, virtual for correct polymorphic invocation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    virtual ~OpenTypeLayoutEngine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * A convenience method used to convert the script code into
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * the four byte script tag required by OpenType.
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   118
         * For Indic languages where multiple script tags exist,
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   119
         * the version 1 (old style) tag is returned.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * @param scriptCode - the script code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * @return the four byte script tag
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    static LETag getScriptTag(le_int32 scriptCode);
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   128
    /**
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   129
     * A convenience method used to convert the script code into
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   130
     * the four byte script tag required by OpenType.
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   131
         * For Indic languages where multiple script tags exist,
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   132
         * the version 2 tag is returned.
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   133
     *
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   134
     * @param scriptCode - the script code
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   135
     *
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   136
     * @return the four byte script tag
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   137
     *
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   138
     * @internal
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   139
     */
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   140
    static LETag getV2ScriptTag(le_int32 scriptCode);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * A convenience method used to convert the langauge code into
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * the four byte langauge tag required by OpenType.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * @param languageCode - the language code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * @return the four byte language tag
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    static LETag getLangSysTag(le_int32 languageCode);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   154
    /**
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   155
     * 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
   156
     *
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   157
     * @stable ICU 2.8
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   158
     */
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   159
    virtual UClassID getDynamicClassID() const;
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   160
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   161
    /**
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   162
     * 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
   163
     *
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   164
     * @stable ICU 2.8
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   165
     */
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   166
    static UClassID getStaticClassID();
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   167
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   168
    /**
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   169
     * The array of language tags, indexed by language code.
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   170
     *
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   171
     * @internal
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   172
     */
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   173
    static const LETag languageTags[];
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   174
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
private:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * This method is used by the constructors to convert the script
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * and language codes to four byte tags and save them.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    void setScriptAndLanguageTags();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * The array of script tags, indexed by script code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    static const LETag scriptTags[];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
16890
36b30720a997 8004986: Better handling of glyph table
prr
parents: 7486
diff changeset
   188
    /**
36b30720a997 8004986: Better handling of glyph table
prr
parents: 7486
diff changeset
   189
     * apply the typoflags. Only called by the c'tors.
36b30720a997 8004986: Better handling of glyph table
prr
parents: 7486
diff changeset
   190
     */
36b30720a997 8004986: Better handling of glyph table
prr
parents: 7486
diff changeset
   191
    void applyTypoFlags();
36b30720a997 8004986: Better handling of glyph table
prr
parents: 7486
diff changeset
   192
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
protected:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * A set of "default" features. The default characterProcessing method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * will apply all of these features to every glyph.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    FeatureMask fFeatureMask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * A set of mappings from feature tags to feature masks. These may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * be in the order in which the featues should be applied, but they
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * don't need to be.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    const FeatureMap *fFeatureMap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * The length of the feature map.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    le_int32 fFeatureMapCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * <code>TRUE</code> if the features in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * feature map are in the order in which they
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * must be applied.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    le_bool fFeatureOrder;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * The address of the GSUB table.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     */
16891
91e99bed64ae 8001031: Better font processing
prr
parents: 16890
diff changeset
   232
    LEReferenceTo<GlyphSubstitutionTableHeader> fGSUBTable;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * The address of the GDEF table.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     */
16891
91e99bed64ae 8001031: Better font processing
prr
parents: 16890
diff changeset
   239
    LEReferenceTo<GlyphDefinitionTableHeader> fGDEFTable;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * The address of the GPOS table.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     */
16891
91e99bed64ae 8001031: Better font processing
prr
parents: 16890
diff changeset
   246
    LEReferenceTo<GlyphPositioningTableHeader> fGPOSTable;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * An optional filter used to inhibit substitutions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * preformed by the GSUB table. This is used for some
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     * "canned" GSUB tables to restrict substitutions to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * glyphs that are in the font.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    LEGlyphFilter *fSubstitutionFilter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     * The four byte script tag.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
    LETag fScriptTag;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
    /**
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   266
     * The four byte script tag for V2 fonts.
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   267
     *
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   268
     * @internal
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   269
     */
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   270
    LETag fScriptTagV2;
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   271
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   272
    /**
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * The four byte language tag
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    LETag fLangSysTag;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     * This method does the OpenType character processing. It assigns the OpenType feature
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     * tags to the characters, and may generate output characters that differ from the input
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * charcters due to insertions, deletions, or reorderings. In such cases, it will also
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * generate an output character index array reflecting these changes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * Subclasses must override this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     * Input parameters:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     * @param chars - the input character context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     * @param offset - the index of the first character to process
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * @param count - the number of characters to process
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * @param max - the number of characters in the input context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     * @param rightToLeft - TRUE if the characters are in a right to left directional run
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * Output parameters:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * @param outChars - the output character array, if different from the input
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * @param charIndices - the output character index array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     * @param featureTags - the output feature tag array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     * @param success - set to an error code if the operation fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     * @return the output character count (input character count if no change)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   304
    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
   305
            LEUnicode *&/*outChars*/, LEGlyphStorage &glyphStorage, LEErrorCode &success);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     * This method does character to glyph mapping, and applies the GSUB table. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * default implementation calls mapCharsToGlyphs and then applies the GSUB table,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     * if there is one.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     * Note that in the case of "canned" GSUB tables, the output glyph indices may be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     * "fake" glyph indices that need to be converted to "real" glyph indices by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     * glyphPostProcessing method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     * Input parameters:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     * @param chars - the input character context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     * @param offset - the index of the first character to process
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     * @param count - the number of characters to process
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * @param max - the number of characters in the input context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * @param rightToLeft - TRUE if the characters are in a right to left directional run
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     * @param featureTags - the feature tag array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     * Output parameters:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     * @param glyphs - the output glyph index array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     * @param charIndices - the output character index array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     * @param success - set to an error code if the operation fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     * @return the number of glyphs in the output glyph index array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     * Note: if the character index array was already set by the characterProcessing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * method, this method won't change it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   336
    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
   337
            LEGlyphStorage &glyphStorage, LEErrorCode &success);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   339
    virtual le_int32 glyphSubstitution(le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success);
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   340
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     * This method does any processing necessary to convert "fake"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     * glyph indices used by the glyphProcessing method into "real" glyph
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     * indices which can be used to render the text. Note that in some
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     * cases, such as CDAC Indic fonts, several "real" glyphs may be needed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     * to render one "fake" glyph.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     * The default implementation of this method just returns the input glyph
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     * index and character index arrays, assuming that no "fake" glyph indices
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     * were needed to do GSUB processing.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     * Input paramters:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     * @param tempGlyphs - the input "fake" glyph index array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * @param tempCharIndices - the input "fake" character index array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     * @param tempGlyphCount - the number of "fake" glyph indices
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     * Output parameters:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     * @param glyphs - the output glyph index array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     * @param charIndices - the output character index array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     * @param success - set to an error code if the operation fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     * @return the number of glyph indices in the output glyph index array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   366
    virtual le_int32 glyphPostProcessing(LEGlyphStorage &tempGlyphStorage, LEGlyphStorage &glyphStorage, LEErrorCode &success);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     * This method applies the characterProcessing, glyphProcessing and glyphPostProcessing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     * methods. Most subclasses will not need to override this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
     * Input parameters:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     * @param chars - the input character context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     * @param offset - the index of the first character to process
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     * @param count - the number of characters to process
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     * @param max - the number of characters in the input context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     * @param rightToLeft - TRUE if the text is in a right to left directional run
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     * Output parameters:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     * @param glyphs - the glyph index array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     * @param charIndices - the character index array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     * @param success - set to an error code if the operation fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
     * @return the number of glyphs in the glyph index array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     * @see LayoutEngine::computeGlyphs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   390
    virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     * This method uses the GPOS table, if there is one, to adjust the glyph positions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     * Input parameters:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     * @param glyphs - the input glyph array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     * @param glyphCount - the number of glyphs in the glyph array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     * @param x - the starting X position
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     * @param y - the starting Y position
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * Output parameters:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     * @param positions - the output X and Y positions (two entries per glyph)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     * @param success - set to an error code if the operation fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   407
    virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
     * This method frees the feature tag array so that the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     * OpenTypeLayoutEngine can be reused for different text.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     * It is also called from our destructor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
    virtual void reset();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   419
U_NAMESPACE_END
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
#endif
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   421