* @return the font definition for a specific script type
*/
public Font getFont(ScriptType type) {
// A font includes font family name, font style, font color, font size
Font font = null;
TextProperties textProperties = getTextPropertiesForRead();
if (textProperties != null)
font = textProperties.getFont(type);
else
font = new Font(null, null, 0, (StyleTypeDefinitions.TextLinePosition) null);
if (font != null && font.getFamilyName() != null && font.getColor() != null && font.getSize() != 0
&& font.getFontStyle() != null && font.getTextLinePosition() != null)
return font;
boolean isDefault = isUseDefaultStyle;
OdfStyleBase parentStyle = null;
if (!isDefault)
parentStyle = getParentStyle((OdfStyle) getCurrentUsedStyle());
while ((!isDefault) && (parentStyle != null)) {
TextProperties parentStyleSetting = TextProperties.getTextProperties(parentStyle);
Font tempFont = parentStyleSetting.getFont(type);
mergeFont(font, tempFont);
if (font.getFamilyName() != null && font.getColor() != null && font.getSize() > 0
&& font.getFontStyle() != null && font.getTextLinePosition() != null) {
return font;
}
// continue to get parent properties
if (parentStyle instanceof OdfDefaultStyle)
isDefault = true;
else
parentStyle = getParentStyle((OdfStyle) parentStyle);
}
if (!isDefault) {
OdfDefaultStyle defaultStyle = getCellDefaultStyle();
// For text document, there is no default table cell style.
// So use default font style in default paragraph style.
if (defaultStyle == null) {
defaultStyle = getParagraphDefaultStyle();
}
if (defaultStyle != null) {
TextProperties defaultStyleSetting = TextProperties.getTextProperties(defaultStyle);
Font tempFont = defaultStyleSetting.getFont(type);
mergeFont(font, tempFont);
}
}
if (font.getColor() == null)