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
FontCollection
ia 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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd font with the given FontInfo configuration to the font collection.getFontInfo
(int index) Lookup a FontInfo object by its internal font indexgetFontInfo
(String typeface) Lookup a FontInfo object by its typefaceint
long
Return the type, which is 2005void
writeOut
(OutputStream out) Write the contents of the record back, so it can be written to diskMethods inherited from class org.apache.poi.hslf.record.RecordContainer
addChildAfter, addChildBefore, appendChildRecord, findFirstOfType, getChildRecords, handleParentAwareRecords, isAnAtom, moveChildBefore, moveChildrenAfter, moveChildrenBefore, removeChild, setChildRecord, writeOut
Methods inherited from class org.apache.poi.hslf.record.Record
buildRecordAtOffset, createRecordForType, findChildRecords, writeLittleEndian, writeLittleEndian
-
Constructor Details
-
FontCollection
protected FontCollection(byte[] source, int start, int len)
-
-
Method Details
-
getRecordType
public long getRecordType()Return the type, which is 2005- Specified by:
getRecordType
in classRecord
-
writeOut
Write the contents of the record back, so it can be written to disk- Specified by:
writeOut
in classRecord
- Throws:
IOException
-
addFont
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
,HSLFFontInfoPredefined
or a custom implementation- Returns:
- the register HSLFFontInfo object
-
getFontInfo
Lookup a FontInfo object by its typeface- Parameters:
typeface
- the full font name- Returns:
- the HSLFFontInfo for the given name or
null
if not found
-
getFontInfo
Lookup a FontInfo object by its internal font index- Parameters:
index
- the internal font index- Returns:
- the HSLFFontInfo for the given index or
null
if not found
-
getNumberOfFonts
public int getNumberOfFonts()- Returns:
- the number of registered fonts
-