jdk/src/share/native/sun/font/layout/LEFontInstance.h
author kvn
Tue, 28 Jan 2014 14:57:41 -0800
changeset 22607 ba232b417248
parent 22330 cafb826672bd
permissions -rw-r--r--
Merge
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
 *
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
    29
 * (C) Copyright IBM Corp. 1998-2007 - All Rights Reserved
2
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 __LEFONTINSTANCE_H
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
#define __LEFONTINSTANCE_H
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
#include "LETypes.h"
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    37
/**
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    38
 * \file
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    39
 * \brief C++ API: Layout Engine Font Instance object
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    40
 */
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    41
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    42
U_NAMESPACE_BEGIN
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * Instances of this class are used by <code>LEFontInstance::mapCharsToGlyphs</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * <code>LEFontInstance::mapCharToGlyph</code> to adjust character codes before the character
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * to glyph mapping process. Examples of this are filtering out control characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * and character mirroring - replacing a character which has both a left and a right
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * hand form with the opposite form.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * @stable ICU 3.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    53
class LECharMapper /* not : public UObject because this is an interface/mixin class */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
public:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * Destructor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * @stable ICU 3.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     */
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
    60
    virtual ~LECharMapper();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * This method does the adjustments.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * @param ch - the input character
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * @return the adjusted character
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * @stable ICU 2.8
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    virtual LEUnicode32 mapChar(LEUnicode32 ch) const = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * This is a forward reference to the class which holds the per-glyph
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * storage.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 *
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
    78
 * @stable ICU 3.0
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
class LEGlyphStorage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 * This is a virtual base class that serves as the interface between a LayoutEngine
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * and the platform font environment. It allows a LayoutEngine to access font tables, do
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * character to glyph mapping, and obtain metrics information without knowing any platform
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 * specific details. There are also a few utility methods for converting between points,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * pixels and funits. (font design units)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * An instance of an <code>LEFontInstance</code> represents a font at a particular point
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * size. Each instance can represent either a single physical font, or a composite font.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 * A composite font is a collection of physical fonts, each of which contains a subset of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 * the characters contained in the composite font.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 * Note: with the exception of <code>getSubFont</code>, the methods in this class only
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 * make sense for a physical font. If you have an <code>LEFontInstance</code> which
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 * represents a composite font you should only call the methods below which have
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * an <code>LEGlyphID</code>, an <code>LEUnicode</code> or an <code>LEUnicode32</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 * as one of the arguments because these can be used to select a particular subfont.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 * Subclasses which implement composite fonts should supply an implementation of these
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 * methods with some default behavior such as returning constant values, or using the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 * values from the first subfont.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 *
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   104
 * @stable ICU 3.0
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
 */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   106
