{"record":{"id":"80d79f5df1986033","repo":"quarkusio/quarkus","slug":"pfb-font-files-are-not-supported-use-truetype-fo","errorCode":null,"errorMessage":".pfb font files are not supported. Use TrueType fonts, i.e. .ttf files.","messagePattern":"\\.pfb 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":38,"sourceCode":"import 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.\n */\n@TargetClass(className = \"sun.awt.FontConfiguration\", onlyWith = IsLinux.class)\nfinal class Target_sun_awt_FontConfiguration_Linux {\n    @Alias\n    protected static String osVersion;\n    @Alias","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/awt/runtime/src/main/java/io/quarkus/awt/runtime/JDKSubstitutions.java#L20-L56","documentation":"Companion to the .pfa substitution: Quarkus AWT also does not support Type 1 .pfb (PostScript Binary) fonts in native mode. verifyPFB is substituted to always throw FontFormatException with this message.","triggerScenarios":"Native-mode application registers or loads a .pfb font file via Font.createFont or GraphicsEnvironment.registerFont.","commonSituations":"Font bundles containing .pfb companions (common with PostScript font families); config pointing at the .pfb instead of the .ttf; worked in JVM mode, fails in native.","solutions":["Convert the .pfb font to .ttf (fontforge, pfb2ttf) and use the TrueType file","Remove .pfb entries from font registration/config and use .ttf/.otf only","Avoid native image if Type 1 fonts are strictly required"],"exampleFix":"// before\nregisterFont(\"fonts/My.pfb\");\n// after (convert My.pfb -> My.ttf)\nregisterFont(\"fonts/My.ttf\");","handlingStrategy":"validation","validationCode":"static void checkFont(String name) {\n    String lower = name.toLowerCase(Locale.ROOT);\n    if (lower.endsWith(\".pfb\") || lower.endsWith(\".pfa\")) {\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(\".pfb\")) {\n        log.error(\"Use the TrueType (.ttf) variant of this font in native mode\");\n    }\n}","preventionTips":["Strip .pfb/.pfm companions from font resource bundles when targeting native","Register only .ttf/.otf files with GraphicsEnvironment.registerFont","Convert with fontforge during image build","Cover font registration in native integration tests"],"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"}