jdk/src/java.desktop/share/classes/sun/font/ScriptRun.java
changeset 26037 508779ce6619
parent 26004 7507a1b93f67
parent 25859 3317bb8137f4
child 30948 0a0972d3b58d
equal deleted inserted replaced
25992:e9b05e933ddd 26037:508779ce6619
   119     /**
   119     /**
   120      * Get the starting index of the current script run.
   120      * Get the starting index of the current script run.
   121      *
   121      *
   122      * @return the index of the first character in the current script run.
   122      * @return the index of the first character in the current script run.
   123      */
   123      */
   124     public final int getScriptStart() {
   124     public int getScriptStart() {
   125         return scriptStart;
   125         return scriptStart;
   126     }
   126     }
   127 
   127 
   128     /**
   128     /**
   129      * Get the index of the first character after the current script run.
   129      * Get the index of the first character after the current script run.
   130      *
   130      *
   131      * @return the index of the first character after the current script run.
   131      * @return the index of the first character after the current script run.
   132      */
   132      */
   133     public final int getScriptLimit() {
   133     public int getScriptLimit() {
   134         return scriptLimit;
   134         return scriptLimit;
   135     }
   135     }
   136 
   136 
   137     /**
   137     /**
   138      * Get the script code for the script of the current script run.
   138      * Get the script code for the script of the current script run.
   139      *
   139      *
   140      * @return the script code for the script of the current script run.
   140      * @return the script code for the script of the current script run.
   141      * @see #Script
   141      * @see #Script
   142      */
   142      */
   143     public final int getScriptCode() {
   143     public int getScriptCode() {
   144         return scriptCode;
   144         return scriptCode;
   145     }
   145     }
   146 
   146 
   147     /**
   147     /**
   148      * Find the next script run. Returns <code>false</code> if there
   148      * Find the next script run. Returns <code>false</code> if there
   149      * isn't another run, returns <code>true</code> if there is.
   149      * isn't another run, returns <code>true</code> if there is.
   150      *
   150      *
   151      * @return <code>false</code> if there isn't another run, <code>true</code> if there is.
   151      * @return <code>false</code> if there isn't another run, <code>true</code> if there is.
   152      */
   152      */
   153     public final boolean next() {
   153     public boolean next() {
   154         int startSP  = parenSP;  // used to find the first new open character
   154         int startSP  = parenSP;  // used to find the first new open character
   155 
   155 
   156         // if we've fallen off the end of the text, we're done
   156         // if we've fallen off the end of the text, we're done
   157         if (scriptLimit >= textLimit) {
   157         if (scriptLimit >= textLimit) {
   158             return false;
   158             return false;
   240     static final int LEAD_SURROGATE_SHIFT = 10;
   240     static final int LEAD_SURROGATE_SHIFT = 10;
   241     static final int SURROGATE_OFFSET = SURROGATE_START - (LEAD_START << LEAD_SURROGATE_SHIFT) - TAIL_START;
   241     static final int SURROGATE_OFFSET = SURROGATE_START - (LEAD_START << LEAD_SURROGATE_SHIFT) - TAIL_START;
   242 
   242 
   243     static final int DONE = -1;
   243     static final int DONE = -1;
   244 
   244 
   245     private final int nextCodePoint() {
   245     private int nextCodePoint() {
   246         if (scriptLimit >= textLimit) {
   246         if (scriptLimit >= textLimit) {
   247             return DONE;
   247             return DONE;
   248         }
   248         }
   249         int ch = text[scriptLimit++];
   249         int ch = text[scriptLimit++];
   250         if (ch >= LEAD_START && ch < LEAD_LIMIT && scriptLimit < textLimit) {
   250         if (ch >= LEAD_START && ch < LEAD_LIMIT && scriptLimit < textLimit) {
   255             }
   255             }
   256         }
   256         }
   257         return ch;
   257         return ch;
   258     }
   258     }
   259 
   259 
   260     private final void pushback(int ch) {
   260     private void pushback(int ch) {
   261         if (ch >= 0) {
   261         if (ch >= 0) {
   262             if (ch >= 0x10000) {
   262             if (ch >= 0x10000) {
   263                 scriptLimit -= 2;
   263                 scriptLimit -= 2;
   264             } else {
   264             } else {
   265                 scriptLimit -= 1;
   265                 scriptLimit -= 1;
   285      * the bits.
   285      * the bits.
   286      *
   286      *
   287      * @param n the word in which to find the highest bit that's set.
   287      * @param n the word in which to find the highest bit that's set.
   288      * @return the bit number (counting from the low order bit) of the highest bit.
   288      * @return the bit number (counting from the low order bit) of the highest bit.
   289      */
   289      */
   290     private static final byte highBit(int n)
   290     private static byte highBit(int n)
   291     {
   291     {
   292         if (n <= 0) {
   292         if (n <= 0) {
   293             return -32;
   293             return -32;
   294         }
   294         }
   295 
   295