By default (controllable via options.txt), Jskad now fixes the Tahoma curly
brace problem upon opening any RTF document. The TMW_RTF_TO_THDL_WYLIE test baselines changed because I fixed (a while ago) some inconsistencies between the EWTS standard and Jskad. Conversion of TibetanMachineWeb8.40, @#, to Wylie now works correctly. Unfortunately, though, typing @# doesn't produce 8.40, it still produces 8.38 and 8.39, two glyphs.
This commit is contained in:
parent
a144b125ca
commit
6f0390c5d6
5 changed files with 32 additions and 6 deletions
|
@ -131,8 +131,12 @@ public class TibetanDocument extends DefaultStyledDocument {
|
|||
* @see #setTibetanFontSize(int size)
|
||||
*/
|
||||
public void appendDuff(int offset, String s, MutableAttributeSet attr) {
|
||||
appendDuff(tibetanFontSize, offset, s, attr);
|
||||
}
|
||||
|
||||
private void appendDuff(int fontSize, int offset, String s, MutableAttributeSet attr) {
|
||||
try {
|
||||
StyleConstants.setFontSize(attr, tibetanFontSize);
|
||||
StyleConstants.setFontSize(attr, fontSize);
|
||||
insertString(offset, s, attr);
|
||||
}
|
||||
catch (BadLocationException ble) {
|
||||
|
@ -146,13 +150,17 @@ public class TibetanDocument extends DefaultStyledDocument {
|
|||
* @param pos the position at which you want to insert text
|
||||
*/
|
||||
public int insertDuff(int pos, DuffData[] glyphs) {
|
||||
return insertDuff(tibetanFontSize, pos, glyphs);
|
||||
}
|
||||
|
||||
private int insertDuff(int fontSize, int pos, DuffData[] glyphs) {
|
||||
if (glyphs == null)
|
||||
return pos;
|
||||
|
||||
MutableAttributeSet mas;
|
||||
for (int i=0; i<glyphs.length; i++) {
|
||||
mas = TibetanMachineWeb.getAttributeSet(glyphs[i].font);
|
||||
appendDuff(pos, glyphs[i].text, mas);
|
||||
appendDuff(fontSize, pos, glyphs[i].text, mas);
|
||||
pos += glyphs[i].text.length();
|
||||
}
|
||||
return pos;
|
||||
|
@ -368,7 +376,13 @@ public class TibetanDocument extends DefaultStyledDocument {
|
|||
break;
|
||||
}
|
||||
if (null != toReplaceWith) {
|
||||
insertDuff(i, toReplaceWith);
|
||||
int fontSize = tibetanFontSize;
|
||||
try {
|
||||
fontSize = ((Integer)getCharacterElement(i).getAttributes().getAttribute(StyleConstants.FontSize)).intValue();
|
||||
} catch (Exception e) {
|
||||
// leave it as tibetanFontSize
|
||||
}
|
||||
insertDuff(fontSize, i, toReplaceWith);
|
||||
remove(i+1, 1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue