src/java.desktop/share/classes/sun/font/GlyphLayout.java

Print this page




 391 
 392         int min = 0;
 393         int max = text.length;
 394         if (flags != 0) {
 395             if ((flags & Font.LAYOUT_RIGHT_TO_LEFT) != 0) {
 396               _typo_flags |= 0x80000000; // RTL
 397             }
 398 
 399             if ((flags & Font.LAYOUT_NO_START_CONTEXT) != 0) {
 400                 min = offset;
 401             }
 402 
 403             if ((flags & Font.LAYOUT_NO_LIMIT_CONTEXT) != 0) {
 404                 max = lim;
 405             }
 406         }
 407 
 408         int lang = -1; // default for now
 409 
 410         Font2D font2D = FontUtilities.getFont2D(font);



 411 
 412         _textRecord.init(text, offset, lim, min, max);
 413         int start = offset;
 414         if (font2D instanceof CompositeFont) {
 415             _scriptRuns.init(text, offset, count); // ??? how to handle 'common' chars
 416             _fontRuns.init((CompositeFont)font2D, text, offset, lim);
 417             while (_scriptRuns.next()) {
 418                 int limit = _scriptRuns.getScriptLimit();
 419                 int script = _scriptRuns.getScriptCode();
 420                 while (_fontRuns.next(script, limit)) {
 421                     Font2D pfont = _fontRuns.getFont();
 422                     /* layout can't deal with NativeFont instances. The
 423                      * native font is assumed to know of a suitable non-native
 424                      * substitute font. This currently works because
 425                      * its consistent with the way NativeFonts delegate
 426                      * in other cases too.
 427                      */
 428                     if (pfont instanceof NativeFont) {
 429                         pfont = ((NativeFont)pfont).getDelegateFont();
 430                     }




 391 
 392         int min = 0;
 393         int max = text.length;
 394         if (flags != 0) {
 395             if ((flags & Font.LAYOUT_RIGHT_TO_LEFT) != 0) {
 396               _typo_flags |= 0x80000000; // RTL
 397             }
 398 
 399             if ((flags & Font.LAYOUT_NO_START_CONTEXT) != 0) {
 400                 min = offset;
 401             }
 402 
 403             if ((flags & Font.LAYOUT_NO_LIMIT_CONTEXT) != 0) {
 404                 max = lim;
 405             }
 406         }
 407 
 408         int lang = -1; // default for now
 409 
 410         Font2D font2D = FontUtilities.getFont2D(font);
 411         if (font2D instanceof FontSubstitution) {
 412             font2D = ((FontSubstitution)font2D).getCompositeFont2D();
 413         }
 414 
 415         _textRecord.init(text, offset, lim, min, max);
 416         int start = offset;
 417         if (font2D instanceof CompositeFont) {
 418             _scriptRuns.init(text, offset, count); // ??? how to handle 'common' chars
 419             _fontRuns.init((CompositeFont)font2D, text, offset, lim);
 420             while (_scriptRuns.next()) {
 421                 int limit = _scriptRuns.getScriptLimit();
 422                 int script = _scriptRuns.getScriptCode();
 423                 while (_fontRuns.next(script, limit)) {
 424                     Font2D pfont = _fontRuns.getFont();
 425                     /* layout can't deal with NativeFont instances. The
 426                      * native font is assumed to know of a suitable non-native
 427                      * substitute font. This currently works because
 428                      * its consistent with the way NativeFonts delegate
 429                      * in other cases too.
 430                      */
 431                     if (pfont instanceof NativeFont) {
 432                         pfont = ((NativeFont)pfont).getDelegateFont();
 433                     }