Preliminary ACIP->TMW support is in place. {DU} gives you something
less beautiful than what Jskad would give, so more work is needed.
This commit is contained in:
parent
1f4d53be2e
commit
045c4069c9
12 changed files with 355 additions and 64 deletions
|
@ -141,6 +141,32 @@ public class TibetanDocument extends DefaultStyledDocument {
|
|||
appendDuff(tibetanFontSize, offset, s, attr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts Latin text into the document. The font size is applied
|
||||
* automatically, according to the current Roman font size.
|
||||
* @param offset the position at which you want to insert text
|
||||
* @param s the string you want to insert
|
||||
* @see #setRomanAttributeSet(AttributeSet)
|
||||
*/
|
||||
public void appendRoman(int offset, String s) throws BadLocationException {
|
||||
ThdlDebug.verify(getRomanAttributeSet() != null);
|
||||
insertString(offset, s, getRomanAttributeSet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts Latin text at the end of the document. The font size is
|
||||
* applied automatically, according to the current Roman font size.
|
||||
* @param s the string you want to insert
|
||||
* @see #setRomanAttributeSet(AttributeSet)
|
||||
*/
|
||||
public void appendRoman(String s) {
|
||||
try {
|
||||
appendRoman(getLength(), s);
|
||||
} catch (BadLocationException e) {
|
||||
throw new Error("can't happen");
|
||||
}
|
||||
}
|
||||
|
||||
private void appendDuff(int fontSize, int offset, String s, MutableAttributeSet attr) {
|
||||
try {
|
||||
StyleConstants.setFontSize(attr, fontSize);
|
||||
|
@ -160,6 +186,19 @@ public class TibetanDocument extends DefaultStyledDocument {
|
|||
return insertDuff(tibetanFontSize, pos, glyphs, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends all DuffCodes in glyphs to the end of this document.
|
||||
*/
|
||||
public void appendDuffCodes(DuffCode[] glyphs) {
|
||||
// PERFORMANCE FIXME: this isn't so speedy, but it reuses
|
||||
// existing code.
|
||||
for (int i = 0; i < glyphs.length; i++) {
|
||||
insertDuff(getLength(),
|
||||
new DuffData[] { new DuffData(new String(new char[] { glyphs[i].getCharacter() }),
|
||||
glyphs[i].getFontNum()) });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Replacing can be more efficient than inserting and then
|
||||
removing. This replaces the glyph at position pos with glyph,
|
||||
|
@ -1039,6 +1078,15 @@ public class TibetanDocument extends DefaultStyledDocument {
|
|||
romanAttributeSet = ras;
|
||||
}
|
||||
|
||||
/** Sets the attribute set applied to Roman text in this
|
||||
document. */
|
||||
public void setRomanAttributeSet(String font, int size) {
|
||||
SimpleAttributeSet ras = new SimpleAttributeSet();
|
||||
StyleConstants.setFontFamily(ras, font);
|
||||
StyleConstants.setFontSize(ras, size);
|
||||
setRomanAttributeSet(ras);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the specified portion of this document to THDL Extended
|
||||
* Wylie.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue