From 7fb6acc0702e4e6a05390be063d433b088d9cc0d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 3 Oct 2011 21:09:09 -0400 Subject: 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:) --- data/doc/sisu/CHANGELOG_v3 | 6 ++++++ lib/sisu/v3/param.rb | 28 +++++++++++++++++++++++++--- lib/sisu/v3/sysenv.rb | 29 +++++++++++++++++++++++++---- lib/sisu/v3/texpdf_format.rb | 33 ++++++++++++++++++++++++++++----- 4 files changed, 84 insertions(+), 12 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 039d0bbe..c9af99a2 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -29,6 +29,12 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.1.0.orig.tar.xz * link to git repo * minor fixes + * texpdf, fonts, Liberation series default (Sans for main) + * (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:) + %% 3.0.19.orig.tar.xz (2011-09-24:38/6) http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu-3.0.19 http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.0.19-1 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/ <