Formatting in TMW documents is not preserved. I've added an identity
tranformation, TMW->TMW, to help me debug this problem.
This commit is contained in:
parent
9025fb42d6
commit
83f499b7a8
6 changed files with 218 additions and 91 deletions
|
@ -457,7 +457,10 @@ class ConvertDialog extends JDialog
|
|||
} else if (FIND_ALL_NON_TM == ct) {
|
||||
newFileNamePrefix = "AllNonTM__";
|
||||
newFileNameExtension = ".TXT";
|
||||
} else { // conversion {to Wylie or TM} mode
|
||||
} else if (TMW_TO_SAME_TWM == ct) {
|
||||
newFileNamePrefix = "TMW_to_same_TMW__";
|
||||
newFileNameExtension = ".RTF";
|
||||
} else { // conversion mode
|
||||
if (TMW_TO_WYLIE == ct) {
|
||||
newFileNamePrefix = suggested_WYLIE_prefix;
|
||||
} else if (TMW_TO_WYLIE_TEXT == ct) {
|
||||
|
|
|
@ -93,6 +93,12 @@ public class ConverterGUI implements FontConversion, FontConverterConstants {
|
|||
"Attention required",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
return false;
|
||||
} else if (50 == returnCode) {
|
||||
JOptionPane.showMessageDialog(cd,
|
||||
"Error doing RTF->RTF identity copy.",
|
||||
"Attention required",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
return false;
|
||||
} else if (43 == returnCode) {
|
||||
JOptionPane.showMessageDialog(cd,
|
||||
"Though an output file has been created, this conversion did nothing.\nDid you choose the correct original file?\nDid you choose the correct type of conversion?",
|
||||
|
@ -192,13 +198,15 @@ public class ConverterGUI implements FontConversion, FontConverterConstants {
|
|||
if (null == owner) {
|
||||
convDialog
|
||||
= new ConvertDialog(new ConverterGUI(),
|
||||
CHOICES,
|
||||
ThdlOptions.getBooleanOption("thdl.debug")
|
||||
? DEBUG_CHOICES : CHOICES,
|
||||
true);
|
||||
} else {
|
||||
convDialog
|
||||
= new ConvertDialog(owner,
|
||||
new ConverterGUI(),
|
||||
CHOICES,
|
||||
ThdlOptions.getBooleanOption("thdl.debug")
|
||||
? DEBUG_CHOICES : CHOICES,
|
||||
true);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.awt.*;
|
|||
@author Nathaniel Garson, Tibetan and Himalayan Digital Library */
|
||||
interface FontConverterConstants
|
||||
{
|
||||
final String TMW_TO_SAME_TWM = "TMW to the same TMW (for testing only) (RTF->RTF)";
|
||||
final String ACIP_TO_UNI_TEXT = "ACIP to Unicode (Text->Text)";
|
||||
final String ACIP_TO_TMW = "ACIP to TMW (Text->RTF)";
|
||||
final String TMW_TO_ACIP = "TMW to ACIP (RTF->RTF)";
|
||||
|
@ -56,6 +57,23 @@ interface FontConverterConstants
|
|||
FIND_ALL_NON_TM
|
||||
};
|
||||
|
||||
final String[] DEBUG_CHOICES = new String[] {
|
||||
TMW_TO_SAME_TWM,
|
||||
ACIP_TO_UNI_TEXT,
|
||||
ACIP_TO_TMW,
|
||||
TMW_TO_ACIP,
|
||||
TMW_TO_ACIP_TEXT,
|
||||
TM_TO_TMW,
|
||||
TMW_TO_TM,
|
||||
TMW_TO_UNI,
|
||||
TMW_TO_WYLIE,
|
||||
TMW_TO_WYLIE_TEXT,
|
||||
FIND_SOME_NON_TMW,
|
||||
FIND_SOME_NON_TM,
|
||||
FIND_ALL_NON_TMW,
|
||||
FIND_ALL_NON_TM
|
||||
};
|
||||
|
||||
final String suggested_WYLIE_prefix = "THDL_Wylie_";
|
||||
final String suggested_ACIP_prefix = "ACIP_";
|
||||
final String suggested_TO_TMW_prefix = "TMW_";
|
||||
|
|
|
@ -66,6 +66,7 @@ public class TibetanConverter implements FontConverterConstants {
|
|||
* @return the exit code. */
|
||||
public static int realMain(String[] args, PrintStream out) {
|
||||
try {
|
||||
boolean convertTmwToTmwMode = false;
|
||||
boolean convertToUnicodeMode = false;
|
||||
boolean convertToTMMode = false;
|
||||
boolean convertACIPToUniMode = false;
|
||||
|
@ -105,6 +106,8 @@ public class TibetanConverter implements FontConverterConstants {
|
|||
|| args[numArgs - 3].equals("long"))
|
||||
|| !((findAllNonTMWMode
|
||||
= args[numArgs - 2].equals("--find-all-non-tmw"))
|
||||
|| (convertTmwToTmwMode
|
||||
= args[numArgs - 2].equals("--tmw-to-tmw-for-testing"))
|
||||
|| (convertToTMMode
|
||||
= args[numArgs - 2].equals("--to-tibetan-machine"))
|
||||
|| (convertToTMWMode
|
||||
|
@ -140,6 +143,7 @@ public class TibetanConverter implements FontConverterConstants {
|
|||
out.println(" --warning-level None|Some|Most|All");
|
||||
out.println(" --acip-to-tibetan-warning-and-error-messages short|long");
|
||||
out.println(" --find-all-non-tmw | --find-some-non-tmw");
|
||||
out.println(" | --tmw-to-tmw-for-testing");
|
||||
out.println(" | --to-tibetan-machine | --to-tibetan-machine-web");
|
||||
out.println(" | --to-unicode | --to-wylie | --to-acip");
|
||||
out.println(" | --to-wylie-text | --to-acip-text");
|
||||
|
@ -246,6 +250,8 @@ public class TibetanConverter implements FontConverterConstants {
|
|||
conversionTag = TMW_TO_ACIP_TEXT;
|
||||
} else if (convertToUnicodeMode) {
|
||||
conversionTag = TMW_TO_UNI;
|
||||
} else if (convertTmwToTmwMode) {
|
||||
conversionTag = TMW_TO_SAME_TWM;
|
||||
} else if (convertToTMWMode) {
|
||||
conversionTag = TM_TO_TMW;
|
||||
} else if (convertACIPToUniMode) {
|
||||
|
@ -394,6 +400,7 @@ public class TibetanConverter implements FontConverterConstants {
|
|||
|
||||
int exitCode = 0;
|
||||
ThdlDebug.verify(((TMW_TO_TM == ct) ? 1 : 0)
|
||||
+ ((TMW_TO_SAME_TWM == ct) ? 1 : 0)
|
||||
+ ((TMW_TO_UNI == ct) ? 1 : 0)
|
||||
+ ((TM_TO_TMW == ct) ? 1 : 0)
|
||||
+ ((TMW_TO_ACIP == ct) ? 1 : 0)
|
||||
|
@ -402,7 +409,14 @@ public class TibetanConverter implements FontConverterConstants {
|
|||
+ ((TMW_TO_WYLIE_TEXT == ct) ? 1 : 0)
|
||||
== 1);
|
||||
long numAttemptedReplacements[] = new long[] { 0 };
|
||||
if (TMW_TO_WYLIE == ct || TMW_TO_WYLIE_TEXT == ct) {
|
||||
if (TMW_TO_SAME_TWM == ct) {
|
||||
// Identity conversion for testing
|
||||
if (tdoc.identityTmwToTmwConversion(0,
|
||||
tdoc.getLength(),
|
||||
numAttemptedReplacements)) {
|
||||
exitCode = 50;
|
||||
}
|
||||
} else if (TMW_TO_WYLIE == ct || TMW_TO_WYLIE_TEXT == ct) {
|
||||
// Convert to THDL Wylie:
|
||||
if (!tdoc.toWylie(0,
|
||||
tdoc.getLength(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue