diff options
| author | Ralph Amissah <ralph@amissah.com> | 2010-06-11 21:46:50 -0400 | 
|---|---|---|
| committer | Ralph Amissah <ralph@amissah.com> | 2010-06-11 21:46:53 -0400 | 
| commit | 4ceb5ecac549b1525c5301ea805c82fa321208a2 (patch) | |
| tree | d8d606929896ddf4b8c099180846310e810736bf | |
| parent | param, fix breakage on malformed sisu identifier (top header line) (diff) | |
texpdf set/select font, default "Liberation Sans"
* requires that Liberation fonts be installed, hence version bump
* set font in:
  sisurc.yml under default: texpdf_font:
  marked up document under @make: :texpdf_font:
  default if nothing set "Liberation Sans"
| -rw-r--r-- | conf/sisu/v2/sisurc.yml | 1 | ||||
| -rw-r--r-- | lib/sisu/v2/param.rb | 29 | ||||
| -rw-r--r-- | lib/sisu/v2/sysenv.rb | 14 | ||||
| -rw-r--r-- | lib/sisu/v2/texpdf_format.rb | 1 | 
4 files changed, 30 insertions, 15 deletions
| diff --git a/conf/sisu/v2/sisurc.yml b/conf/sisu/v2/sisurc.yml index d4b1503d..6a9bde0f 100644 --- a/conf/sisu/v2/sisurc.yml +++ b/conf/sisu/v2/sisurc.yml @@ -55,6 +55,7 @@ flag:  #% papersize, (LaTeX/pdf) available values: A4, US_letter, book_b5, book_a5, US_legal  default:    papersize:    'A4,letter' +  #texpdf_font:  'Liberation Serif' # 'Liberation Sans' 'Liberation Serif'    #text_wrap:    78    #emphasis:     'bold' #make *{emphasis}* 'bold', 'italics' or 'underscore', default if not configured is 'bold'    #digest:       'sha' #sha is sha256, default is md5 diff --git a/lib/sisu/v2/param.rb b/lib/sisu/v2/param.rb index a4ac4589..98478626 100644 --- a/lib/sisu/v2/param.rb +++ b/lib/sisu/v2/param.rb @@ -148,8 +148,8 @@ module SiSU_Param        end      end      class Md -      def initialize(str,opt) -        @s,@opt=str,opt +      def initialize(str,opt,env) +        @s,@opt,@env=str,opt,env        end        def validate_length(s,l,n)          #s=(s.length <= l) ? s : nil  @@ -668,6 +668,11 @@ module SiSU_Param            else nil            end          end +        def texpdf_font +          @h['texpdf_font'] && (@h['texpdf_font']=~/\S{3,}/) \ +          ? @h['texpdf_font'] \ +          : @env.font.texpdf +        end          def skin            @h['skin']          end @@ -922,23 +927,23 @@ module SiSU_Param              case para              when /^@ocn:\s+(.+?)$/m; @ocn=$1                                                                           #% processing              when /^@title:(.+)/m                                                                                       #% metainfo DC -              @title=Md.new($1.strip,@opt).title +              @title=Md.new($1.strip,@opt,@env).title              when /^@creator:(.+)/m                                                                                     #% metainfo DC -              @creator=Md.new($1.strip,@opt).creator +              @creator=Md.new($1.strip,@opt,@env).creator                @authorship=@author=@creator.author                @authors=@creator.author_detail              when /^@classify:(.+)/m; classify=$1 -              @classify=Md.new($1.strip,@opt).classify +              @classify=Md.new($1.strip,@opt,@env).classify              when /^@publisher:\s+(.+)/m -              @publisher=Md.new($1.strip,@opt).current_publisher +              @publisher=Md.new($1.strip,@opt,@env).current_publisher              when /^@original:(.+)/m -              @original=Md.new($1.strip,@opt).original +              @original=Md.new($1.strip,@opt,@env).original                @source=@original.source              when /^@writing_focus[:.]nationality:\s+(.+?)$/; @writing_focus=$1                                           # e.g. Finland (where and article on Finnish law)              when /^@date:(.+)/m                                                                                         #% metainfo DC -              @date=Md.new($1.strip,@opt).date +              @date=Md.new($1.strip,@opt,@env).date              when /^@rights:(.+)/m; #@rights=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line])                       #% metainfo DC copyright, public domain, copyleft, creative commons, etc. -              @rights=Md.new($1.strip,@opt).rights +              @rights=Md.new($1.strip,@opt,@env).rights              when /^@papersize:\s+(.+?)$/m                                                                              #% metainfo DC                l=$1                if @mod.inspect !~/--papersize[=-]\S+/ @@ -946,7 +951,7 @@ module SiSU_Param                  @papersize=l                end              when /^@make:(.+)/m                                                                                        #% metainfo DC -              @make=Md.new($1.strip,@opt).make +              @make=Md.new($1.strip,@opt,@env).make                if defined? @make.breaks \                and @make.breaks[:page_new]               #clearpage                  @pagenew=@make.breaks[:page_new] @@ -978,7 +983,7 @@ module SiSU_Param                  @man_section=(defined? @make.manpage.section) ? @make.manpage.section : 1                end              when /^@links:\s+(.+?)\Z/m                                                                                 #% processing -              doc_links=Md.new($1.strip,@opt).links +              doc_links=Md.new($1.strip,@opt,@env).links                count=1                @lnk=[]                doc_links.each do |doc_link| @@ -989,7 +994,7 @@ module SiSU_Param                  end                end              when /^@notes?:\s(.+)/                                                                               #% metainfo -              Md.new($1.strip,@opt).notes +              Md.new($1.strip,@opt,@env).notes              when /^@base_program:\s+(.+?)$/; @base_program=$1                                                          #% processing              end              @lv1 ||=/^1~/ diff --git a/lib/sisu/v2/sysenv.rb b/lib/sisu/v2/sysenv.rb index 4daccbcd..8a9e38be 100644 --- a/lib/sisu/v2/sysenv.rb +++ b/lib/sisu/v2/sysenv.rb @@ -1265,6 +1265,14 @@ WOK          end        end      end +    def font +      def texpdf +        (defined? @rc['default']['texpdf_font']) \ +        ? @rc['default']['texpdf_font'] \ +        : 'Liberation Sans' #'Liberation Sans' #'Liberation Serif' +      end +      self +    end      def path                                                                     #dir        def home          @sys.home @@ -1329,9 +1337,9 @@ WOK          @yamlrc_dir        end        def man #check use -        if defined? @rc['webserv']['man']; "#{webserv}/#{@rc['webserv']['man']}" -        else defaults[:webserv_man] -        end +        (defined? @rc['webserv']['man']) \ +        ? "#{webserv}/#{@rc['webserv']['man']}" \ +        : defaults[:webserv_man]        end        def webserv_path #testing, check need, remove          webserv diff --git a/lib/sisu/v2/texpdf_format.rb b/lib/sisu/v2/texpdf_format.rb index b53864ec..87a946d0 100644 --- a/lib/sisu/v2/texpdf_format.rb +++ b/lib/sisu/v2/texpdf_format.rb @@ -635,6 +635,7 @@ module SiSU_TeX_Pdf  \\usepackage{polyglossia, ucs, fontspec, xltxtra, xunicode}  \\setmainlanguage{#{tex_head_lang}}  \\setotherlanguage{english} +\\setmainfont{#{@md.make.texpdf_font}}  WOK        when /pdf/          if @md.file_encoding =~ /iso-?8859/i                                   #% iso8859 | 
