Fixed TMW->Wylie/ACIP when multiple font sizes are in use. I was not
incrementing the offset at which I was inserting text properly.
This commit is contained in:
parent
14fb449f95
commit
bff0e6b2fc
1 changed files with 17 additions and 12 deletions
|
@ -1211,19 +1211,11 @@ public class TibetanDocument extends DefaultStyledDocument {
|
||||||
= getCharacterElement(i).getAttributes();
|
= getCharacterElement(i).getAttributes();
|
||||||
String fontName = StyleConstants.getFontFamily(attr);
|
String fontName = StyleConstants.getFontFamily(attr);
|
||||||
int fontNum;
|
int fontNum;
|
||||||
int iFontSize = 72; /* the failure ought to be obvious
|
|
||||||
at this size */
|
|
||||||
try {
|
|
||||||
iFontSize
|
|
||||||
= ((Integer)attr.getAttribute(StyleConstants.FontSize)).intValue();
|
|
||||||
} catch (Exception e) {
|
|
||||||
// leave it as 72
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((0 == (fontNum
|
if ((0 == (fontNum
|
||||||
= TibetanMachineWeb.getTMWFontNumber(fontName)))
|
= TibetanMachineWeb.getTMWFontNumber(fontName)))
|
||||||
|| i==endPos.getOffset()) {
|
|| i==endPos.getOffset()) {
|
||||||
if (i != start) {
|
if (i != start) {
|
||||||
|
if (i < start) throw new Error("Oops!");
|
||||||
SizedDuffCode[] sdc_array
|
SizedDuffCode[] sdc_array
|
||||||
= (SizedDuffCode[])dcs.toArray(new SizedDuffCode[0]);
|
= (SizedDuffCode[])dcs.toArray(new SizedDuffCode[0]);
|
||||||
|
|
||||||
|
@ -1237,17 +1229,30 @@ public class TibetanDocument extends DefaultStyledDocument {
|
||||||
for (int j = 0; j < tb.length(); j++) {
|
for (int j = 0; j < tb.length(); j++) {
|
||||||
TranslitTuple tt = tb.get(j);
|
TranslitTuple tt = tb.get(j);
|
||||||
int thisFontSize;
|
int thisFontSize;
|
||||||
|
String ttt = tt.getTranslit();
|
||||||
insertString(start,
|
insertString(start,
|
||||||
tt.getTranslit(),
|
ttt,
|
||||||
getCopyOfRomanAttributeSet(thisFontSize = tt.getFontSize()));
|
getCopyOfRomanAttributeSet(thisFontSize
|
||||||
|
= tt.getFontSize()));
|
||||||
|
start += ttt.length();
|
||||||
if (thisFontSize == lastFontSize)
|
if (thisFontSize == lastFontSize)
|
||||||
throw new Error("FIXME: make this an assertion");
|
throw new Error("FIXME: make this an assertion");
|
||||||
lastFontSize = thisFontSize;
|
lastFontSize = thisFontSize;
|
||||||
}
|
}
|
||||||
|
i = start - 1; // i++ below will execute.
|
||||||
dcs.clear();
|
dcs.clear();
|
||||||
|
} else {
|
||||||
|
start = i+1;
|
||||||
}
|
}
|
||||||
start = i+1;
|
|
||||||
} else {
|
} else {
|
||||||
|
int iFontSize = 72; /* the failure ought to be obvious
|
||||||
|
at this size */
|
||||||
|
try {
|
||||||
|
iFontSize
|
||||||
|
= ((Integer)attr.getAttribute(StyleConstants.FontSize)).intValue();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// leave it as 72
|
||||||
|
}
|
||||||
char ch = getText(i,1).charAt(0);
|
char ch = getText(i,1).charAt(0);
|
||||||
dcs.add(new SizedDuffCode(new DuffCode(fontNum, ch),
|
dcs.add(new SizedDuffCode(new DuffCode(fontNum, ch),
|
||||||
iFontSize));
|
iFontSize));
|
||||||
|
|
Loading…
Reference in a new issue