Updated comments so that Javadoc 1.4 warnings went away.
This commit is contained in:
parent
3ad36a3f8e
commit
10d86fc3b7
3 changed files with 2562 additions and 2500 deletions
|
@ -25,9 +25,13 @@ import java.awt.font.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.text.*;
|
import javax.swing.text.*;
|
||||||
|
|
||||||
import java.lang.*;
|
import java.lang.*;
|
||||||
import org.thdl.tib.text.*;
|
import org.thdl.tib.text.*;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import javax.swing.text.rtf.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables input of Tibetan text
|
* Enables input of Tibetan text
|
||||||
* using Tibetan Computer Company's free cross-platform TibetanMachineWeb fonts.
|
* using Tibetan Computer Company's free cross-platform TibetanMachineWeb fonts.
|
||||||
|
@ -184,7 +188,7 @@ public class DuffPane extends JTextPane implements KeyListener, FocusListener {
|
||||||
* current entry/edit/deletion position.
|
* current entry/edit/deletion position.
|
||||||
*/
|
*/
|
||||||
private Caret caret;
|
private Caret caret;
|
||||||
private StyledEditorKit editorKit;
|
// private StyledEditorKit editorKit;
|
||||||
private StyleContext styleContext;
|
private StyleContext styleContext;
|
||||||
private Style rootStyle;
|
private Style rootStyle;
|
||||||
private boolean skipUpdate = false;
|
private boolean skipUpdate = false;
|
||||||
|
@ -194,57 +198,75 @@ public class DuffPane extends JTextPane implements KeyListener, FocusListener {
|
||||||
private int romanFontSize;
|
private int romanFontSize;
|
||||||
private MutableAttributeSet romanAttributeSet;
|
private MutableAttributeSet romanAttributeSet;
|
||||||
|
|
||||||
|
public Clipboard rtfBoard;
|
||||||
|
public DataFlavor rtfFlavor;
|
||||||
|
public RTFEditorKit rtfEd = null;
|
||||||
|
|
||||||
public DuffPane() {
|
public DuffPane() {
|
||||||
this(new StyledEditorKit());
|
setupKeyboard();
|
||||||
|
setupEditor();
|
||||||
|
// this(new StyledEditorKit());
|
||||||
}
|
}
|
||||||
|
|
||||||
public DuffPane(TibetanKeyboard keyboard) {
|
public DuffPane(TibetanKeyboard keyboard) {
|
||||||
this(new StyledEditorKit(), keyboard);
|
TibetanMachineWeb.setKeyboard(keyboard);
|
||||||
|
setupKeyboard();
|
||||||
|
setupEditor();
|
||||||
|
// this(new StyledEditorKit(), keyboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DuffPane(java.net.URL keyboardURL) {
|
public DuffPane(java.net.URL keyboardURL) {
|
||||||
this(new StyledEditorKit(), keyboardURL);
|
|
||||||
}
|
|
||||||
|
|
||||||
public DuffPane(StyledEditorKit styledEditorKit) {
|
|
||||||
setupKeyboard();
|
|
||||||
setupEditor(styledEditorKit);
|
|
||||||
}
|
|
||||||
|
|
||||||
public DuffPane(StyledEditorKit styledEditorKit, TibetanKeyboard keyboard) {
|
|
||||||
TibetanMachineWeb.setKeyboard(keyboard);
|
|
||||||
setupKeyboard();
|
|
||||||
setupEditor(styledEditorKit);
|
|
||||||
}
|
|
||||||
|
|
||||||
public DuffPane(StyledEditorKit styledEditorKit, java.net.URL keyboardURL) {
|
|
||||||
TibetanMachineWeb.setKeyboard(keyboardURL);
|
TibetanMachineWeb.setKeyboard(keyboardURL);
|
||||||
|
setupKeyboard();
|
||||||
|
setupEditor();
|
||||||
|
// this(new StyledEditorKit(), keyboardURL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
public DuffPane() {
|
||||||
setupKeyboard();
|
setupKeyboard();
|
||||||
setupEditor(styledEditorKit);
|
setupEditor(styledEditorKit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DuffPane(TibetanKeyboard keyboard) {
|
||||||
|
TibetanMachineWeb.setKeyboard(keyboard);
|
||||||
|
setupKeyboard();
|
||||||
|
setupEditor();
|
||||||
|
}
|
||||||
|
|
||||||
|
public DuffPane(java.net.URL keyboardURL) {
|
||||||
|
TibetanMachineWeb.setKeyboard(keyboardURL);
|
||||||
|
setupKeyboard();
|
||||||
|
setupEditor();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method sets up the editor, assigns fonts and point sizes,
|
* This method sets up the editor, assigns fonts and point sizes,
|
||||||
* sets the document, the caret, and adds key and focus listeners.
|
* sets the document, the caret, and adds key and focus listeners.
|
||||||
*
|
*
|
||||||
* @param sek the StyledEditorKit for the editing window
|
* @param sek the StyledEditorKit for the editing window
|
||||||
*/
|
*/
|
||||||
private void setupEditor(StyledEditorKit sek) {
|
public void setupEditor() {
|
||||||
|
rtfBoard = getToolkit().getSystemClipboard();
|
||||||
|
rtfFlavor = new DataFlavor("text/rtf", "Rich Text Format");
|
||||||
|
rtfEd = new RTFEditorKit();
|
||||||
|
setEditorKit(rtfEd);
|
||||||
|
styleContext = new StyleContext();
|
||||||
|
|
||||||
|
doc = new TibetanDocument(styleContext);
|
||||||
|
doc.setTibetanFontSize(36);
|
||||||
|
setDocument(doc);
|
||||||
|
|
||||||
|
Style defaultStyle = styleContext.getStyle(StyleContext.DEFAULT_STYLE);
|
||||||
|
StyleConstants.setFontFamily(defaultStyle, "TibetanMachineWeb");
|
||||||
|
StyleConstants.setFontSize(defaultStyle, 36);
|
||||||
|
|
||||||
romanFontFamily = "Serif";
|
romanFontFamily = "Serif";
|
||||||
romanFontSize = 14;
|
romanFontSize = 14;
|
||||||
setRomanAttributeSet(romanFontFamily, romanFontSize);
|
setRomanAttributeSet(romanFontFamily, romanFontSize);
|
||||||
|
|
||||||
editorKit = sek;
|
// newDocument();
|
||||||
setEditorKit(editorKit);
|
|
||||||
styleContext = new StyleContext();
|
|
||||||
|
|
||||||
Style defaultStyle = styleContext.getStyle(StyleContext.DEFAULT_STYLE);
|
|
||||||
rootStyle = styleContext.addStyle("RootStyle", defaultStyle);
|
|
||||||
StyleConstants.setFontFamily(rootStyle, "TibetanMachineWeb");
|
|
||||||
StyleConstants.setFontSize(rootStyle, 36);
|
|
||||||
setLogicalStyle(rootStyle);
|
|
||||||
|
|
||||||
newDocument();
|
|
||||||
caret = getCaret();
|
caret = getCaret();
|
||||||
|
|
||||||
addKeyListener(this);
|
addKeyListener(this);
|
||||||
|
@ -258,7 +280,7 @@ public class DuffPane extends JTextPane implements KeyListener, FocusListener {
|
||||||
* respect to stacking, and concerning the differences between
|
* respect to stacking, and concerning the differences between
|
||||||
* Tibetan and Sanskrit; and then it initializes the input method.
|
* Tibetan and Sanskrit; and then it initializes the input method.
|
||||||
*/
|
*/
|
||||||
private void setupKeyboard() {
|
public void setupKeyboard() {
|
||||||
if (TibetanMachineWeb.hasTibetanStackingKey()) {
|
if (TibetanMachineWeb.hasTibetanStackingKey()) {
|
||||||
if (TibetanMachineWeb.hasSanskritStackingKey()) {
|
if (TibetanMachineWeb.hasSanskritStackingKey()) {
|
||||||
isDefinitelyTibetan_default = false;
|
isDefinitelyTibetan_default = false;
|
||||||
|
@ -308,12 +330,11 @@ public class DuffPane extends JTextPane implements KeyListener, FocusListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a keyboard, and sets it as
|
* Registers a keyboard, and sets it as the active keyboard.
|
||||||
* the active keyboard. * Unpredictable behavior will result
|
* Unpredictable behavior will result if you set the keyboard in {@link
|
||||||
* if you set the keyboard in {@link org.thdl.tib.text.TibetanMachineWeb TibetanMachineWeb}
|
* org.thdl.tib.text.TibetanMachineWeb TibetanMachineWeb} but don't
|
||||||
* but don't register it in here.
|
* register it in here.
|
||||||
* @param keyboardURL the URL of the keyboard you want to install
|
* @param keyboardURL the URL of the keyboard you want to install */
|
||||||
*/
|
|
||||||
public void registerKeyboard(java.net.URL keyboardURL) {
|
public void registerKeyboard(java.net.URL keyboardURL) {
|
||||||
TibetanMachineWeb.setKeyboard(keyboardURL);
|
TibetanMachineWeb.setKeyboard(keyboardURL);
|
||||||
setupKeyboard();
|
setupKeyboard();
|
||||||
|
@ -336,10 +357,15 @@ public class DuffPane extends JTextPane implements KeyListener, FocusListener {
|
||||||
* Clears the current document.
|
* Clears the current document.
|
||||||
*/
|
*/
|
||||||
public void newDocument() {
|
public void newDocument() {
|
||||||
|
styleContext = new StyleContext();
|
||||||
|
|
||||||
doc = new TibetanDocument(styleContext);
|
doc = new TibetanDocument(styleContext);
|
||||||
doc.setTibetanFontSize(36);
|
doc.setTibetanFontSize(36);
|
||||||
setDocument(doc);
|
setDocument(doc);
|
||||||
setLogicalStyle(rootStyle);
|
|
||||||
|
Style defaultStyle = styleContext.getStyle(StyleContext.DEFAULT_STYLE);
|
||||||
|
StyleConstants.setFontFamily(defaultStyle, "TibetanMachineWeb");
|
||||||
|
StyleConstants.setFontSize(defaultStyle, 36);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -636,7 +662,7 @@ public class DuffPane extends JTextPane implements KeyListener, FocusListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints ACHEN together with the vowel v. When using the Wylie
|
* Prints ACHEN together with the vowel v. When using the Wylie
|
||||||
* keyboard, or any other keyboard in which {@link thdl.tibetan.text.TibetanMachineWeb#isAChenRequiredBeforeVowel() isAChenRequiredBeforeVowel()}
|
* keyboard, or any other keyboard in which {@link org.thdl.tib.text.TibetanMachineWeb#isAChenRequiredBeforeVowel() isAChenRequiredBeforeVowel()}
|
||||||
* is false, this method is called frequently.
|
* is false, this method is called frequently.
|
||||||
*
|
*
|
||||||
* @param v the vowel (in Wylie) which you want to print with ACHEN
|
* @param v the vowel (in Wylie) which you want to print with ACHEN
|
||||||
|
@ -718,6 +744,57 @@ public class DuffPane extends JTextPane implements KeyListener, FocusListener {
|
||||||
initKeyboard();
|
initKeyboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class RTFSelection implements ClipboardOwner, Transferable {
|
||||||
|
DataFlavor[] supportedFlavor;
|
||||||
|
ByteArrayOutputStream rtfOut;
|
||||||
|
String plainText;
|
||||||
|
|
||||||
|
RTFSelection(StyledDocument doc, int offset, int length) {
|
||||||
|
supportedFlavor = new DataFlavor[2];
|
||||||
|
supportedFlavor[0] = rtfFlavor;
|
||||||
|
supportedFlavor[1] = DataFlavor.stringFlavor;
|
||||||
|
try {
|
||||||
|
//construct new document that contains only portion of text you want to copy
|
||||||
|
//this workaround is due to bug 4129911, which will not be fixed (see below after source code)
|
||||||
|
StyledDocument newDoc = new DefaultStyledDocument();
|
||||||
|
for (int i=offset; i<offset+length; i++) {
|
||||||
|
try {
|
||||||
|
String s = doc.getText(i,1);
|
||||||
|
AttributeSet as = doc.getCharacterElement(i).getAttributes();
|
||||||
|
newDoc.insertString(i-offset, s, as);
|
||||||
|
} catch (BadLocationException ble) {
|
||||||
|
ble.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rtfOut = new ByteArrayOutputStream();
|
||||||
|
rtfEd.write(rtfOut, newDoc, 0, newDoc.getLength()); //last two parameters ignored, see bug below
|
||||||
|
plainText = getText(offset, length);
|
||||||
|
} catch (BadLocationException ble) {
|
||||||
|
ble.printStackTrace();
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
ioe.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void lostOwnership(Clipboard clipboard, Transferable contents) {
|
||||||
|
}
|
||||||
|
public Object getTransferData(DataFlavor flavor) {
|
||||||
|
if (flavor.equals(rtfFlavor))
|
||||||
|
return new ByteArrayInputStream(rtfOut.toByteArray());
|
||||||
|
if (flavor.equals(DataFlavor.stringFlavor))
|
||||||
|
return plainText;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public DataFlavor[] getTransferDataFlavors() {
|
||||||
|
return supportedFlavor;
|
||||||
|
}
|
||||||
|
public boolean isDataFlavorSupported(DataFlavor flavor) {
|
||||||
|
for (int i=0; i<supportedFlavor.length; i++)
|
||||||
|
if (flavor.equals(supportedFlavor[i]))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cuts or copies the specified portion of this object's document
|
* Cuts or copies the specified portion of this object's document
|
||||||
* to the system clipboard. What is cut/copied is Wylie text -
|
* to the system clipboard. What is cut/copied is Wylie text -
|
||||||
|
@ -731,57 +808,23 @@ public class DuffPane extends JTextPane implements KeyListener, FocusListener {
|
||||||
* false if it is 'copy'
|
* false if it is 'copy'
|
||||||
*/
|
*/
|
||||||
public void copy(int start, int end, boolean remove) {
|
public void copy(int start, int end, boolean remove) {
|
||||||
if (start < end) {
|
int p1 = start;
|
||||||
java.util.List dcs = new ArrayList();
|
int p2 = end;
|
||||||
|
if (p1 != p2) {
|
||||||
|
RTFSelection rtfSelection = new RTFSelection((StyledDocument)getDocument(), p1, p2-p1);
|
||||||
try {
|
try {
|
||||||
AttributeSet attr;
|
rtfBoard.setContents(rtfSelection, rtfSelection);
|
||||||
String fontName;
|
} catch (IllegalStateException ise) {
|
||||||
int fontNum;
|
ise.printStackTrace();
|
||||||
DuffCode dc;
|
|
||||||
char ch;
|
|
||||||
|
|
||||||
int i = start;
|
|
||||||
|
|
||||||
while (i < end+1) {
|
|
||||||
attr = doc.getCharacterElement(i).getAttributes();
|
|
||||||
fontName = StyleConstants.getFontFamily(attr);
|
|
||||||
|
|
||||||
if ((0 == (fontNum = TibetanMachineWeb.getTMWFontNumber(fontName))) || i==end) {
|
|
||||||
if (i != start) {
|
|
||||||
DuffCode[] dc_array = new DuffCode[0];
|
|
||||||
dc_array = (DuffCode[])dcs.toArray(dc_array);
|
|
||||||
StringSelection data = new StringSelection(TibetanDocument.getWylie(dc_array));
|
|
||||||
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
|
|
||||||
clipboard.setContents(data, data);
|
|
||||||
if (remove) {
|
|
||||||
doc.remove(start, i-start);
|
|
||||||
setSelectionEnd(start);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
setSelectionStart(start);
|
|
||||||
setSelectionEnd(i);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
setSelectionEnd(start);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
if (remove)
|
||||||
ch = doc.getText(i,1).charAt(0);
|
try {
|
||||||
dc = new DuffCode(fontNum, ch);
|
getDocument().remove(p1, p2-p1);
|
||||||
dcs.add(dc);
|
} catch (BadLocationException ble) {
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (BadLocationException ble) {
|
|
||||||
ble.printStackTrace();
|
ble.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pastes the contents of the system clipboard into this object's
|
* Pastes the contents of the system clipboard into this object's
|
||||||
|
@ -794,19 +837,37 @@ public class DuffPane extends JTextPane implements KeyListener, FocusListener {
|
||||||
* @param offset the position in the document you want to paste to
|
* @param offset the position in the document you want to paste to
|
||||||
*/
|
*/
|
||||||
public void paste(int offset) {
|
public void paste(int offset) {
|
||||||
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
|
|
||||||
Transferable data = clipboard.getContents(this);
|
|
||||||
|
|
||||||
String s = null;
|
|
||||||
try {
|
try {
|
||||||
s = (String)(data.getTransferData(DataFlavor.stringFlavor));
|
Transferable contents = rtfBoard.getContents(this);
|
||||||
}
|
if (contents.isDataFlavorSupported(rtfFlavor)) {
|
||||||
catch (Exception e) {
|
InputStream in = (InputStream)contents.getTransferData(rtfFlavor);
|
||||||
s = data.toString();
|
int p1 = offset;
|
||||||
}
|
|
||||||
|
|
||||||
if (s != null)
|
//construct new document that contains only portion of text you want to paste
|
||||||
toTibetanMachineWeb(s, offset);
|
StyledDocument sd = new DefaultStyledDocument();
|
||||||
|
rtfEd.read(in, sd, 0);
|
||||||
|
for (int i=0; i<sd.getLength()-1; i++) { //getLength()-1 so that final newline is not included in paste
|
||||||
|
try {
|
||||||
|
String s = sd.getText(i,1);
|
||||||
|
AttributeSet as = sd.getCharacterElement(i).getAttributes();
|
||||||
|
doc.insertString(p1+i, s, as);
|
||||||
|
} catch (BadLocationException ble) {
|
||||||
|
ble.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (contents.isDataFlavorSupported(DataFlavor.stringFlavor)) {
|
||||||
|
String s = (String)contents.getTransferData(DataFlavor.stringFlavor);
|
||||||
|
replaceSelection(s);
|
||||||
|
}
|
||||||
|
} catch (UnsupportedFlavorException ufe) {
|
||||||
|
ufe.printStackTrace();
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
ioe.printStackTrace();
|
||||||
|
} catch (IllegalStateException ise) {
|
||||||
|
ise.printStackTrace();
|
||||||
|
} catch (BadLocationException ble) {
|
||||||
|
ble.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1298,8 +1359,21 @@ public class DuffPane extends JTextPane implements KeyListener, FocusListener {
|
||||||
*/
|
*/
|
||||||
public void toTibetanMachineWeb(String wylie, int offset) {
|
public void toTibetanMachineWeb(String wylie, int offset) {
|
||||||
try {
|
try {
|
||||||
TibetanDocument.DuffData[] dd = TibetanDocument.getTibetanMachineWeb(wylie);
|
StringTokenizer sTok = new StringTokenizer(wylie, "\n\t", true);
|
||||||
doc.insertDuff(offset, dd);
|
while (sTok.hasMoreTokens()) {
|
||||||
|
String next = sTok.nextToken();
|
||||||
|
if (next.equals("\n") || next.equals("\t")) {
|
||||||
|
try {
|
||||||
|
doc.insertString(offset, next, null);
|
||||||
|
offset++;
|
||||||
|
} catch (BadLocationException ble) {
|
||||||
|
ble.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
TibetanDocument.DuffData[] dd = TibetanDocument.getTibetanMachineWeb(next);
|
||||||
|
offset = doc.insertDuff(offset, dd);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (InvalidWylieException iwe) {
|
catch (InvalidWylieException iwe) {
|
||||||
JOptionPane.showMessageDialog(this,
|
JOptionPane.showMessageDialog(this,
|
||||||
|
@ -1307,7 +1381,6 @@ public class DuffPane extends JTextPane implements KeyListener, FocusListener {
|
||||||
"beginning from:\n " + iwe.getCulpritInContext() + "\n" +
|
"beginning from:\n " + iwe.getCulpritInContext() + "\n" +
|
||||||
"The culprit is probably the character '"+iwe.getCulprit()+"'.");
|
"The culprit is probably the character '"+iwe.getCulprit()+"'.");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1373,4 +1446,5 @@ public class DuffPane extends JTextPane implements KeyListener, FocusListener {
|
||||||
ble.printStackTrace();
|
ble.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,9 @@ import java.io.Serializable;
|
||||||
/** Used by DictionaryTable to display a Tibetan word or phrase
|
/** Used by DictionaryTable to display a Tibetan word or phrase
|
||||||
(in either Roman or Tibetan script) in a single cell.
|
(in either Roman or Tibetan script) in a single cell.
|
||||||
|
|
||||||
|
This THDL version does not include DictionaryTable.
|
||||||
|
|
||||||
@author Andrés Montano Pellegrini
|
@author Andrés Montano Pellegrini
|
||||||
@see DictionaryTable
|
|
||||||
*/
|
*/
|
||||||
public class DuffCellRenderer extends DuffPane implements TableCellRenderer, Serializable
|
public class DuffCellRenderer extends DuffPane implements TableCellRenderer, Serializable
|
||||||
{
|
{
|
||||||
|
|
|
@ -503,12 +503,18 @@ public static SimpleAttributeSet getAttributeSet(int font) {
|
||||||
* ENTER), false if not
|
* ENTER), false if not
|
||||||
*/
|
*/
|
||||||
public static boolean isFormatting(char c) {
|
public static boolean isFormatting(char c) {
|
||||||
|
if (c < 32 || c > 126)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
/*
|
||||||
if ( c == KeyEvent.VK_TAB
|
if ( c == KeyEvent.VK_TAB
|
||||||
|| c == KeyEvent.VK_ENTER)
|
|| c == KeyEvent.VK_ENTER)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -618,16 +624,13 @@ public static boolean isWylieVowel(String s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is this Wylie valid as a leftmost character
|
* Returns true iff this Wylie is valid as a leftmost character in a
|
||||||
* in a Tibetan syllable? For example, in the
|
* Tibetan syllable. For example, in the syllable 'brgyad', 'b' is the
|
||||||
* syllable 'brgyad', 'b' is the leftmost
|
* leftmost character. Valid leftmost characters include g, d, b, and
|
||||||
* character. Valid leftmost characters include
|
* m.
|
||||||
* g, d, b, and m.
|
|
||||||
* @param s the (Wylie) string to be checked
|
* @param s the (Wylie) string to be checked
|
||||||
* @return true if s is a possible leftmost
|
* @return true if s is a possible leftmost character in a Tibetan
|
||||||
* character in a Tibetan syllable, false
|
* syllable, false if not. */
|
||||||
* if not.
|
|
||||||
*/
|
|
||||||
public static boolean isWylieLeft(String s) {
|
public static boolean isWylieLeft(String s) {
|
||||||
if (keyboard != null)
|
if (keyboard != null)
|
||||||
s = keyboard.getWylieForChar(s);
|
s = keyboard.getWylieForChar(s);
|
||||||
|
@ -639,16 +642,13 @@ public static boolean isWylieLeft(String s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is this Wylie valid as a right (post-vowel)
|
* Returns true iff this Wylie is valid as a right (post-vowel)
|
||||||
* character in a Tibetan syllable? For example,
|
* character in a Tibetan syllable. For example, in the syllable
|
||||||
* in the syllable 'lags', 'g' is in the right
|
* 'lags', 'g' is in the right character position. Valid right
|
||||||
* character position. Valid right characters
|
* characters include g, ng, d, n, b, m, r, l, s, ', and T.
|
||||||
* include g, ng, d, n, b, m, r, l, s, ', and T.
|
|
||||||
* @param s the (Wylie) string to be checked
|
* @param s the (Wylie) string to be checked
|
||||||
* @return true if s is a possible right
|
* @return true if s is a possible right character in a Tibetan
|
||||||
* character in a Tibetan syllable, false
|
* syllable, false if not. */
|
||||||
* if not.
|
|
||||||
*/
|
|
||||||
public static boolean isWylieRight(String s) {
|
public static boolean isWylieRight(String s) {
|
||||||
if (keyboard != null)
|
if (keyboard != null)
|
||||||
s = keyboard.getWylieForChar(s);
|
s = keyboard.getWylieForChar(s);
|
||||||
|
@ -660,13 +660,11 @@ public static boolean isWylieRight(String s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is this Wylie valid as a leftmost character
|
* Returns true iff this Wylie is valid as a leftmost character in a
|
||||||
* in a Tibetan syllable?
|
* Tibetan syllable.
|
||||||
* @param s the string to be checked
|
* @param s the string to be checked
|
||||||
* @return true if s is a possible leftmost
|
* @return true if s is a possible leftmost character in a Tibetan
|
||||||
* character in a Tibetan syllable, false
|
* syllable, false if not. */
|
||||||
* if not.
|
|
||||||
*/
|
|
||||||
public static boolean isWylieFarRight(String s) {
|
public static boolean isWylieFarRight(String s) {
|
||||||
if (keyboard != null)
|
if (keyboard != null)
|
||||||
s = keyboard.getWylieForChar(s);
|
s = keyboard.getWylieForChar(s);
|
||||||
|
@ -1002,11 +1000,10 @@ public static Map getBinduMap() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does the keyboard have a disambiguating key?
|
* Returns true iff the keyboard has a disambiguating key.
|
||||||
* @return true if the installed keyboard has a
|
* @return true if the installed keyboard has a disambiguating key,
|
||||||
* disambiguating key, false if not
|
* false if not
|
||||||
* @see TibetanKeyboard
|
* @see TibetanKeyboard */
|
||||||
*/
|
|
||||||
public static boolean hasDisambiguatingKey() {
|
public static boolean hasDisambiguatingKey() {
|
||||||
return hasDisambiguatingKey;
|
return hasDisambiguatingKey;
|
||||||
}
|
}
|
||||||
|
@ -1022,31 +1019,28 @@ public static char getDisambiguatingKey() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does the keyboard have a Sanksrit stacking key?
|
* Returns true iff the keyboard has a Sanksrit stacking key.
|
||||||
* @return true if a stacking key is required
|
* @return true if a stacking key is required to type Sanskrit stacks,
|
||||||
* to type Sanskrit stacks, false if not
|
* false if not
|
||||||
* @see TibetanKeyboard
|
* @see TibetanKeyboard */
|
||||||
*/
|
|
||||||
public static boolean hasSanskritStackingKey() {
|
public static boolean hasSanskritStackingKey() {
|
||||||
return hasSanskritStackingKey;
|
return hasSanskritStackingKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does the keyboard have a Tibetan stacking key?
|
* Returns true iff the keyboard has a Tibetan stacking key.
|
||||||
* @return true if a stacking key is required to
|
* @return true if a stacking key is required to type Tibetan stacks,
|
||||||
* type Tibetan stacks, false if not
|
* false if not
|
||||||
* @see TibetanKeyboard
|
* @see TibetanKeyboard */
|
||||||
*/
|
|
||||||
public static boolean hasTibetanStackingKey() {
|
public static boolean hasTibetanStackingKey() {
|
||||||
return hasTibetanStackingKey;
|
return hasTibetanStackingKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is stacking medial?
|
* Returns true iff stacking is medial.
|
||||||
* @return true if the stacking key is medial,
|
* @return true if the stacking key is medial, false if not, or if
|
||||||
* false if not, or if there is no stacking key
|
* there is no stacking key
|
||||||
* @see TibetanKeyboard
|
* @see TibetanKeyboard */
|
||||||
*/
|
|
||||||
public static boolean isStackingMedial() {
|
public static boolean isStackingMedial() {
|
||||||
return isStackingMedial;
|
return isStackingMedial;
|
||||||
}
|
}
|
||||||
|
@ -1062,34 +1056,30 @@ public static char getStackingKey() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is achen required before vowels?
|
* Returns true iff achen is required before vowels.
|
||||||
* @return true if you have to type achen first
|
* @return true if you have to type achen first before you can get a
|
||||||
* before you can get a vowel with achen, false
|
* vowel with achen, false if you can just type the vowel by itself (as
|
||||||
* if you can just type the vowel by itself
|
* in Wylie)
|
||||||
* (as in Wylie)
|
* @see TibetanKeyboard */
|
||||||
* @see TibetanKeyboard
|
|
||||||
*/
|
|
||||||
public static boolean isAChenRequiredBeforeVowel() {
|
public static boolean isAChenRequiredBeforeVowel() {
|
||||||
return isAChenRequiredBeforeVowel;
|
return isAChenRequiredBeforeVowel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is achung treated as a consonant?
|
* Returns true iff achung is treated as a consonant.
|
||||||
* @return true if a-chung is considered a consonant
|
* @return true if a-chung is considered a consonant for the purposes
|
||||||
* for the purposes of stacking, false if not
|
* of stacking, false if not (as in Wylie)
|
||||||
* (as in Wylie)
|
* @see TibetanKeyboard */
|
||||||
* @see TibetanKeyboard
|
|
||||||
*/
|
|
||||||
public static boolean isAChungConsonant() {
|
public static boolean isAChungConsonant() {
|
||||||
return isAChungConsonant;
|
return isAChungConsonant;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is there a key for the invisible 'a' vowel in this keyboard?
|
* Returns true iff there is a key for the invisible 'a' vowel in this
|
||||||
* @return true if the installed keyboard has a
|
* keyboard.
|
||||||
* dummy a vowel, false if not
|
* @return true if the installed keyboard has a dummy a vowel, false if
|
||||||
* @see TibetanKeyboard
|
* not
|
||||||
*/
|
* @see TibetanKeyboard */
|
||||||
public static boolean hasAVowel() {
|
public static boolean hasAVowel() {
|
||||||
return hasAVowel;
|
return hasAVowel;
|
||||||
}
|
}
|
||||||
|
@ -1105,13 +1095,10 @@ public static String getAVowel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is this glyph a top (superscript) vowel?
|
* Returns true iff this glyph is a top (superscript) vowel.
|
||||||
* @param a DuffCode representing a TibetanMachineWeb
|
* @param a DuffCode representing a TibetanMachineWeb glyph
|
||||||
* glyph
|
* @return true if the glyph is a top-hanging (superscript) vowel (i,
|
||||||
* @return true if the glyph is a top-hanging
|
* u, e, o, ai, or ao) and false if not */
|
||||||
* (superscript) vowel (i, u, e, o, ai, or ao)
|
|
||||||
* and false if not
|
|
||||||
*/
|
|
||||||
public static boolean isTopVowel(DuffCode dc) {
|
public static boolean isTopVowel(DuffCode dc) {
|
||||||
String wylie = getWylieForGlyph(dc);
|
String wylie = getWylieForGlyph(dc);
|
||||||
if (top_vowels.contains(wylie))
|
if (top_vowels.contains(wylie))
|
||||||
|
|
Loading…
Reference in a new issue