jdk/src/java.desktop/share/classes/sun/font/SunLayoutEngine.java
author prr
Mon, 23 Nov 2015 09:58:44 -0800
changeset 34414 e496a8d8fc8a
parent 34399 7ea60f3aab93
child 47188 0048f025c993
permissions -rw-r--r--
8143177: Integrate harfbuzz opentype layout engine per JEP 258 Reviewed-by: srl, vadim, serb
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: 2
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: 2
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: 2
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
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
 * (C) Copyright IBM Corp. 2003 - All Rights Reserved
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
package sun.font;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import sun.font.GlyphLayout.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.awt.geom.Point2D;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.lang.ref.SoftReference;
12993
98899b2d514c 7027300: Unsynchronized HashMap access causes endless loop
prr
parents: 5506
diff changeset
    36
import java.util.concurrent.ConcurrentHashMap;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import java.util.Locale;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * different ways to do this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * 1) each physical font2d keeps a hashtable mapping scripts to layout
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * engines, we query and fill this cache.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * 2) we keep a mapping independent of font using the key Most likely
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * few fonts will be used, so option 2 seems better
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * Once we know which engine to use for a font, we always know, so we
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * shouldn't have to recheck each time we do layout.  So the cache is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * ok.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * Should we reuse engines?  We could instantiate an engine for each
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * font/script pair.  The engine would hold onto the table(s) from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * font that it needs.  If we have multiple threads using the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * engine, we still need to keep the state separate, so the native
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * engines would still need to be allocated for each call, since they
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * keep their state in themselves.  If they used the passed-in GVData
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * arrays directly (with some checks for space) then since each GVData
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * is different per thread, we could reuse the layout engines.  This
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * still requires a separate layout engine per font, because of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * table state in the engine.  If we pushed that out too and passed it
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * in with the native call as well, we'd be ok if the layout engines
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * keep all their process state on the stack, but I don't know if this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * is true.  Then we'd basically just be down to an engine index which
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * we pass into native and then invoke the engine code (now a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * procedure call, not an object invocation) based on a switch on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * index.  There would be only half a dozen engine objects then, not
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * potentially half a dozen per font.  But we'd have to stack-allocate
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * some state that included the pointer to the required font tables.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * Seems for now that the way to do things is to come in with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * selector and the font.  The selector indicates which engine to use,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * the engine is stack allocated and initialized with the required
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * font tables (the selector indicates which).  Then layout is called,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * the contents are copied (or not), and the stack is destroyed on
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * exit. So the association is between the font/script (layout engine
28059
e576535359cc 8067377: My hobby: caning, then then canning, the the can-can
martin
parents: 25859
diff changeset
    75
 * desc) and one of a few permanent engine objects, which are
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * handed the key when they need to process something.  In the native
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * case, the engine holds an index, and just passes it together with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * the key info down to native.  Some default cases are the 'default
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * layout' case that just runs the c2gmapper, this stays in java and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * just uses the mapper from the font/strike.  Another default case
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * might be the unicode arabic shaper, since this doesn't care about
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * the font (or script or lang?) it wouldn't need to extract this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 * data.  It could be (yikes) ported back to java even to avoid
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * upcalls to check if the font supports a particular unicode
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * character.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * I'd expect that the majority of scripts use the default mapper for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * a particular font.  Loading the hastable with 40 or so keys 30+ of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * which all map to the same object is unfortunate.  It might be worth
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * instead having a per-font list of 'scripts with non-default
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 * engines', e.g. the factory has a hashtable mapping fonts to 'script
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 * lists' (the factory has this since the design potentially has other
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 * factories, though I admit there's no client for this yet and no
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 * public api) and then the script list is queried for the script in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 * question.  it can be preloaded at creation time with all the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 * scripts that don't have default engines-- either a list or a hash
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * table, so a null return from the table means 'default' and not 'i
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 * don't know yet'.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 * On the other hand, in most all cases the number of unique
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 * script/font combinations will be small, so a flat hashtable should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 * suffice.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 * */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
public final class SunLayoutEngine implements LayoutEngine, LayoutEngineFactory {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    private static native void initGVIDs();
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   106
    private static final boolean useICU;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        FontManagerNativeLibrary.load();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        initGVIDs();
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   110
        String le = java.security.AccessController.doPrivileged(
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   111
            new sun.security.action.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   112
                GetPropertyAction("sun.font.layoutengine", ""));
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   113
        useICU = le.equals("icu");
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   114
        String verbose = java.security.AccessController.doPrivileged(
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   115
            new sun.security.action.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   116
                GetPropertyAction("sun.font.layoutengine.verbose", ""));
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   117
        if ("true".equalsIgnoreCase(verbose)) {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   118
            System.out.println("Using " + (useICU ? "icu." : "harfbuzz."));
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   119
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    private LayoutEngineKey key;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    private static LayoutEngineFactory instance;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    public static LayoutEngineFactory instance() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        if (instance == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
            instance = new SunLayoutEngine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        return instance;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    private SunLayoutEngine() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        // actually a factory, key is null so layout cannot be called on it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    public LayoutEngine getEngine(Font2D font, int script, int lang) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        return getEngine(new LayoutEngineKey(font, script, lang));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
  // !!! don't need this unless we have more than one sun layout engine...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    public LayoutEngine getEngine(LayoutEngineKey key) {
23288
b7183846db97 8033624: Fix raw and unchecked lint warnings in sun.font
darcy
parents: 13232
diff changeset
   143
        ConcurrentHashMap<LayoutEngineKey, LayoutEngine> cache = cacheref.get();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        if (cache == null) {
23288
b7183846db97 8033624: Fix raw and unchecked lint warnings in sun.font
darcy
parents: 13232
diff changeset
   145
            cache = new ConcurrentHashMap<>();
b7183846db97 8033624: Fix raw and unchecked lint warnings in sun.font
darcy
parents: 13232
diff changeset
   146
            cacheref = new SoftReference<>(cache);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
23288
b7183846db97 8033624: Fix raw and unchecked lint warnings in sun.font
darcy
parents: 13232
diff changeset
   149
        LayoutEngine e = cache.get(key);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        if (e == null) {
13232
f4d1488bff92 7183251: Netbeans editor renders text wrong on JDK 7u6 build 17
prr
parents: 12993
diff changeset
   151
            LayoutEngineKey copy = key.copy();
f4d1488bff92 7183251: Netbeans editor renders text wrong on JDK 7u6 build 17
prr
parents: 12993
diff changeset
   152
            e = new SunLayoutEngine(copy);
f4d1488bff92 7183251: Netbeans editor renders text wrong on JDK 7u6 build 17
prr
parents: 12993
diff changeset
   153
            cache.put(copy, e);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        return e;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    }
23288
b7183846db97 8033624: Fix raw and unchecked lint warnings in sun.font
darcy
parents: 13232
diff changeset
   157
    private SoftReference<ConcurrentHashMap<LayoutEngineKey, LayoutEngine>> cacheref =
b7183846db97 8033624: Fix raw and unchecked lint warnings in sun.font
darcy
parents: 13232
diff changeset
   158
        new SoftReference<>(null);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    private SunLayoutEngine(LayoutEngineKey key) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        this.key = key;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   164
    private boolean isAAT(Font2D font) {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   165
       if (font instanceof TrueTypeFont) {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   166
           TrueTypeFont ttf = (TrueTypeFont)font;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   167
           return ttf.getDirectoryEntry(TrueTypeFont.morxTag) != null ||
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   168
                  ttf.getDirectoryEntry(TrueTypeFont.mortTag) != null;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   169
       } else if (font instanceof PhysicalFont) {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   170
           PhysicalFont pf = (PhysicalFont)font;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   171
           return pf.getTableBytes(TrueTypeFont.morxTag) != null ||
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   172
                  pf.getTableBytes(TrueTypeFont.mortTag) != null;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   173
       }
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   174
       return false;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   175
    }
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   176
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   177
    public void layout(FontStrikeDesc desc, float[] mat, float ptSize, int gmask,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                       int baseIndex, TextRecord tr, int typo_flags,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
                       Point2D.Float pt, GVData data) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        Font2D font = key.font();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        FontStrike strike = font.getStrike(desc);
34399
7ea60f3aab93 7162125: [macosx] A font has different behaviour for ligatures depending on its creation mod
prr
parents: 28059
diff changeset
   182
        long layoutTables = font.getLayoutTableCache();
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   183
        if (useICU) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        nativeLayout(font, strike, mat, gmask, baseIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
             tr.text, tr.start, tr.limit, tr.min, tr.max,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
             key.script(), key.lang(), typo_flags, pt, data,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
             font.getUnitsPerEm(), layoutTables);
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   188
        } else {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   189
            long pNativeFont = font.getPlatformNativeFontPtr(); // used on OSX
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   190
            // pScaler probably not needed long term.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   191
            long pScaler = 0L;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   192
            if (font instanceof FileFont) {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   193
                pScaler = ((FileFont)font).getScaler().nativeScaler;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   194
            }
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   195
            shape(font, strike, ptSize, mat, pScaler, pNativeFont, isAAT(font),
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   196
                  tr.text, data, key.script(),
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   197
                  tr.start, tr.limit, baseIndex, pt,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   198
                  typo_flags, gmask);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   199
         }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   202
    /* Native method to invoke ICU layout engine */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    private static native void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        nativeLayout(Font2D font, FontStrike strike, float[] mat, int gmask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
             int baseIndex, char[] chars, int offset, int limit,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
             int min, int max, int script, int lang, int typo_flags,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
             Point2D.Float pt, GVData data, long upem, long layoutTables);
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   208
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   209
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   210
    /* Native method to invoke harfbuzz layout engine */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   211
    private static native boolean
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   212
        shape(Font2D font, FontStrike strike, float ptSize, float[] mat,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   213
              long pscaler, long pNativeFont, boolean aat,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   214
              char[] chars, GVData data,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   215
              int script, int offset, int limit,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents: 34399
diff changeset
   216
              int baseIndex, Point2D.Float pt, int typo_flags, int slot);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
}