Giter Club home page Giter Club logo

Comments (2)

tdewolff avatar tdewolff commented on May 18, 2024

Someone e-mailed me personally with the same issue, this was my response:

It looks like dots are displayed when the font file cannot be found or the character is not defined in the PDF. This is strange as it loads fine in a variety of applications on my Linux computer. It might be related to the use of UTF-8 characters in the text (the double quotes in this case). To be fair, text embedding in PDFs could be improved in general as there is a bug of copy pasting text from the PDF not representing the written text. The latter might be related to your issue.

Can you output a PDF of https://github.com/tdewolff/canvas/tree/master/examples/document and see what happens? That is, does this happen when there is a UTF-8 character used, or also when just using ASCII. In general, at https://github.com/tdewolff/canvas/blob/master/pdf/renderer.go#L490 I'm wrapping the font program in a couple of layers which seems to be unnecessary and might be part of the problem. For example, output from Inkscape is much more concise.

In particular, this could be fixed with a GID to codepoint table as defined in the PDF specification, but I think it could be simpler by more directly embedding the font program and specifying the right encoding. In the future it would be desireable to create the TTF/OTF font (instead of copying the original font file) so that we can tweak the GID=>codepoint table to match one of PDFs encodings and so we can subset the file and remove unnecessary tables.

from canvas.

tdewolff avatar tdewolff commented on May 18, 2024

This should be fixed in the develop branch, see the roadmap for more information: #74

from canvas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.