org.thdl.tib.text
Class TibetanDocument

java.lang.Object
  |
  +--javax.swing.text.AbstractDocument
        |
        +--javax.swing.text.DefaultStyledDocument
              |
              +--org.thdl.tib.text.TibetanDocument
All Implemented Interfaces:
Document, Serializable, StyledDocument

public class TibetanDocument
extends DefaultStyledDocument

A TibetanDocument is a styled document that knows about Tibetan and will respect line breaks and the like. It allows you to insert Tibetan also.

Author:
Edward Garrett, Tibetan and Himalayan Digital Library
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.text.DefaultStyledDocument
buffer, BUFFER_SIZE_DEFAULT
 
Fields inherited from class javax.swing.text.AbstractDocument
BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementName
 
Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
 
Constructor Summary
TibetanDocument()
          Creates a new TibetanDocument with default styles.
TibetanDocument(StyleContext styles)
          Creates a TibetanDocument.
 
Method Summary
 void appendDuff(int offset, String s, MutableAttributeSet attr)
          Inserts Tibetan text into the document.
 int getTibetanFontSize()
          Gets the point size for Tibetan text.
 String getWylie()
          Converts the entire document into Extended Wylie.
 String getWylie(int begin, int end)
          Converts a portion of the document into Extended Wylie.
 int insertDuff(int pos, org.thdl.tib.text.DuffData[] glyphs)
          Inserts a stretch of TibetanMachineWeb data into the document.
 void setTibetanFontSize(int size)
          Sets the point size used by default for Tibetan text.
 void writeRTFOutputStream(OutputStream out)
          Writes the document to an OutputStream as Rich Text Format (.rtf).
 
Methods inherited from class javax.swing.text.DefaultStyledDocument
addDocumentListener, addStyle, create, createDefaultRoot, getBackground, getCharacterElement, getDefaultRootElement, getFont, getForeground, getLogicalStyle, getParagraphElement, getStyle, getStyleNames, insert, insertUpdate, removeDocumentListener, removeStyle, removeUpdate, setCharacterAttributes, setLogicalStyle, setParagraphAttributes, styleChanged
 
Methods inherited from class javax.swing.text.AbstractDocument
addUndoableEditListener, createBranchElement, createLeafElement, createPosition, dump, fireChangedUpdate, fireInsertUpdate, fireRemoveUpdate, fireUndoableEditUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, insertString, postRemoveUpdate, putProperty, readLock, readUnlock, remove, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties, writeLock, writeUnlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.text.Document
addUndoableEditListener, createPosition, getEndPosition, getLength, getProperty, getRootElements, getStartPosition, getText, getText, insertString, putProperty, remove, removeUndoableEditListener, render
 

Constructor Detail

TibetanDocument

public TibetanDocument()
Creates a new TibetanDocument with default styles.


TibetanDocument

public TibetanDocument(StyleContext styles)
Creates a TibetanDocument.

Parameters:
styles - a StyleContext, which is simply passed on to DefaultStyledDocument's constructor
Method Detail

setTibetanFontSize

public void setTibetanFontSize(int size)
Sets the point size used by default for Tibetan text.

Parameters:
size - the point size for Tibetan text

getTibetanFontSize

public int getTibetanFontSize()
Gets the point size for Tibetan text.

Returns:
the point size used for Tibetan text

writeRTFOutputStream

public void writeRTFOutputStream(OutputStream out)
                          throws IOException
Writes the document to an OutputStream as Rich Text Format (.rtf).

Parameters:
out - the OutputStream to write to
IOException

appendDuff

public void appendDuff(int offset,
                       String s,
                       MutableAttributeSet attr)
Inserts Tibetan text into the document. The font size is applied automatically, according to the current Tibetan font size.

Parameters:
offset - the position at which you want to insert text
s - the string you want to insert
attr - the attributes to apply, normally a particular TibetanMachineWeb font
See Also:
setTibetanFontSize(int size)

insertDuff

public int insertDuff(int pos,
                      org.thdl.tib.text.DuffData[] glyphs)
Inserts a stretch of TibetanMachineWeb data into the document.

Parameters:
glyphs - the array of Tibetan data you want to insert
pos - the position at which you want to insert text

getWylie

public String getWylie()
Converts the entire document into Extended Wylie. If the document consists of both Tibetan and non-Tibetan fonts, however, the conversion stops at the first non-Tibetan font.

Returns:
the string of Wylie corresponding to this document

getWylie

public String getWylie(int begin,
                       int end)
Converts a portion of the document into Extended Wylie. If the document consists of both Tibetan and non-Tibetan fonts, however, the conversion stops at the first non-Tibetan font.

Parameters:
begin - the beginning of the region to convert
end - the end of the region to convert
Returns:
the string of Wylie corresponding to this document


These API docs were created 02/02/2003 08:19 PM.
Copyright © 2001-2002 Tibetan and Himalayan Digital Library. All Rights Reserved.
Hosted by SourceForge_Logo