A preliminary TMW->ACIP converter is here. There are known bugs, mostly with rare punctuation.

This commit is contained in:
dchandler 2003-09-02 06:39:33 +00:00
parent cc9ab06864
commit 316f59107b
9 changed files with 278 additions and 88 deletions

View file

@ -1706,6 +1706,13 @@ public static String wylieForGlyph(String hashKey) {
return sb.toString();
}
// DLC DOC
private static String acipForGlyph(String hashKey) {
String ACIP // DLC FIXME: test this.
= org.thdl.tib.scanner.Manipulate.wylieToAcip(hashKey);
return ACIP;
}
/** Error that appears in a document when some TMW cannot be
* transcribed in THDL Extended Wylie. This error message is
* documented in www/htdocs/TMW_RTF_TO_THDL_WYLIE.html, so change
@ -1716,6 +1723,16 @@ private static String getTMWToWylieErrorString(DuffCode dc) {
+ " to THDL Extended Wylie. Please see the documentation for the TMW font and transcribe this yourself.]]>>";
}
/** Error that appears in a document when some TMW cannot be
* transcribed in ACIP. This error message is
* documented in www/htdocs/TMW_RTF_TO_THDL_WYLIE.html (DLC NOT YET), so change
* them both when you change this. */
private static String getTMWToACIPErrorString(DuffCode dc) {
return "<<[[JSKAD_TMW_TO_ACIP_ERROR_NO_SUCH_ACIP: Cannot convert DuffCode "
+ dc.toString(true)
+ " to ACIP. Please see the documentation for the TMW font and transcribe this yourself.]]>>";
}
/**
* Gets the Extended Wylie value for this glyph.
* @param font the font of the TibetanMachineWeb
@ -1756,6 +1773,17 @@ public static String getWylieForGlyph(DuffCode dc, boolean noSuchWylie[]) {
return wylieForGlyph(hashKey);
}
// DLC DOC
public static String getACIPForGlyph(DuffCode dc, boolean noSuchACIP[]) {
String hashKey = getHashKeyForGlyph(dc);
String ans = (hashKey == null) ? null : acipForGlyph(hashKey);
if (hashKey == null || ans == null) {
noSuchACIP[0] = true;
return getTMWToACIPErrorString(dc);
}
return ans;
}
/** This addresses bug 624133, "Input freezes after impossible
* character". Returns true iff s is a proper prefix of some
* legal input for this keyboard. In the extended Wylie