Class: Giblish::PdfCustomStyle

Inherits:
DocAttributesBase show all
Defined in:
lib/giblish/docattr_providers.rb

Instance Method Summary collapse

Constructor Details

#initialize(pdf_style_path, *pdf_font_dirs) ⇒ PdfCustomStyle

pdf_style_path

the path name (preferable absolute) to the yml file

pdf_font_dirs

one or more Pathnames to each font dir that shall be

checked for fonts



45
46
47
48
49
50
51
# File 'lib/giblish/docattr_providers.rb', line 45

def initialize(pdf_style_path, *pdf_font_dirs)
  @pdf_theme_path = pdf_style_path
  # one can specify multiple font dirs as:
  # -a pdf-fontsdir="path/to/fonts;path/to/more-fonts"
  # Always use the GEM_FONTS_DIR token to load the adoc-pdf gem's font dirs as well
  @pdf_fontsdir = (Array(pdf_font_dirs) << "GEM_FONTS_DIR").collect { |d| d.to_s }&.join(";")
end

Instance Method Details

#document_attributes(src_node, dst_node, dst_top) ⇒ Object



53
54
55
56
57
58
59
60
61
# File 'lib/giblish/docattr_providers.rb', line 53

def document_attributes(src_node, dst_node, dst_top)
  result = {
    "pdf-theme" => @pdf_theme_path.basename.to_s,
    "pdf-themesdir" => @pdf_theme_path.dirname.to_s,
    "icons" => "font"
  }
  result["pdf-fontsdir"] = @pdf_fontsdir unless @pdf_fontsdir.nil?
  result
end