Skip to content

Issue using colon character ":" with fontkit and Noto Sans CJK font #472

Closed

Description

@mmejia27

Coming over from fontkit (foliojs/fontkit#23), since we determined that the issue most likely lies in pdfkit.

Using the colon character causes many of the characters to not be displayed in the resulting PDF. As soon as the colon is removed, the characters are displayed without an issue.

Below is a snippet that reproduces the issue. I used a local module to reference the fontkit branch of pdfkit.

var PDFDocument = require('../pdfkit');
var fs = require('fs');

var pdfFile = 'test.pdf';
var fontFile = 'NotoSansCJKsc-Regular.otf';
var doc = new PDFDocument({  bufferPages: true });
var pdfStream = fs.createWriteStream(pdfFile);
doc.pipe(pdfStream);

doc.fontSize(12)
   .font(fontFile)
   .text("This is a test: The quick brown fox jumps over the lazy dog.");

doc.end();

Activity

  1. jwerre commented on Jun 10, 2016

    @jwerre

    pdfkit doesn't support Open Type Fonts fonts. You need to use TrueType (.ttf), TrueType Collection (.ttc), or Datafork TrueType (.dfont). Try using NotoSansCJK-Regular.ttc

  2. mmejia27 commented on Jul 26, 2016

    @mmejia27
    Author

    I was trying to use pdfkit with the fontkit branch, which does support OTF. Also, the TTC versions of Noto do not work in pdfkit (master). Even though they have .ttc extension, it's actually OTC.

  3. mmejia27 commented on Nov 17, 2016

    @mmejia27
    Author

    Wanted to see if anyone had an update on this? Still seems to happen with PDFKit 0.8.0.

  4. blikblum commented on Oct 5, 2019

    @blikblum
    Member

    This should fix it: foliojs/fontkit#207

  5. liborm85 commented on Jul 11, 2021

    @liborm85
    Collaborator

    Fixed in fontkit 1.8.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions