Sha256: e8267da1b6abdf64e1cc740eb9fa63e7884f15e60ed4b52dfacec44c28a59237
Contents?: true
Size: 1.83 KB
Versions: 1
Compression:
Stored size: 1.83 KB
Contents
# coding: utf-8 module ThinReports module Generator # @private module Pdf::Font FONT_STORE = File.join(ThinReports::ROOTDIR, 'resources', 'fonts') BUILTIN_FONTS = { 'IPAMincho' => {:normal => File.join(FONT_STORE, 'ipam.ttf')}, 'IPAPMincho' => {:normal => File.join(FONT_STORE, 'ipamp.ttf')}, 'IPAGothic' => {:normal => File.join(FONT_STORE, 'ipag.ttf')}, 'IPAPGothic' => {:normal => File.join(FONT_STORE, 'ipagp.ttf')} } private def setup_fonts # Install built-in fonts. pdf.font_families.update(BUILTIN_FONTS) # Install fall-back font that IPAMincho. fallback_font = BUILTIN_FONTS['IPAMincho'][:normal] pdf.font_families['FallbackFont'] = {:normal => fallback_font, :bold => fallback_font, :italic => fallback_font, :bold_italic => fallback_font} # Setup fallback font. pdf.fallback_fonts(['FallbackFont']) # Create aliases from the font list provided by Prawn. pdf.font_families.update( 'Courier New' => pdf.font_families['Courier'], 'Times New Roman' => pdf.font_families['Times-Roman'] ) end # @return [String] def default_family 'Helvetica' end # @param [String] family # @return [String] def default_family_if_missing(family) pdf.font_families.key?(family) ? family : default_family end # @param [String] font # @param [Symbol] style # @return [Boolean] def font_has_style?(font, style) (f = pdf.font_families[font]) && f.key?(style) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
thinreports-0.6.0.pre3 | lib/thinreports/generator/pdf/document/font.rb |