{"record":{"id":"21637df895816461","repo":"quarkusio/quarkus","slug":"pfa-font-files-are-not-supported-use-truetype-fo","errorCode":null,"errorMessage":".pfa font files are not supported. Use TrueType fonts, i.e. .ttf files.","messagePattern":"\\.pfa font files are not supported\\. Use TrueType fonts, i\\.e\\. \\.ttf files\\.","errorType":"exception","errorClass":"FontFormatException","httpStatus":null,"severity":"error","filePath":"extensions/awt/runtime/src/main/java/io/quarkus/awt/runtime/JDKSubstitutions.java","lineNumber":32,"sourceCode":"import java.util.Properties;\n\nimport com.oracle.svm.core.annotate.Alias;\nimport com.oracle.svm.core.annotate.Substitute;\nimport com.oracle.svm.core.annotate.TargetClass;\n\nimport io.quarkus.runtime.util.IsLinux;\nimport io.quarkus.runtime.util.IsWindows;\nimport io.quarkus.runtime.util.JavaVersionLessThan25;\n\n/**\n * Getting .pfb/.pfa files to work would require additional runtime re-init adjustments.\n * We are not doing that unless there is an explicit demand.\n */\n@TargetClass(className = \"sun.font.Type1Font\")\nfinal class Target_sun_font_Type1Font {\n    @Substitute\n    private void verifyPFA(ByteBuffer bb) throws FontFormatException {\n        throw new FontFormatException(\n                \".pfa font files are not supported. Use TrueType fonts, i.e. .ttf files.\");\n    }\n\n    @Substitute\n    private void verifyPFB(ByteBuffer bb) throws FontFormatException {\n        throw new FontFormatException(\n                \".pfb font files are not supported. Use TrueType fonts, i.e. .ttf files.\");\n    }\n}\n\n/**\n * AWT source code does not take into account a situation where \"java.home\" does not\n * exist. It looks for default fonts in conf/fonts and lib dirs. It is O.K. if there are\n * none as then system fonts are used instead. If the directory structure as such does not exist,\n * the code path fails though.\n *\n * We create a dummy \"java.home\" in \"java.io.tmpdir\" and we set it at a reasonable place via\n * substitution.","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/awt/runtime/src/main/java/io/quarkus/awt/runtime/JDKSubstitutions.java#L14-L50","documentation":"Quarkus AWT substitutes sun.font.Type1Font on native image and deliberately does not implement Type1 font verification/loading. Loading a .pfa font in native mode always throws FontFormatException with this message, steering users to TrueType (.ttf) fonts.","triggerScenarios":"Native-mode application calls Font.createFont(Font.TRUETYPE_FONT|TYPE1_FONT, stream) or GraphicsEnvironment.registerFont with a .pfa (PostScript ASCII) font file.","commonSituations":"JVM mode worked with .pfa fonts but native build fails; font assets bundled in resources are PostScript Type 1; UI/PDF-generation library config points at .pfa files.","solutions":["Convert the .pfa font to TrueType (.ttf) using fontforge or a similar tool (pfa2ttf) and ship the .ttf instead","Load only .ttf (or .otf) fonts in native mode","If Type 1 support is essential, avoid native image or implement a custom substitution"],"exampleFix":"// before\nFont font = Font.createFont(Font.TRUETYPE_FONT, getClass().getResourceAsStream(\"/fonts/My.pfa\"));\n// after (convert My.pfa -> My.ttf first)\nFont font = Font.createFont(Font.TRUETYPE_FONT, getClass().getResourceAsStream(\"/fonts/My.ttf\"));","handlingStrategy":"validation","validationCode":"// reject unsupported font formats before loading in native mode\nstatic void checkFont(String name) {\n    String lower = name.toLowerCase(Locale.ROOT);\n    if (lower.endsWith(\".pfa\") || lower.endsWith(\".pfb\")) {\n        throw new IllegalArgumentException(\"Type 1 fonts unsupported in native mode, use .ttf: \" + name);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    Font f = Font.createFont(Font.TRUETYPE_FONT, in);\n} catch (FontFormatException e) {\n    if (e.getMessage().contains(\".pfa\")) {\n        log.error(\"Convert the font to TrueType (.ttf) for native image support\");\n    }\n}","preventionTips":["Ship only .ttf/.otf fonts in native-mode applications","Convert PostScript fonts with fontforge at build time","Test font loading under native profile, not just JVM","Document font-format constraints in the project README"],"tags":["awt","fonts","graalvm","native-image","quarkus"],"backgroundTag":"unsupported-font-format","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}