138 LayoutEngine e = cache.get(key);
139 if (e == null) {
140 LayoutEngineKey copy = key.copy();
141 e = new SunLayoutEngine(copy);
142 cache.put(copy, e);
143 }
144 return e;
145 }
146 private SoftReference<ConcurrentHashMap<LayoutEngineKey, LayoutEngine>> cacheref =
147 new SoftReference<>(null);
148
149 private SunLayoutEngine(LayoutEngineKey key) {
150 this.key = key;
151 }
152
153 public void layout(FontStrikeDesc desc, float[] mat, int gmask,
154 int baseIndex, TextRecord tr, int typo_flags,
155 Point2D.Float pt, GVData data) {
156 Font2D font = key.font();
157 FontStrike strike = font.getStrike(desc);
158 long layoutTables = 0;
159 if (font instanceof TrueTypeFont) {
160 layoutTables = ((TrueTypeFont) font).getLayoutTableCache();
161 }
162 nativeLayout(font, strike, mat, gmask, baseIndex,
163 tr.text, tr.start, tr.limit, tr.min, tr.max,
164 key.script(), key.lang(), typo_flags, pt, data,
165 font.getUnitsPerEm(), layoutTables);
166 }
167
168 private static native void
169 nativeLayout(Font2D font, FontStrike strike, float[] mat, int gmask,
170 int baseIndex, char[] chars, int offset, int limit,
171 int min, int max, int script, int lang, int typo_flags,
172 Point2D.Float pt, GVData data, long upem, long layoutTables);
173 }
|
138 LayoutEngine e = cache.get(key);
139 if (e == null) {
140 LayoutEngineKey copy = key.copy();
141 e = new SunLayoutEngine(copy);
142 cache.put(copy, e);
143 }
144 return e;
145 }
146 private SoftReference<ConcurrentHashMap<LayoutEngineKey, LayoutEngine>> cacheref =
147 new SoftReference<>(null);
148
149 private SunLayoutEngine(LayoutEngineKey key) {
150 this.key = key;
151 }
152
153 public void layout(FontStrikeDesc desc, float[] mat, int gmask,
154 int baseIndex, TextRecord tr, int typo_flags,
155 Point2D.Float pt, GVData data) {
156 Font2D font = key.font();
157 FontStrike strike = font.getStrike(desc);
158 long layoutTables = font.getLayoutTableCache();
159 nativeLayout(font, strike, mat, gmask, baseIndex,
160 tr.text, tr.start, tr.limit, tr.min, tr.max,
161 key.script(), key.lang(), typo_flags, pt, data,
162 font.getUnitsPerEm(), layoutTables);
163 }
164
165 private static native void
166 nativeLayout(Font2D font, FontStrike strike, float[] mat, int gmask,
167 int baseIndex, char[] chars, int offset, int limit,
168 int min, int max, int script, int lang, int typo_flags,
169 Point2D.Float pt, GVData data, long upem, long layoutTables);
170 }
|