253 FontDescriptor lastFontDescriptor = null; 254 char currentDefaultChar; 255 PlatformFontCache theChar; 256 257 // Simple bounds check 258 int end = start + len; 259 if (start < 0 || end > data.length) { 260 throw new ArrayIndexOutOfBoundsException(); 261 } 262 263 if(stringIndex >= end) { 264 return null; 265 } 266 267 // coversion loop 268 while(stringIndex < end) 269 { 270 currentDefaultChar = data[stringIndex]; 271 272 // Note that cache sizes must be a power of two! 273 cacheIndex = (int)(currentDefaultChar & PlatformFont.FONTCACHEMASK); 274 275 theChar = (PlatformFontCache)getFontCache()[cacheIndex]; 276 277 // Is the unicode char we want cached? 278 if(theChar == null || theChar.uniChar != currentDefaultChar) 279 { 280 /* find a converter that can convert the current character */ 281 currentFontDescriptor = defaultFont; 282 currentDefaultChar = defaultChar; 283 char ch = (char)data[stringIndex]; 284 int componentCount = componentFonts.length; 285 286 for (int j = 0; j < componentCount; j++) { 287 FontDescriptor fontDescriptor = componentFonts[j]; 288 289 fontDescriptor.encoder.reset(); 290 //fontDescriptor.encoder.onUnmappleCharacterAction(...); 291 292 if (fontDescriptor.isExcluded(ch)) { 293 continue; 294 } 295 if (fontDescriptor.encoder.canEncode(ch)) { 296 currentFontDescriptor = fontDescriptor; 297 currentDefaultChar = ch; 298 break; 299 } 300 } 301 try { 302 char[] input = new char[1]; 303 input[0] = currentDefaultChar; | 253 FontDescriptor lastFontDescriptor = null; 254 char currentDefaultChar; 255 PlatformFontCache theChar; 256 257 // Simple bounds check 258 int end = start + len; 259 if (start < 0 || end > data.length) { 260 throw new ArrayIndexOutOfBoundsException(); 261 } 262 263 if(stringIndex >= end) { 264 return null; 265 } 266 267 // coversion loop 268 while(stringIndex < end) 269 { 270 currentDefaultChar = data[stringIndex]; 271 272 // Note that cache sizes must be a power of two! 273 cacheIndex = (currentDefaultChar & PlatformFont.FONTCACHEMASK); 274 275 theChar = (PlatformFontCache)getFontCache()[cacheIndex]; 276 277 // Is the unicode char we want cached? 278 if(theChar == null || theChar.uniChar != currentDefaultChar) 279 { 280 /* find a converter that can convert the current character */ 281 currentFontDescriptor = defaultFont; 282 currentDefaultChar = defaultChar; 283 char ch = data[stringIndex]; 284 int componentCount = componentFonts.length; 285 286 for (int j = 0; j < componentCount; j++) { 287 FontDescriptor fontDescriptor = componentFonts[j]; 288 289 fontDescriptor.encoder.reset(); 290 //fontDescriptor.encoder.onUnmappleCharacterAction(...); 291 292 if (fontDescriptor.isExcluded(ch)) { 293 continue; 294 } 295 if (fontDescriptor.encoder.canEncode(ch)) { 296 currentFontDescriptor = fontDescriptor; 297 currentDefaultChar = ch; 298 break; 299 } 300 } 301 try { 302 char[] input = new char[1]; 303 input[0] = currentDefaultChar; |