Comments (2)
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.
This should be fixed in the develop
branch, see the roadmap for more information: #74
from canvas.
Related Issues (20)
- Fill a path with an Image HOT 3
- [bug] panic: runtime error: index out of range [2] with length 2 HOT 1
- [question] About line break, I found a case that seems to be a bug HOT 2
- idea: Context.DrawSVG() that draws a parsed SVG HOT 13
- question: is LinearGradient working with the Gio renderer? HOT 6
- Panic in PDF rendering - unknown PDF type []pdf.pdfDict HOT 2
- Latest master does not build HOT 1
- Importing into a new package is not currently working because "star-tex" is offline HOT 4
- RTL texts: Numbers inserted from right to left instead of left to right HOT 2
- Vertical alignment inside a text box using some fonts is misaligned HOT 19
- Use fontconfig
- Single line text in a textbox doesn't return OutlineBounds HOT 2
- Bug Report: Index Out of Range Panic for Empty String in text.go HOT 1
- Bug Report: Text Alignment Issue for Persian/Arabic Strings with Numbers HOT 1
- Recent font finding update changes how some font names are used in code HOT 2
- Request to make mmPerEm from FontFace public HOT 1
- Word wrap fail inside a textbox under specific conditions. HOT 6
- html and css layout support HOT 1
- Inconsistent rendering when using context `SetZIndex()` HOT 2
- [Question] How to set the background color when drawing font images in PNG format HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from canvas.