Method: CombinePDF::PDF#fonts

Defined in:
lib/combine_pdf/pdf_public.rb

#fonts(limit_to_type0 = false) ⇒ Object

returns an array with the different fonts used in the file.

Type0 font objects ( “font == :Type0” ) can be registered with the font library for use in PDFWriter objects (font numbering / table creation etc’).

Parameters:

  • limit_to_type0 (true, false) (defaults to: false)

    limits the list to type0 fonts.



253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/combine_pdf/pdf_public.rb', line 253

def fonts(limit_to_type0 = false)
  fonts_array = []
  pages.each do |p|
    p[:Resources][:Font].values.each do |f|
      f = f[:referenced_object] if f[:referenced_object]
      if (limit_to_type0 || f[:Subtype] = :Type0) && f[:Type] == :Font && !fonts_array.include?(f)
        fonts_array << f
      end
    end
  end
  fonts_array
end