class U_LAYOUT_API LEFontInstance : public UObject
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
public:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * This virtual destructor is here so that the subclass
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * destructors can be invoked through the base class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * @stable ICU 2.8
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     */
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   116
    virtual ~LEFontInstance();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * Get a physical font which can render the given text. For composite fonts,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * if there is no single physical font which can render all of the text,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * return a physical font which can render an initial substring of the text,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * and set the <code>offset</code> parameter to the end of that substring.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * Internally, the LayoutEngine works with runs of text all in the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * font and script, so it is best to call this method with text which is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * in a single script, passing the script code in as a hint. If you don't
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * know the script of the text, you can use zero, which is the script code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * for characters used in more than one script.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * The default implementation of this method is intended for instances of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * <code>LEFontInstance</code> which represent a physical font. It returns
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * <code>this</code> and indicates that the entire string can be rendered.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * This method will return a valid <code>LEFontInstance</code> unless you
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * have passed illegal parameters, or an internal error has been encountered.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * For composite fonts, it may return the warning <code>LE_NO_SUBFONT_WARNING</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * to indicate that the returned font may not be able to render all of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * the text. Whenever a valid font is returned, the <code>offset</code> parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * will be advanced by at least one.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * Subclasses which implement composite fonts must override this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * Where it makes sense, they should use the script code as a hint to render
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * characters from the COMMON script in the font which is used for the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * script. For example, if the input text is a series of Arabic words separated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * by spaces, and the script code passed in is <code>arabScriptCode</code> you
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * should return the font used for Arabic characters for all of the input text,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * including the spaces. If, on the other hand, the input text contains characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * which cannot be rendered by the font used for Arabic characters, but which can
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * be rendered by another font, you should return that font for those characters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * @param chars   - the array of Unicode characters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * @param offset  - a pointer to the starting offset in the text. On exit this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     *                  will be set the the limit offset of the text which can be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     *                  rendered using the returned font.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * @param limit   - the limit offset for the input text.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * @param script  - the script hint.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * @param success - set to an error code if the arguments are illegal, or no font
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     *                  can be returned for some reason. May also be set to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     *                  <code>LE_NO_SUBFONT_WARNING</code> if the subfont which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     *                  was returned cannot render all of the text.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * @return an <code>LEFontInstance</code> for the sub font which can render the characters, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     *         <code>NULL</code> if there is an error.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * @see LEScripts.h
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * @stable ICU 3.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   169
    virtual const LEFontInstance *getSubFont(const LEUnicode chars[], le_int32 *offset, le_int32 limit, le_int32 script, LEErrorCode &success) const;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    // Font file access
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * This method reads a table from the font. Note that in general,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * it only makes sense to call this method on an <code>LEFontInstance</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * which represents a physical font - i.e. one which has been returned by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * <code>getSubFont()</code>. This is because each subfont in a composite font
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * will have different tables, and there's no way to know which subfont to access.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * Subclasses which represent composite fonts should always return <code>NULL</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     *
22330
cafb826672bd 8024530: Enhance font process resilience
prr
parents: 16889
diff changeset
   184
     * Note that implementing this function does not allow for range checking.
cafb826672bd 8024530: Enhance font process resilience
prr
parents: 16889
diff changeset
   185
     * Subclasses that desire the safety of range checking must implement the
cafb826672bd 8024530: Enhance font process resilience
prr
parents: 16889
diff changeset
   186
     * variation which has a length parameter.
