java.lang.Object | |
↳ | sun.font.ScriptRun |
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 + "."); } }
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Construct a
ScriptRun object which iterates over a subrange
of the given characetrs. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Get the script code for the script of the current script run.
| |||||||||||
Get the index of the first character after the current script run.
| |||||||||||
Get the starting index of the current script run.
| |||||||||||
Find the next script run.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Construct a ScriptRun
object which iterates over a subrange
of the given characetrs.
chars | the array of characters over which to iterate. |
---|---|
start | the index of the first character over which to iterate |
count | the number of characters over which to iterate |
Get the script code for the script of the current script run.
Get the index of the first character after the current script run.
Get the starting index of the current script run.
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.