Package org.apache.poi.hslf.record
Class FontCollection
- java.lang.Object
-
- org.apache.poi.hslf.record.Record
-
- org.apache.poi.hslf.record.RecordContainer
-
- org.apache.poi.hslf.record.FontCollection
-
- All Implemented Interfaces:
GenericRecord
public final class FontCollection extends RecordContainer
FontCollectionia a container that holds information about all the fonts in the presentation.
-
-
Field Summary
-
Fields inherited from class org.apache.poi.hslf.record.RecordContainer
_children
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HSLFFontInfoaddFont(InputStream fontData)HSLFFontInfoaddFont(FontInfo fontInfo)Add font with the given FontInfo configuration to the font collection.HSLFFontInfogetFontInfo(int index)Lookup a FontInfo object by its internal font indexHSLFFontInfogetFontInfo(String typeface)Lookup a FontInfo object by its typefaceHSLFFontInfogetFontInfo(String typeface, FontCharset charset)Lookup a FontInfo object by its typefaceList<HSLFFontInfo>getFonts()Map<String,Supplier<?>>getGenericProperties()intgetNumberOfFonts()longgetRecordType()Return the type, which is 2005voidwriteOut(OutputStream out)Write the contents of the record back, so it can be written to disk-
Methods inherited from class org.apache.poi.hslf.record.RecordContainer
addChildAfter, addChildBefore, appendChildRecord, findFirstOfType, getChildRecords, handleParentAwareRecords, isAnAtom, removeChild, setChildRecord, writeOut
-
Methods inherited from class org.apache.poi.hslf.record.Record
buildRecordAtOffset, createRecordForType, findChildRecords, getGenericChildren, getGenericRecordType, writeLittleEndian, writeLittleEndian
-
-
-
-
Method Detail
-
getRecordType
public long getRecordType()
Return the type, which is 2005- Specified by:
getRecordTypein classRecord
-
writeOut
public void writeOut(OutputStream out) throws IOException
Write the contents of the record back, so it can be written to disk- Specified by:
writeOutin classRecord- Throws:
IOException
-
addFont
public HSLFFontInfo addFont(FontInfo fontInfo)
Add font with the given FontInfo configuration to the font collection. The returned FontInfo contains the HSLF specific details and the collection uniquely contains fonts based on their typeface, i.e. calling the method with FontInfo objects having the same name results in the same HSLFFontInfo reference.- Parameters:
fontInfo- the FontInfo configuration, can be a instance ofHSLFFontInfo,HSLFFontInfoPredefinedor a custom implementation- Returns:
- the register HSLFFontInfo object
-
addFont
public HSLFFontInfo addFont(InputStream fontData) throws IOException
- Throws:
IOException
-
getFontInfo
public HSLFFontInfo getFontInfo(String typeface)
Lookup a FontInfo object by its typeface- Parameters:
typeface- the full font name- Returns:
- the HSLFFontInfo for the given name or
nullif not found
-
getFontInfo
public HSLFFontInfo getFontInfo(String typeface, FontCharset charset)
Lookup a FontInfo object by its typeface- Parameters:
typeface- the full font namecharset- the charset- Returns:
- the HSLFFontInfo for the given name or
nullif not found
-
getFontInfo
public HSLFFontInfo getFontInfo(int index)
Lookup a FontInfo object by its internal font index- Parameters:
index- the internal font index- Returns:
- the HSLFFontInfo for the given index or
nullif not found
-
getNumberOfFonts
public int getNumberOfFonts()
- Returns:
- the number of registered fonts
-
getFonts
public List<HSLFFontInfo> getFonts()
-
getGenericProperties
public Map<String,Supplier<?>> getGenericProperties()
- Specified by:
getGenericPropertiesin interfaceGenericRecord- Overrides:
getGenericPropertiesin classRecordContainer
-
-