Skip to content
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

add font support for text box / numbering feature #4

Open
boazsegev opened this issue Sep 6, 2014 · 2 comments
Open

add font support for text box / numbering feature #4

boazsegev opened this issue Sep 6, 2014 · 2 comments

Comments

@boazsegev
Copy link
Owner

The standard 14 PDF fonts have an uncertain future and the recommendation is to embed fonts, even for those 14 standard fonts.

For the future of the numbering feature, we need to enable embedding fonts as part of the PDFWriter or PDF object.

There are a number of issues to think about:

  1. Where would the fonts be embedded?
    The natural place would be the PDFWriter object... but... embedding fonts in the PDFWriter object might cause duplication of fonts when importing multiple pages. Hence, the embedding of fonts should be carefully coded, so that the add_referenced method of the PDF object could recognize any duplication.

On this matter, thought should be given to the question, weather the "add_referenced" method have a better duplication recognition algorithm then the basic one currently in place. Speed performance should overrule space conservation.

  1. Metrics calculations
    The current metrics calculations will be broken with any external fonts.
    Adding fonts support will require adding a new metrics calculation for "dimensions_of" method currently defined in the metrics_dictionary.rb file.
  2. Unicode support
    Some languages are written from right to left or up to down (or down to up, but that's more history and is quire of a non issue at the current stage).
  3. Limitations of Font support
    The font support should, by definition, be limited. Libraries like Prawn provide PDF Authoring, whereas the CombinePDF Library is looking for providing a pdftk alternative.

Hence, it is more important to have pristine support for limited number of fonts (maybe only TrueType fonts, maybe only OpenType fonts or maybe a closed library of specific unicode royalty-free fonts) rather then an extensive font library.

It seems to me that having a library of hard-coded fonts might be the best solution for allowing the use of Unicode in the page numbering and text box features.

@boazsegev
Copy link
Owner Author

I have completed writing the font library module (CombinePDF::Fonts).

This is the beginning of Fonts support, as now plug-ins can be created to register fonts at the library - either dynamically or hard-coded fonts.

I still need help with creating an importer for the font objects themselves...

@boazsegev
Copy link
Owner Author

Added CMap support to the font library.

Hard coders can now import Type0 fonts from existing PDF pages for use in their new PDF files or new PDF pages (using the CombinePDF.create_page and using the CombinePDF::Fonts.register_font_from_pdf_object

It is still inner workings for the CombinePDF model, so I guess it's an irrelevant improvement.

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

No branches or pull requests

1 participant