diff options
author | Ralph Amissah <ralph@amissah.com> | 2011-10-03 21:09:09 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2011-10-03 21:09:11 -0400 |
commit | 7fb6acc0702e4e6a05390be063d433b088d9cc0d (patch) | |
tree | 8b3e35532b5909f4da9617415d0712cb415af2e3 /lib | |
parent | v3: defaults, (sisu) home page, link to git repo, minor fixes (diff) |
v3: texpdf, fonts, Liberation series default (main: Sans, mono: Mono)
* (mono) improved with selection of Liberation Mono as default
* font (main font, mono) configurable in sisurc.yml under
default: (texpdf_font:|texpdf_font_mono:)
or within document under @make: (:texpdf_font:|:texpdf_font_mono:)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v3/param.rb | 28 | ||||
-rw-r--r-- | lib/sisu/v3/sysenv.rb | 29 | ||||
-rw-r--r-- | lib/sisu/v3/texpdf_format.rb | 33 |
3 files changed, 78 insertions, 12 deletions
diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index e2cffa9b..674b8cba 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -814,9 +814,31 @@ module SiSU_Param end end def texpdf_font - @h['texpdf_font'] && (@h['texpdf_font']=~/\S{3,}/) \ - ? @h['texpdf_font'] - : @env.font.texpdf + def main + @h['texpdf_font'] \ + && (@h['texpdf_font']=~/\S{3,}/) \ + ? @h['texpdf_font'] + : @env.font.texpdf.main + end + def sans # not used + @h['texpdf_font_sans'] \ + && (@h['texpdf_font_sans']=~/\S{3,}/) \ + ? @h['texpdf_font_sans'] + : @env.font.texpdf.sans + end + def serif # not used + @h['texpdf_font_serif'] \ + && (@h['texpdf_font_serif']=~/\S{3,}/) \ + ? @h['texpdf_font_serif'] + : @env.font.texpdf.serif + end + def mono + @h['texpdf_font_mono'] \ + && (@h['texpdf_font_mono']=~/\S{3,}/) \ + ? @h['texpdf_font_mono'] + : @env.font.texpdf.mono + end + self end def skin @h['skin'] diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index 9d4fa887..aaf210e0 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -1529,10 +1529,31 @@ WOK end def font def texpdf - (defined? @rc['default']['texpdf_font']) \ - && (@rc['default']['texpdf_font']=~/\S{3,}/) \ - ? @rc['default']['texpdf_font'] - : 'Liberation Sans' #'Liberation Sans' #'Liberation Serif' + def main + (defined? @rc['default']['texpdf_font']) \ + && (@rc['default']['texpdf_font']=~/\S{3,}/) \ + ? @rc['default']['texpdf_font'] + : 'Liberation Sans' + end + def sans # not used + (defined? @rc['default']['texpdf_font_sans']) \ + && (@rc['default']['texpdf_font_sans']=~/\S{3,}/) \ + ? @rc['default']['texpdf_font_sans'] + : 'Liberation Sans' + end + def serif # not used + (defined? @rc['default']['texpdf_font_serif']) \ + && (@rc['default']['texpdf_font_serif']=~/\S{3,}/) \ + ? @rc['default']['texpdf_font_serif'] + : 'Liberation Serif' + end + def mono + (defined? @rc['default']['texpdf_font_mono']) \ + && (@rc['default']['texpdf_font_mono']=~/\S{3,}/) \ + ? @rc['default']['texpdf_font_mono'] + : 'Liberation Mono' + end + self end self end diff --git a/lib/sisu/v3/texpdf_format.rb b/lib/sisu/v3/texpdf_format.rb index bf1c2a37..34169892 100644 --- a/lib/sisu/v3/texpdf_format.rb +++ b/lib/sisu/v3/texpdf_format.rb @@ -789,12 +789,32 @@ module SiSU_TeX_Pdf { mainlang: mainlang, otherlang: otherlang } end def tex_head_encode - texpdf_font=if defined? @md.make.texpdf_font \ - and not @md.make.texpdf_font.nil? \ - and @md.make.texpdf_font=~/\S{3,}/ - @md.make.texpdf_font - else @env.font.texpdf + texpdf_font=if defined? @md.make.texpdf_font.main \ + and not @md.make.texpdf_font.main.nil? \ + and @md.make.texpdf_font.main=~/\S{3,}/ + @md.make.texpdf_font.main + else @env.font.texpdf.main end + texpdf_font_sans=if defined? @md.make.texpdf_font.sans \ + and not @md.make.texpdf_font.sans.nil? \ + and @md.make.texpdf_font.sans=~/\S{3,}/ # not used + @md.make.texpdf_font.sans + else @env.font.texpdf.sans + end + texpdf_font_serif=if defined? @md.make.texpdf_font.serif \ + and not @md.make.texpdf_font.serif.nil? \ + and @md.make.texpdf_font.serif=~/\S{3,}/ # not used + @md.make.texpdf_font.serif + else @env.font.texpdf.serif + end + texpdf_font_mono=if defined? @md.make.texpdf_font.mono \ + and not @md.make.texpdf_font.mono.nil? \ + and @md.make.texpdf_font.mono=~/\S{3,}/ + @md.make.texpdf_font.mono + else @env.font.texpdf.mono + end + # you may wish to check selected font against avaiable fonts: + # fc-list :outline -f "%{family}\n" case @tex2pdf when /xe/ <<WOK @@ -802,6 +822,9 @@ module SiSU_TeX_Pdf \\setmainlanguage{#{tex_head_lang[:mainlang]}} \\setotherlanguage{#{tex_head_lang[:otherlang]}} \\setmainfont{#{texpdf_font}} +\\setmonofont[Scale=0.85]{#{texpdf_font_mono}} +% \\setsansfont{#{texpdf_font_sans}} +% \\setromanfont{#{texpdf_font_serif}} WOK when /pdf/ if @md.file_encoding =~ /iso-?8859/i #% iso8859 |