Fixed bug 718207. 'byungs now converts from Tibetan to Wylie

correctly.
This commit is contained in:
dchandler 2003-04-10 02:14:15 +00:00
parent bc8b5f724b
commit cbccfc5277

View file

@ -1031,18 +1031,21 @@ public class TibTextUtils implements THDLWylieConstants {
} }
/** /**
* Gets the Extended Wylie for a list of glyphs. * Gets the Extended Wylie for a list of glyphs. Passed a list of
* Passed a list of TibetanMachineWeb glyphs that constitute a partial * TibetanMachineWeb glyphs that constitute a partial or complete
* or complete syllable, this method scans the list, and then returns a * syllable, this method scans the list, and then returns a string of
* string of Wylie corresponding to this sequence. No 'a' vowel is * Wylie corresponding to this sequence. No 'a' vowel is inserted
* inserted because it is assumed that the glyph list already contains * because it is assumed that the glyph list already contains some
* some other vowel. If the glyph list does not already contain a vowel, * other vowel. If the glyph list does not already contain a vowel,
* then this method should not be called. * then this method should not be called.
* *
* @param glyphList a list of TibetanMachineWeb glyphs, i.e. {@link org.thdl.tib.text.DuffCode DuffCodes} * @param glyphList a list of TibetanMachineWeb glyphs, i.e. {@link
* org.thdl.tib.text.DuffCode DuffCodes}
* @param isBeforeVowel true if these glyphs occur before a vowel,
* false if these glyphs occur after a vowel
* @return the Wylie string corresponding to this glyph list * @return the Wylie string corresponding to this glyph list
*/ */
public static String withoutA(java.util.ArrayList glyphList) { public static String withoutA(java.util.ArrayList glyphList, boolean isBeforeVowel) {
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
Iterator iter = glyphList.iterator(); Iterator iter = glyphList.iterator();
DuffCode dc; DuffCode dc;
@ -1060,7 +1063,7 @@ public class TibTextUtils implements THDLWylieConstants {
/* le'ang, not le'ng, to be consistent w.r.t. pa'am /* le'ang, not le'ng, to be consistent w.r.t. pa'am
* vs. pa'm: */ * vs. pa'm: */
if (lastWylie.equals(ACHUNG)) if (lastWylie.equals(ACHUNG) && !isBeforeVowel)
sb.append(WYLIE_aVOWEL); sb.append(WYLIE_aVOWEL);
sb.append(currWylie); sb.append(currWylie);
@ -1103,7 +1106,7 @@ public class TibTextUtils implements THDLWylieConstants {
if (needsVowel) if (needsVowel)
thisPart = withA(glyphList); thisPart = withA(glyphList);
else else
thisPart = withoutA(glyphList); thisPart = withoutA(glyphList, false);
wylieBuffer.append(thisPart); wylieBuffer.append(thisPart);
glyphList.clear(); glyphList.clear();
@ -1133,7 +1136,7 @@ public class TibTextUtils implements THDLWylieConstants {
if (needsVowel) if (needsVowel)
thisPart = withA(glyphList); thisPart = withA(glyphList);
else else
thisPart = withoutA(glyphList); thisPart = withoutA(glyphList, false);
wylieBuffer.append(thisPart); wylieBuffer.append(thisPart);
wylieBuffer.append(wylie); //append the punctuation wylieBuffer.append(wylie); //append the punctuation
@ -1192,7 +1195,7 @@ public class TibTextUtils implements THDLWylieConstants {
} }
if (top_dc == null || !TibetanMachineWeb.getWylieForGlyph(top_dc).equals(ACHUNG)) { if (top_dc == null || !TibetanMachineWeb.getWylieForGlyph(top_dc).equals(ACHUNG)) {
String thisPart = withoutA(glyphList); String thisPart = withoutA(glyphList, true);
wylieBuffer.append(thisPart); //append consonants in glyphList wylieBuffer.append(thisPart); //append consonants in glyphList
} else { } else {
glyphCount = glyphList.size(); glyphCount = glyphList.size();
@ -1224,7 +1227,7 @@ public class TibTextUtils implements THDLWylieConstants {
if (containsBindu) { if (containsBindu) {
isLastVowel = false; isLastVowel = false;
wylieBuffer.append(withoutA(glyphList)); wylieBuffer.append(withoutA(glyphList, false));
wylieBuffer.append(BINDU); //append the bindu wylieBuffer.append(BINDU); //append the bindu
glyphList.clear(); glyphList.clear();
} }
@ -1238,7 +1241,7 @@ public class TibTextUtils implements THDLWylieConstants {
if (needsVowel) if (needsVowel)
thisPart = withA(glyphList); thisPart = withA(glyphList);
else else
thisPart = withoutA(glyphList); thisPart = withoutA(glyphList, false);
wylieBuffer.append(thisPart); wylieBuffer.append(thisPart);
} }