cafb826672bd 8024530: Enhance font process resilience
prr
parents: 16889
diff changeset
   187
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * @param tableTag - the four byte table tag. (e.g. 'cmap')
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * @return the address of the table in memory, or <code>NULL</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     *         if the table doesn't exist.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * @stable ICU 2.8
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    virtual const void *getFontTable(LETag tableTag) const = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
16889
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   197
    /**
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   198
     * This method reads a table from the font. Note that in general,
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   199
     * it only makes sense to call this method on an <code>LEFontInstance</code>
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   200
     * which represents a physical font - i.e. one which has been returned by
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   201
     * <code>getSubFont()</code>. This is because each subfont in a composite font
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   202
     * will have different tables, and there's no way to know which subfont to access.
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   203
     *
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   204
     * Subclasses which represent composite fonts should always return <code>NULL</code>.
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   205
     *
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   206
     * This version sets a length, for range checking.
22330
cafb826672bd 8024530: Enhance font process resilience
prr
parents: 16889
diff changeset
   207
     * Note that range checking can only be accomplished if this function is
cafb826672bd 8024530: Enhance font process resilience
prr
parents: 16889
diff changeset
   208
     * implemented in subclasses.
16889
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   209
     *
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   210
     * @param tableTag - the four byte table tag. (e.g. 'cmap')
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   211
     * @param length - ignored on entry, on exit will be the length of the table if known, or -1 if unknown.
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   212
     * @return the address of the table in memory, or <code>NULL</code>
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   213
     *         if the table doesn't exist.
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   214
     * @internal
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   215
     */
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   216
    virtual const void* getFontTable(LETag tableTag, size_t &length) const { length=-1; return getFontTable(tableTag); }  /* -1 = unknown length */
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   217
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    virtual void *getKernPairs() const = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    virtual void  setKernPairs(void *pairs) const = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * This method is used to determine if the font can
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * render the given character. This can usually be done
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * by looking the character up in the font's character
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * to glyph mapping.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * The default implementation of this method will return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * <code>TRUE</code> if <code>mapCharToGlyph(ch)</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * returns a non-zero value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * @param ch - the character to be tested
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * @return <code>TRUE</code> if the font can render ch.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * @stable ICU 3.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     */
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   237
    virtual le_bool canDisplay(LEUnicode32 ch) const;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * This method returns the number of design units in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * the font's EM square.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * @return the number of design units pre EM.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * @stable ICU 2.8
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    virtual le_int32 getUnitsPerEM() const = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * This method maps an array of character codes to an array of glyph
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     * indices, using the font's character to glyph map.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * The default implementation iterates over all of the characters and calls
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * <code>mapCharToGlyph(ch, mapper)</code> on each one. It also handles surrogate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * characters, storing the glyph ID for the high surrogate, and a deleted glyph (0xFFFF)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * for the low surrogate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     * Most sublcasses will not need to implement this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     * @param chars - the character array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * @param offset - the index of the first character
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * @param count - the number of characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     * @param reverse - if <code>TRUE</code>, store the glyph indices in reverse order.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     * @param mapper - the character mapper.
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   265
     * @param filterZeroWidth - <code>TRUE</code> if ZWJ / ZWNJ characters should map to a glyph w/ no contours.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * @param glyphStorage - the object which contains the output glyph array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     * @see LECharMapper
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     *
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   270
     * @stable ICU 3.6
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     */
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   272
    virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, const LECharMapper *mapper, le_bool filterZeroWidth, LEGlyphStorage &glyphStorage) const;
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   273
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   274
    /**
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   275
     * This method maps a single character to a glyph index, using the
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   276
     * font's character to glyph map. The default implementation of this
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   277
     * method calls the mapper, and then calls <code>mapCharToGlyph(mappedCh)</code>.
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   278
     *
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   279
     * @param ch - the character
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   280
     * @param mapper - the character mapper
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   281
     * @param filterZeroWidth - <code>TRUE</code> if ZWJ / ZWNJ characters should map to a glyph w/ no contours.
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   282
     *
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   283
     * @return the glyph index
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   284
     *
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   285
     * @see LECharMapper
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   286
     *
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   287
     * @stable ICU 3.6
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   288
     */
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   289
    virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     * This method maps a single character to a glyph index, using the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     * font's character to glyph map. The default implementation of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * method calls the mapper, and then calls <code>mapCharToGlyph(mappedCh)</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * @param ch - the character
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     * @param mapper - the character mapper
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     * @return the glyph index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     * @see LECharMapper
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * @stable ICU 3.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
    virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const;
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 maps a single character to a glyph index, using the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * font's character to glyph map. There is no default implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     * of this method because it requires information about the platform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     * font implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     * @param ch - the character
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     * @return the glyph index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     * @stable ICU 3.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
    virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch) const = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
    //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
    // Metrics
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
    //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     * This method gets the X and Y advance of a particular glyph, in pixels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     * @param glyph - the glyph index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     * @param advance - the X and Y pixel values will be stored here
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     * @stable ICU 3.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
    virtual void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
    virtual void getKerningAdjustment(LEPoint &adjustment) const = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     * This method gets the hinted X and Y pixel coordinates of a particular
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     * point in the outline of the given glyph.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     * @param glyph - the glyph index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     * @param pointNumber - the number of the point
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     * @param point - the point's X and Y pixel values will be stored here
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     * @return <code>TRUE</code> if the point coordinates could be stored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     * @stable ICU 2.8
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
    virtual le_bool getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     * This method returns the width of the font's EM square
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     * in pixels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     * @return the pixel width of the EM square
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     * @stable ICU 2.8
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
    virtual float getXPixelsPerEm() const = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     * This method returns the height of the font's EM square
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     * in pixels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     * @return the pixel height of the EM square
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     * @stable ICU 2.8
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
    virtual float getYPixelsPerEm() const = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
     * This method converts font design units in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     * X direction to points.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     * @param xUnits - design units in the X direction
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     * @return points in the X direction
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     * @stable ICU 3.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     */
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   381
    virtual float xUnitsToPoints(float xUnits) const;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
     * This method converts font design units in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     * Y direction to points.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     * @param yUnits - design units in the Y direction
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     * @return points in the Y direction
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     * @stable ICU 3.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     */
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   393
    virtual float yUnitsToPoints(float yUnits) const;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     * This method converts font design units to points.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     * @param units - X and Y design units
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     * @param points - set to X and Y points
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * @stable ICU 3.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     */
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   403
    virtual void unitsToPoints(LEPoint &units, LEPoint &points) const;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     * This method converts pixels in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     * X direction to font design units.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
     * @param xPixels - pixels in the X direction
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     * @return font design units in the X direction
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     * @stable ICU 3.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     */
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   415
    virtual float xPixelsToUnits(float xPixels) const;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     * This method converts pixels in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     * Y direction to font design units.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     * @param yPixels - pixels in the Y direction
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
     * @return font design units in the Y direction
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     * @stable ICU 3.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
     */
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   427
    virtual float yPixelsToUnits(float yPixels) const;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
     * This method converts pixels to font design units.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
     * @param pixels - X and Y pixel
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
     * @param units - set to X and Y font design units
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     * @stable ICU 3.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
     */
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   437
    virtual void pixelsToUnits(LEPoint &pixels, LEPoint &units) const;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
     * Get the X scale factor from the font's transform. The default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
     * implementation of <code>transformFunits()</code> will call this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
     * @return the X scale factor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
     * @see transformFunits
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
     * @stable ICU 3.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
    virtual float getScaleFactorX() const = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
     * Get the Y scale factor from the font's transform. The default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
     * implementation of <code>transformFunits()</code> will call this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
     * @return the Yscale factor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
     * @see transformFunits
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
     * @stable ICU 3.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
    virtual float getScaleFactorY() const = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
     * This method transforms an X, Y point in font design units to a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
     * pixel coordinate, applying the font's transform. The default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
     * implementation of this method calls <code>getScaleFactorX()</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
     * and <code>getScaleFactorY()</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
     * @param xFunits - the X coordinate in font design units
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
     * @param yFunits - the Y coordinate in font design units
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
     * @param pixels - the tranformed co-ordinate in pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
     * @see getScaleFactorX
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
     * @see getScaleFactorY
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
     * @stable ICU 3.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
     */
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   479
    virtual void transformFunits(float xFunits, float yFunits, LEPoint &pixels) const;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
     * This is a convenience method used to convert
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
     * values in a 16.16 fixed point format to floating point.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
     * @param fixed - the fixed point value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
     * @return the floating point value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
     * @stable ICU 2.8
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
    static inline float fixedToFloat(le_int32 fixed);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
     * This is a convenience method used to convert
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
     * floating point values to 16.16 fixed point format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
     * @param theFloat - the floating point value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
     * @return the fixed point value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
     * @stable ICU 2.8
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
    static inline le_int32 floatToFixed(float theFloat);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
    //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
    // These methods won't ever be called by the LayoutEngine,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
    // but are useful for clients of <code>LEFontInstance</code> who
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
    // need to render text.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
    //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
     * Get the font's ascent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
     * @return the font's ascent, in points. This value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
     * will always be positive.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
     * @stable ICU 3.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
    virtual le_int32 getAscent() const = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
     * Get the font's descent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
     * @return the font's descent, in points. This value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
     * will always be positive.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
     * @stable ICU 3.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
    virtual le_int32 getDescent() const = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
     * Get the font's leading.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
     * @return the font's leading, in points. This value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
     * will always be positive.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
     * @stable ICU 3.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
    virtual le_int32 getLeading() const = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
     * Get the line height required to display text in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
     * this font. The default implementation of this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
     * returns the sum of the ascent, descent, and leading.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
     * @return the line height, in points. This vaule will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
     * always be positive.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
     * @stable ICU 3.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
    virtual le_int32 getLineHeight() const;
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   552
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   553
    /**
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   554
     * 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
   555
     *
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   556
     * @stable ICU 3.2
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   557
     */
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   558
    virtual UClassID getDynamicClassID() const;
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   559
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   560
    /**
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   561
     * 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
   562
     *
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   563
     * @stable ICU 3.2
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   564
     */
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   565
    static UClassID getStaticClassID();
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   566
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
inline float LEFontInstance::fixedToFloat(le_int32 fixed)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
    return (float) (fixed / 65536.0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
inline le_int32 LEFontInstance::floatToFixed(float theFloat)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
    return (le_int32) (theFloat * 65536.0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   579
U_NAMESPACE_END
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
#endif