本文整理汇总了Java中org.odftoolkit.simple.style.Font类的典型用法代码示例。如果您正苦于以下问题:Java Font类的具体用法?Java Font怎么用?Java Font使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Font类属于org.odftoolkit.simple.style包,在下文中一共展示了Font类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setSpecificFontStyle
import org.odftoolkit.simple.style.Font; //导入依赖的package包/类
private void setSpecificFontStyle(String selection, Cell tableCell, Map<String, String> attrs) {
Font font = createFont(12, Color.BLACK);
if (selection.equals("head")) {
font.setFontStyle(FontStyle.BOLDITALIC);
} else if (selection.equals("foot")) {
font.setFontStyle(FontStyle.ITALIC);
} else {
if (attrs.containsKey("style")) {
String style = attrs.get("style");
if (style.equals("strong"))
font.setFontStyle(FontStyle.BOLD);
else if (style.equals("emphasis"))
font.setFontStyle(FontStyle.ITALIC);
else if (style.equals("header"))
font.setFontStyle(FontStyle.BOLDITALIC);
}
}
tableCell.setFont(font);
}
示例2: getFont
import org.odftoolkit.simple.style.Font; //导入依赖的package包/类
public static Font getFont(int size, boolean bold, boolean italic) {
FontStyle style = StyleTypeDefinitions.FontStyle.REGULAR;
if (bold)
style = StyleTypeDefinitions.FontStyle.BOLD;
if (italic)
style = StyleTypeDefinitions.FontStyle.ITALIC;
return new Font("Arial", style, size, Color.BLACK);
}
示例3: getFont
import org.odftoolkit.simple.style.Font; //导入依赖的package包/类
private Font getFont(int size, boolean bold, boolean italic) {
FontStyle style = StyleTypeDefinitions.FontStyle.REGULAR;
if (bold)
style = StyleTypeDefinitions.FontStyle.BOLD;
if (italic)
style = StyleTypeDefinitions.FontStyle.ITALIC;
return new Font("Arial", style, size, Color.BLACK);
}
示例4: addQuoteTypes
import org.odftoolkit.simple.style.Font; //导入依赖的package包/类
private void addQuoteTypes(AsciiElement element, ParagraphContainer paragraphContainer) {
Arrays.asList("attribution", "citetitle").forEach(type -> {
String attr = getSpecificProperty(element.getAttr(), type, String.class);
if (!attr.equals("") && !attr.equals("undefined")) {
Paragraph parag = paragraphContainer.addParagraph("");
Font font = createFont(FontStyle.ITALIC, 12, Color.BLACK);
parag.setFont(font);
if (type.startsWith("attr"))
parag.setTextContent("—".concat($(attr)));
else
parag.setTextContent($(attr));
}
});
}
示例5: addDListItems
import org.odftoolkit.simple.style.Font; //导入依赖的package包/类
private void addDListItems(JSObject items, ParagraphContainer paragraphContainer, ListContainer listContainer) {
int itemsLength = this.getSpecificProperty(items, "length", Integer.class);
if (itemsLength > 0) {
for (int i = 0; i < itemsLength; i++) {
JSObject item = this.getSpecificProperty(items, i, JSObject.class);
Object objItem = this.getSpecificProperty(item, 0, Object.class);
if (objItem instanceof JSObject) {
// for only title (text | dt) of the dlist
JSObject jObjItem = this.castSpecificProperty(objItem, JSObject.class);
String itemText = this.getSpecificProperty(jObjItem, "text", String.class);
Font font = this.createFont(FontStyle.BOLD, 12, Color.BLACK);
Paragraph paragraph = paragraphContainer.addParagraph($(itemText));
paragraph.setFont(font);
} else {
// find and construct dd elements
JSObject itemBlocks = this.getSpecificProperty(item, "blocks", JSObject.class);
int bLength = this.getSpecificProperty(itemBlocks, "length", Integer.class);
if (bLength > 0) {
itemBlocks = this.getSpecificProperty(itemBlocks, 0, JSObject.class);
this.addDDListItems(itemBlocks, paragraphContainer, listContainer);
} else {
String text = this.getSpecificProperty(item, "text", String.class);
paragraphContainer.addParagraph(" ".concat($(text)));
}
}
}
}
}
示例6: addSection
import org.odftoolkit.simple.style.Font; //导入依赖的package包/类
private void addSection(AsciiElement element) {
this.removeFirstEmptyParagraphs(odtDocument);
Font font = createFont(12, new Color("#ba3925"));
switch (element.getLevel()) {
case 1:
font.setSize(18);
break;
case 2:
font.setSize(17);
break;
case 3:
font.setSize(16);
break;
case 4:
font.setSize(15);
break;
case 5:
font.setSize(14);
break;
case 6:
font.setSize(13);
break;
}
Paragraph paragraph = odtDocument.addParagraph(element.getTitle());
paragraph.setFont(font);
paragraph.applyHeading(true, element.getLevel());
this.buildODTDocument(element.getChildren(), false);
}
示例7: setElementTitle
import org.odftoolkit.simple.style.Font; //导入依赖的package包/类
private void setElementTitle(AsciiElement element, String prefix, ParagraphContainer paragraphContainer) {
String title = element.getTitle();
if (!title.equals("") && !title.equals("undefined")) {
paragraphContainer.addParagraph("");
Font font = createFont(FontStyle.ITALIC, 12, new Color("#7a2518"));
Paragraph titleParam = paragraphContainer.addParagraph(String.join(" : ", prefix, title));
titleParam.setHorizontalAlignment(HorizontalAlignmentType.CENTER);
titleParam.setFont(font);
}
}
示例8: setTitle
import org.odftoolkit.simple.style.Font; //导入依赖的package包/类
private boolean setTitle(AsciiElement element, FontStyle fontStyle, HorizontalAlignmentType horizontalAlignmentType,
int size, Color color, ParagraphContainer paragraphContainer) {
boolean titled = false;
String title = element.getTitle();
if (!title.equals("") && !title.equals("undefined")) {
Font font = createFont(fontStyle, size, color);
Paragraph paragraph = paragraphContainer.addParagraph(title);
paragraph.setHorizontalAlignment(horizontalAlignmentType);
paragraph.setFont(font);
titled = true;
}
return titled;
}
示例9: newLine
import org.odftoolkit.simple.style.Font; //导入依赖的package包/类
@Override
public void newLine() throws IOException {
if (this.first) {
this.table.appendColumns(this.headers.size());
final Row row = this.table.getRowByIndex(0);
int i = 0;
for (String h : this.headers) {
final Cell c = row.getCellByIndex(i++);
c.setCellBackgroundColor(Color.ORANGE);
Font f = c.getFont();
f.setFontStyle(FontStyle.ITALIC);
f.setSize(10);
c.setFont(f);
c.setStringValue(h);
}
for (Node n : new DomNodeList(
this.table.getOdfElement().getChildNodes())) {
if (n instanceof TableTableRowElement) {
this.rowElement = (TableTableRowElement) n;
}
}
this.first = false;
}
final TableTableRowElement aRow =
(TableTableRowElement) OdfXMLFactory.newOdfElement(this.dom,
OdfName.newName(OdfDocumentNamespace.TABLE, "table-row"));
this.tableElement.appendChild(aRow);
this.rowElement = aRow;
}
示例10: getBoldFont
import org.odftoolkit.simple.style.Font; //导入依赖的package包/类
public static Font getBoldFont(int size) {
return getFont(size, true, false);
}
示例11: getBoldFont
import org.odftoolkit.simple.style.Font; //导入依赖的package包/类
private Font getBoldFont(int size) {
return getFont(size, true, false);
}
示例12: getRegFont
import org.odftoolkit.simple.style.Font; //导入依赖的package包/类
private Font getRegFont(int size) {
return getFont(size, false, false);
}
示例13: createFont
import org.odftoolkit.simple.style.Font; //导入依赖的package包/类
private Font createFont(int fontSize, Color color) {
return createFont(FontStyle.REGULAR, fontSize, color);
}
示例14: generateHeader
import org.odftoolkit.simple.style.Font; //导入依赖的package包/类
private void generateHeader() {
// Erzeuge die Überschrift der ersten Spalte
cell = table.getCellByPosition(0,0);
cell.setStringValue("Anrede");
cell.setFont(new Font("Arial", FontStyle.BOLD, 10));
// Erzeuge die Überschrift der zweiten Spalte
cell = table.getCellByPosition(1,0);
cell.setStringValue("Vorname");
cell.setFont(new Font("Arial", FontStyle.BOLD, 10));
cell = table.getCellByPosition(2,0);
cell.setStringValue("Nachname");
cell.setFont(new Font("Arial", FontStyle.BOLD, 10));
cell = table.getCellByPosition(3,0);
cell.setStringValue("Telefon");
cell.setFont(new Font("Arial", FontStyle.BOLD, 10));
cell = table.getCellByPosition(4,0);
cell.setStringValue("Personen");
cell.setFont(new Font("Arial", FontStyle.BOLD, 10));
cell = table.getCellByPosition(5,0);
cell.setStringValue("Uhrzeit");
cell.setFont(new Font("Arial", FontStyle.BOLD, 10));
cell = table.getCellByPosition(6,0);
cell.setStringValue("Wünsche");
cell.setFont(new Font("Arial", FontStyle.BOLD, 10));
/*
cell = table.getCellByPosition(7,0);
cell.setStringValue("Mail");
cell.setFont(new Font("Arial", FontStyle.BOLD, 10));
cell = table.getCellByPosition(8,0);
cell.setStringValue("IP-Adresse");
cell.setFont(new Font("Arial", FontStyle.BOLD, 10));
cell = table.getCellByPosition(9,0);
cell.setStringValue("Erstellt am");
cell.setFont(new Font("Arial", FontStyle.BOLD, 10));
*/
}