| java.lang.Object sun.font.ScriptRun
ScriptRun | final public class ScriptRun (Code) | | ScriptRun is used to find runs of characters in
the same script, as defined in the Script class.
It implements a simple iterator over an array of characters.
The iterator will assign COMMON and INHERITED
characters to the same script as the preceeding characters. If the
COMMON and INHERITED characters are first, they will be assigned to
the same script as the following characters.
The iterator will try to match paired punctuation. If it sees an
opening punctuation character, it will remember the script that
was assigned to that character, and assign the same script to the
matching closing punctuation.
No attempt is made to combine related scripts into a single run. In
particular, Hiragana, Katakana, and Han characters will appear in seperate
runs.
Here is an example of how to iterate over script runs:
void printScriptRuns(char[] text)
{
ScriptRun scriptRun = new ScriptRun(text, 0, text.length);
while (scriptRun.next()) {
int start = scriptRun.getScriptStart();
int limit = scriptRun.getScriptLimit();
int script = scriptRun.getScriptCode();
System.out.println("Script \"" + Script.getName(script) + "\" from " +
start + " to " + limit + ".");
}
}
|
Constructor Summary | |
public | ScriptRun() | public | ScriptRun(char[] chars, int start, int count) Construct a ScriptRun object which iterates over a subrange
of the given characetrs. |
Method Summary | |
final public int | getScriptCode() Get the script code for the script of the current script run. | final public int | getScriptLimit() Get the index of the first character after the current script run. | final public int | getScriptStart() Get the starting index of the current script run. | public void | init(char[] chars, int start, int count) | final public boolean | next() Find the next script run. |
DONE | final static int DONE(Code) | | |
LEAD_LIMIT | final static int LEAD_LIMIT(Code) | | |
LEAD_START | final static int LEAD_START(Code) | | |
LEAD_SURROGATE_SHIFT | final static int LEAD_SURROGATE_SHIFT(Code) | | |
SURROGATE_OFFSET | final static int SURROGATE_OFFSET(Code) | | |
SURROGATE_START | final static int SURROGATE_START(Code) | | |
TAIL_LIMIT | final static int TAIL_LIMIT(Code) | | |
TAIL_START | final static int TAIL_START(Code) | | |
ScriptRun | public ScriptRun()(Code) | | |
ScriptRun | public ScriptRun(char[] chars, int start, int count)(Code) | | Construct a ScriptRun object which iterates over a subrange
of the given characetrs.
Parameters: chars - the array of characters over which to iterate. Parameters: start - the index of the first character over which to iterate Parameters: count - the number of characters over which to iterate |
getScriptCode | final public int getScriptCode()(Code) | | Get the script code for the script of the current script run.
the script code for the script of the current script run. See Also: ScriptRun.Script |
getScriptLimit | final public int getScriptLimit()(Code) | | Get the index of the first character after the current script run.
the index of the first character after the current script run. |
getScriptStart | final public int getScriptStart()(Code) | | Get the starting index of the current script run.
the index of the first character in the current script run. |
init | public void init(char[] chars, int start, int count)(Code) | | |
next | final public boolean next()(Code) | | Find the next script run. Returns false if there
isn't another run, returns true if there is.
false if there isn't another run, true if there is. |
|
|