-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
writing unicode characters in pdf #40
Comments
The way fonts are handled in nimPDF is similar to a web browser where you only need to tell which font family to use and not the filename itself. A font family can be organized into one or more file, or one file can contains multiple font style in the same family. You only need to tell nimPDF where to find those font file using PDFOptions, and when you use var opts = newPDFOptions()
opts.addFontsPath("fonts")
opts.addImagesPath("resources")
opts.addImagesPath("pngsuite")
opts.addResourcesPath("resources")
var doc = newPDF(opts)
doc.setFont("Times", {FS_REGULAR}, 4) |
Thank you @jangko. I used your suggestion, and I could change the font in both Linux and windows environment. In windows the pdf shows Greek letters correctly and in the right order, but for Arabic letters, they were in reverse order. But in Linux neither Greek nor Arabic leters were not shown at all, just some strange symbols appeared. In python there are some modules ( I think for Nim we must have such modules or at least some wrappers for those python modules. Right now I have no idea what happens in Linux that ends to this problem. I think opening an issue was not a good decision, and I should have asked my question in forums like stackoverflow instead. But I for one appreciate your job and thank you for that. |
I just wrote a code in pure Nim similar to python module |
Hi, I am new to nim, and I am still learning. I was wondering if there was any way to write utf-8 unicode characters and specially right to left characters inside a pdf using nimpdf. for example here is the code I run:
what I see in pdf file is <hello ˛†>. and when I try to define a font that I know have the glyph for unicode characters, the code comiles without any error, but when I run the compiled file under linux, this error occures:
I think it's because it can not find correct path to the font (that is installed in .local/share/fonts/). and when I use the full path to the file, the same error still occurs.
The text was updated successfully, but these errors were encountered: