I've added a command-line converter,

org.thdl.tib.input.TMW_RTF_TO_THDL_WYLIE.  It converts RTF files
consisting of TMW characters to the corresponding THDL Extended Wylie.

It supports --find-some-non-tmw mode, which allows you to ensure that no
unusual characters will spoil the conversion.  The converter has built-in
intelligence that allows it to handle Tahoma '{', '}', and '\\' characters
properly.

The converter works on mixed Roman/TMW also, but --find-some-non-tmw
and --find-all-non-tmw modes are not as useful.

Invoke org.thdl.tib.input.TMW_RTF_TO_THDL_WYLIE, which resides in
Jskad's jar, with no command-line options to see usage information.
This commit is contained in:
dchandler 2003-05-18 14:14:47 +00:00
parent 17ea8fdf2a
commit e2a9720d9b
7 changed files with 345 additions and 17 deletions

View file

@ -62,9 +62,6 @@ import org.thdl.util.ThdlLazyException;
* @version 1.0
*/
public class Jskad extends JPanel implements DocumentListener {
private static final String rtfErrorMessage = "The Rich Text Format (RTF) file selected contains constructs that\nJskad cannot handle. If you got the RTF file from saving a Word\ndocument as RTF, try saving that same document as RTF in\nWord 2000 instead of Word XP or in Word 97 instead of\nWord 2000. Older versions of Word produce RTF that Jskad\ncan more easily deal with. OpenOffice and StarOffice also\nproduce better-behaved RTF.";
/** the name of the property a developer should set to see
low-level info on how keypresses in "Tibetan" input mode are
being interpreted */
@ -339,6 +336,28 @@ public class Jskad extends JPanel implements DocumentListener {
toolsMenu.add(DevelItem);
}
if (ThdlOptions.getBooleanOption("thdl.add.developer.options.to.menu")) {
toolsMenu.addSeparator();
JMenuItem DevelItem = new JMenuItem("Check for non-TMW characters"); // DLC NOW: do it just in the selection
DevelItem.addActionListener(new ThdlActionListener() {
public void theRealActionPerformed(ActionEvent e) {
((TibetanDocument)dp.getDocument()).findSomeNonTMWCharacters(0, -1); // entire document.
}
});
toolsMenu.add(DevelItem);
}
if (ThdlOptions.getBooleanOption("thdl.add.developer.options.to.menu")) {
toolsMenu.addSeparator();
JMenuItem DevelItem = new JMenuItem("Fix curly braces RTF problem"); // DLC NOW: do it just in the selection
DevelItem.addActionListener(new ThdlActionListener() {
public void theRealActionPerformed(ActionEvent e) {
((TibetanDocument)dp.getDocument()).replaceTahomaCurlyBracesAndBackslashes(0, -1); // entire document
}
});
toolsMenu.add(DevelItem);
}
menuBar.add(toolsMenu);
JMenu infoMenu = new JMenu("Info");
@ -668,7 +687,7 @@ public class Jskad extends JPanel implements DocumentListener {
newRTF.dp.rtfEd.read(in, newRTF.dp.getDocument(), 0);
} catch (Exception e) {
JOptionPane.showMessageDialog(newFrame,
rtfErrorMessage);
TMW_RTF_TO_THDL_WYLIE.rtfErrorMessage);
error = true;
}
in.close();
@ -693,7 +712,7 @@ public class Jskad extends JPanel implements DocumentListener {
dp.rtfEd.read(in, dp.getDocument(), 0);
} catch (Exception e) {
JOptionPane.showMessageDialog(this,
rtfErrorMessage);
TMW_RTF_TO_THDL_WYLIE.rtfErrorMessage);
error = true;
}