I want to use wxPDFDoc with my app. I don't want to build it separately and I wonder if I can just include the files with my project and build them together.Also I want to use System fonts so I don't want to include with my app extra fonts. Are those two things possible?

Chief Justice: We have trouble dear citizens!Citizens: What it is his honor?Chief Justice:Our president is an atheist, who will he swear to?[Ubuntu 15.04/Windows 10 Pro - GCC/MinGW, CodeLite IDE et al]

evstevemd wrote:I want to use wxPDFDoc with my app. I don't want to build it separately and I wonder if I can just include the files with my project and build them together.

Sure, you can do that of course. There are currently no external dependencies except wxWidgets.

evstevemd wrote:Also I want to use System fonts so I don't want to include with my app extra fonts. Are those two things possible?

Well, that depends on the requirements of your application. If you can restrict your application to just use the 14 PDF / PostScript core fonts Helvetica (Regular, Bold, Oblique, BoldOblique), Times Roman ((Regular, Bold, Oblique, BoldOblique), Courier (Regular, Bold, Oblique, BoldOblique), Symbol, and ZapfDingbats, then no fonts have to be embedded into the resulting PDF document. You refer to those fonts by the names "Courier", "Helvetica", "Times", "Symbol", and "ZapfDingbats" in the wxPdfDocument API. It is not required to "register" those fonts; they are always "known" by wxPdfDocument.

However, you have to face the fact that the core fonts support only a limited character set, corresponding more or less to Windows-1252 (Latin-1) or ISO-8859-1 codepages. You can find the list of available characters in Appendix D of the Adobe PDF reference.

evstevemd wrote:I want to use wxPDFDoc with my app. I don't want to build it separately and I wonder if I can just include the files with my project and build them together.

Sure, you can do that of course. There are currently no external dependencies except wxWidgets.

Thank you so much for your confirmation. I appreciate it!

utelle wrote:

evstevemd wrote:Also I want to use System fonts so I don't want to include with my app extra fonts. Are those two things possible?

Well, that depends on the requirements of your application. If you can restrict your application to just use the 14 PDF / PostScript core fonts Helvetica (Regular, Bold, Oblique, BoldOblique), Times Roman ((Regular, Bold, Oblique, BoldOblique), Courier (Regular, Bold, Oblique, BoldOblique), Symbol, and ZapfDingbats, then no fonts have to be embedded into the resulting PDF document. You refer to those fonts by the names "Courier", "Helvetica", "Times", "Symbol", and "ZapfDingbats" in the wxPdfDocument API. It is not required to "register" those fonts; they are always "known" by wxPdfDocument.

However, you have to face the fact that the core fonts support only a limited character set, corresponding more or less to Windows-1252 (Latin-1) or ISO-8859-1 codepages. You can find the list of available characters in Appendix D of the Adobe PDF reference.

Regards,

Ulrich

I'm lost here, please excuse my ignorance.Let say for example I use Liberation Sans (which comes with ubuntu and is availble for free), is there anything extra I need to do?

Chief Justice: We have trouble dear citizens!Citizens: What it is his honor?Chief Justice:Our president is an atheist, who will he swear to?[Ubuntu 15.04/Windows 10 Pro - GCC/MinGW, CodeLite IDE et al]

evstevemd wrote:Also I want to use System fonts so I don't want to include with my app extra fonts. Are those two things possible?

Well, that depends on the requirements of your application. If you can restrict your application to just use the 14 PDF / PostScript core fonts Helvetica (Regular, Bold, Oblique, BoldOblique), Times Roman ((Regular, Bold, Oblique, BoldOblique), Courier (Regular, Bold, Oblique, BoldOblique), Symbol, and ZapfDingbats, then no fonts have to be embedded into the resulting PDF document. You refer to those fonts by the names "Courier", "Helvetica", "Times", "Symbol", and "ZapfDingbats" in the wxPdfDocument API. It is not required to "register" those fonts; they are always "known" by wxPdfDocument.

However, you have to face the fact that the core fonts support only a limited character set, corresponding more or less to Windows-1252 (Latin-1) or ISO-8859-1 codepages. You can find the list of available characters in Appendix D of the Adobe PDF reference.

I'm lost here, please excuse my ignorance.Let say for example I use Liberation Sans (which comes with ubuntu and is availble for free), is there anything extra I need to do?

Maybe I misinterpreted your question.

Usually, it is necessary to embed the font data of all used fonts in a PDF document, to make it displayable / readable anywhere. However, this is not the case for the 14 core fonts, which can be used without any special measures, since every PDF reader "knows" how to display those fonts. For example, on Windows platforms the font Arial is the equivalent of the core font Helvetica.

If you are going to use a font that is not one of the core fonts, wxPdfDocument needs access to the font data file. That is, you need to "register" the font in question with a method of the wxPdfDocument font manager (class wxPdfFontManager). This can be done in several ways:

Call RegisterFont with the full path of the font data file

Call RegisterFont with a wxFont instance of the font, if you used the very same font for on-screen display

Call RegisterSystemFonts to register all fonts that are installed in the default font location of your system

Call RegisterFontDirectory to register all font files located in a given directory

So, if you want to use font Liberation Sans to create a PDF document with wxPdfDocument, you'll have to register it with wxPdfFontManager.

However, as far as I know, the Liberation fonts are open font replacements for the Microsoft fonts Times New Roman, Arial, and Courier New (which are in turn equivalent to the core fonts Times Roman, Helvetica, and Courier). That is, your application should be fine in just using the core fonts.

That was comprehensive answer. I thank you. You have answered all I asked and more.Thank you!

Chief Justice: We have trouble dear citizens!Citizens: What it is his honor?Chief Justice:Our president is an atheist, who will he swear to?[Ubuntu 15.04/Windows 10 Pro - GCC/MinGW, CodeLite IDE et al]

Hi Urlich,I have one more question. Can I force the PDF to use only Single Font in rendering? For example I want everything to be rendered with Exo 2 font only without disturbing Sizes?

Thanks

Chief Justice: We have trouble dear citizens!Citizens: What it is his honor?Chief Justice:Our president is an atheist, who will he swear to?[Ubuntu 15.04/Windows 10 Pro - GCC/MinGW, CodeLite IDE et al]

evstevemd wrote:Can I force the PDF to use only Single Font in rendering? For example I want everything to be rendered with Exo 2 font only without disturbing Sizes?

It's not fully clear what you intend to accomplish. wxPdfDocument requires the user / developer to select a font, before writing text to the PDF document. If you want to use only a single certain font, then restrict your application to select just that font.

If you try to output something via wxPdfDC and your drawing method selects various wxFonts to generate the output, then the underlying wxPdfDocument instance will also use various fonts.

In short, it is the developer's responsibility to select the font(s).

If this does not answer your question, please be more specific about what problem you experience that you want to solve.

evstevemd wrote:Can I force the PDF to use only Single Font in rendering? For example I want everything to be rendered with Exo 2 font only without disturbing Sizes?

It's not fully clear what you intend to accomplish. wxPdfDocument requires the user / developer to select a font, before writing text to the PDF document. If you want to use only a single certain font, then restrict your application to select just that font.

If you try to output something via wxPdfDC and your drawing method selects various wxFonts to generate the output, then the underlying wxPdfDocument instance will also use various fonts.

In short, it is the developer's responsibility to select the font(s).

If this does not answer your question, please be more specific about what problem you experience that you want to solve.

Regards,

Ulrich

I use wxPdfDC and I want to restrict fonts to single font. Here is my code

Chief Justice: We have trouble dear citizens!Citizens: What it is his honor?Chief Justice:Our president is an atheist, who will he swear to?[Ubuntu 15.04/Windows 10 Pro - GCC/MinGW, CodeLite IDE et al]

It really depends on the content of the wxRichTextBuffer. If you used different fonts on creating the content using methods wxRichTextCtrl::SetDefaultStyle, wxRichTextCtrl::SetFont, wxRichTextCtrl::BeginFont, wxRichTextCtrl::SetStyle and the like, then the answer is unfortunately NO. wxPdfDC and hence wxPdfDocument will use the fonts that are associated with the content of the wxRichTextBuffer. In fact, this is not related to wxPdfDC at all - that's how wxRichTextPrintout handles writing to a DC.

If you don't want different fonts in PDF output, you will have to regenerate the wxRichTextBuffer using just a single font.

Ok great.Thanks for clearing that out. I will find a solution on wxRTC before printing

Chief Justice: We have trouble dear citizens!Citizens: What it is his honor?Chief Justice:Our president is an atheist, who will he swear to?[Ubuntu 15.04/Windows 10 Pro - GCC/MinGW, CodeLite IDE et al]