curvednebula / apibake-js

Convert OpenAPI to PDF.
https://curvednebula.com/apibake
21 stars 2 forks source link

Mono fonts not showing, no errors on invalid fonts #8

Open SkoZombie opened 3 weeks ago

SkoZombie commented 3 weeks ago

When generating the document without any parameters, mono text is rendered with a proportional font:

image

I tried overriding the fonts in the config file:

{
  "font": {
    "baseSize": 10,
    "mono": {
      "norm": {
        "face": "/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf"
      },
      "bold": {
        "face": "/usr/share/fonts/truetype/dejavu/DejaVuSansMono-Bold.ttf"
      },
      "italic": {
        "face": "/usr/share/fonts/truetype/dejavu/DejaVuSansMono-Oblique.ttf"
      }
    }
}

However this did not make any visible difference. The config was definitely loading as it was respecting the baseSize setting.

When I set the face to an invalid font name/ path there were no errors in the console indicating it couldn't find the specified font.

I'm using Linux Mint with ApiBake 0.1.25.

Thanks for this tool! I hope more people use it as it's got a lot of promise to include in CI/CD workflows to automate documentation generation.

SkoZombie commented 3 weeks ago

It seems like it's not embedding the fonts at all which indicates they're not being used/ called. When scanning the output:

> pdffonts output.pdf 
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
Helvetica-Bold                       Type 1            WinAnsi          no  no  no       8  0
Helvetica                            Type 1            WinAnsi          no  no  no       9  0

I cloned the repo and it seems like a lot of the output functions don't use the mono font so this might be be by design?

Generally my expectation is JSON is formatted with a mono font like the other OpenAPI/ Swagger tools.