138 LayoutEngine e = (LayoutEngine)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 cacheref = new SoftReference(null); 147 148 private SunLayoutEngine(LayoutEngineKey key) { 149 this.key = key; 150 } 151 152 public void layout(FontStrikeDesc desc, float[] mat, int gmask, 153 int baseIndex, TextRecord tr, int typo_flags, 154 Point2D.Float pt, GVData data) { 155 Font2D font = key.font(); 156 FontStrike strike = font.getStrike(desc); 157 long layoutTables = font.getLayoutTableCache(); 158 nativeLayout(font, strike, mat, gmask, baseIndex, 159 tr.text, tr.start, tr.limit, tr.min, tr.max, 160 key.script(), key.lang(), typo_flags, pt, data, 161 font.getUnitsPerEm(), layoutTables); 162 } 163 164 private static native void 165 nativeLayout(Font2D font, FontStrike strike, float[] mat, int gmask, 166 int baseIndex, char[] chars, int offset, int limit, 167 int min, int max, int script, int lang, int typo_flags, 168 Point2D.Float pt, GVData data, long upem, long layoutTables); 169 } | 138 LayoutEngine e = (LayoutEngine)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 cacheref = new SoftReference(null); 147 148 private SunLayoutEngine(LayoutEngineKey key) { 149 this.key = key; 150 } 151 152 public void layout(FontStrikeDesc desc, float[] mat, int gmask, 153 int baseIndex, TextRecord tr, int typo_flags, 154 Point2D.Float pt, GVData data) { 155 Font2D font = key.font(); 156 FontStrike strike = font.getStrike(desc); 157 long layoutTables = font.getLayoutTableCache(); 158 if (font instanceof CFont && (typo_flags & 0x80000000) != 0) { 159 // Ignore layout tables for RTL AAT fonts 160 // due to lack of support in ICU 161 layoutTables = 0; 162 } 163 nativeLayout(font, strike, mat, gmask, baseIndex, 164 tr.text, tr.start, tr.limit, tr.min, tr.max, 165 key.script(), key.lang(), typo_flags, pt, data, 166 font.getUnitsPerEm(), layoutTables); 167 } 168 169 private static native void 170 nativeLayout(Font2D font, FontStrike strike, float[] mat, int gmask, 171 int baseIndex, char[] chars, int offset, int limit, 172 int min, int max, int script, int lang, int typo_flags, 173 Point2D.Float pt, GVData data, long upem, long layoutTables); 174 } |