EWTS->TMW fixes. Wowel handling still isn't perfect but I'm lazy.

Jskad now uses the new EWTS->TMW routine, not the old, and thus the
"(Buggy)" label is [unfairly, perhaps] dropped.
This commit is contained in:
dchandler 2005-07-07 01:30:03 +00:00
parent 0f99c402df
commit 982350371d
7 changed files with 129 additions and 86 deletions

View file

@ -1628,33 +1628,17 @@ public void paste(int offset)
*/
public void toTibetanMachineWeb(String wylie, int offset) {
try {
StringTokenizer sTok = new StringTokenizer(wylie, "\n\t", true); // FIXME does this work on all platforms?
while (sTok.hasMoreTokens()) {
String next = sTok.nextToken();
if (next.equals("\n") || next.equals("\t")) { // FIXME does this work on all platforms?
try {
getTibDoc().insertString(offset, next, null);
offset++;
} catch (BadLocationException ble) {
ble.printStackTrace();
ThdlDebug.noteIffyCode();
}
} else {
DuffData[] dd = TibTextUtils.getTibetanMachineWebForEWTS(next);
offset = getTibDoc().insertDuff(offset, dd);
}
}
TibTextUtils.insertTibetanMachineWebForTranslit(
true, wylie, getTibDoc(), offset,
false // warnings?
);
} catch (InvalidTransliterationException ite) {
JOptionPane.showMessageDialog(
this,
"The transliteration you are trying to convert is invalid:\n"
+ ite.getMessage());
return;
}
catch (InvalidWylieException iwe) {
JOptionPane.showMessageDialog(this,
"The Wylie you are trying to convert is invalid, " +
"beginning from:\n " + iwe.getCulpritInContext() + "\n" +
"The culprit is probably the character '"+iwe.getCulprit()+"'.");
}
catch (Exception e)
{
System.err.println("Could not convert: " + wylie);
}
}
/**
@ -1701,30 +1685,16 @@ public void paste(int offset)
if ((0 != TibetanMachineWeb.getTMWFontNumber(fontName)) || i==endPos.getOffset()) {
if (i != start) {
try {
DuffData[] duffdata = null;
if (fromACIP) {
getTibDoc().remove(start, i-start);
i += -1 /* because i++ will occur */
+ TibTextUtils.insertTibetanMachineWebForACIP(sb.toString(),
getTibDoc(),
start,
withWarnings);
} else
duffdata = TibTextUtils.getTibetanMachineWebForEWTS(sb.toString());
if (!fromACIP) {
getTibDoc().remove(start, i-start);
getTibDoc().insertDuff(start, duffdata);
}
} catch (InvalidWylieException iwe) {
JOptionPane.showMessageDialog(this,
"The Wylie you are trying to convert is invalid, " +
"beginning from:\n " + iwe.getCulpritInContext() +
"\nThe culprit is probably the character '" +
iwe.getCulprit() + "'.");
return;
} catch (InvalidACIPException iae) {
JOptionPane.showMessageDialog(this,
"The ACIP you are trying to convert is invalid:\n" + iae.getMessage());
getTibDoc().remove(start, i-start);
i += -1 /* because i++ will occur */
+ TibTextUtils.insertTibetanMachineWebForTranslit(
!fromACIP, sb.toString(), getTibDoc(),
start, withWarnings);
} catch (InvalidTransliterationException ite) {
JOptionPane.showMessageDialog(
this,
"The transliteration you are trying to convert is invalid:\n"
+ ite.getMessage());
return;
}
}