THotPDF.GetLoadedFontCount Method
Returns the total number of font resources referenced by the specified page in the loaded PDF document, used to determine the valid index range before enumerating fonts
Declaration
function GetLoadedFontCount(PageIndex: Integer): Integer;
Unit
HPDFDoc
Parameters
| Name | Purpose |
|---|---|
PageIndex | Zero-based index of the target page; returns 0 if out of the valid range |
Return value
Returns the total number of entries in the specified page's font resource dictionary; returns 0 if the page has no font references or the index is invalid
Usage notes
- 此计数基于页面资源字典的 Font 子字典中的条目数,不包含继承自页面树父节点的字体
- 配合
GetLoadedFontInfo使用可安全遍历所有字体名称与编码,避免越界 - The same font may be referenced by multiple resource names in the document; this count is for resource names (aliases) rather than unique fonts