FontMap.javaFontMap maintains an internal Map<String, BaseFont> (HashMap) that maps PostScript font names to iText BaseFont objects. The single public method loadFonts(File fontDir) recursively scans the given directory for .afm files and loads each one.
FileUtils.listFiles(fontDir, ["afm"], true) to recursively collect all AFM files.BaseFont.createFont(path, BaseFont.CP1252, BaseFont.EMBEDDED) to create an iText font with CP1252 encoding and embedding enabled.font.getPostscriptFontName() and stores it in the map.continue).BaseFont.EMBEDDED — fonts are embedded in the output PDF, ensuring consistent rendering on any system.HashMap.put behavior).fontMap field is package-private (no accessor shown in this source). Other classes in the renderer package may access it directly.com.itextpdf.text.pdf.BaseFont for font creation and embedding.FileUtils.listFiles() for recursive directory scanning.CollectionUtils.isNotEmpty() for null-safe empty check.868d6abb7 2026-01-01 2025 -> 2026 63081666f 2025-01-01 Source file headers: 2024-> 2025. b6092df09 2024-01-09 Copyright 2023 -> 2024 ab45d51fa 2023-01-01 Copyright 2001-2022 -> 2001-2023. 73b0be50b 2022-12-06 org.apache.commons.collections -> org.apache.commons.collections4 c06db1dab 2022-04-21 Nearly all jars updated (code changes required). 5f7ef41b8 2022-02-18 Copyright 2021 -> 2022 ceb63e8a1 2021-03-08 Source code header: (C) 2001-2021. 7c79f1922 2020-01-03 Copyright of source header -> 2020. 73a9755df 2019-10-11 More code cleanup: - Collapsed catch blocks ... 32f634b88 2019-10-09 Optimize imports 000ca723d 2019-10-07 Remove pointless boolean expressions (business) dd5ca38ac 2019-06-07 CopyRight of all java file-header updated or created. a5bbdca6a 2017-12-04 Change logger to slf4j 9ebb88522 2016-07-18 Initial commit