From 3a0bb67b63884e39075b2655dab7169ee93c1e54 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 26 Oct 2023 18:26:06 -0400 Subject: texpdf, cjk issues not resolved - font rendition bugs where tested --- org/config_nix.org | 4 +- org/texpdf.org | 135 +++++++++++++++++++++++------------------------------ 2 files changed, 61 insertions(+), 78 deletions(-) (limited to 'org') diff --git a/org/config_nix.org b/org/config_nix.org index 9353975b..c9e54794 100644 --- a/org/config_nix.org +++ b/org/config_nix.org @@ -281,13 +281,15 @@ export RUBYLIB+=`pwd`/lib source-serif-pro source-code-pro texlive.combined.scheme-full + noto-fonts + noto-fonts-cjk-sans jq #git ]; inherit shellHook; }; dsh-sqlite = mkShell { - name = "sisu dev shell for latex & pdf output"; + name = "sisu dev shell for sqlite3 output"; inherit shell; inherit devEnv; packages = [ diff --git a/org/texpdf.org b/org/texpdf.org index cf8067ba..ee91e112 100644 --- a/org/texpdf.org +++ b/org/texpdf.org @@ -711,65 +711,6 @@ module SiSU_TeX end dob end - def tex_box_listings - <<-WOK -\\definecolor{listinggray}{gray}{0.9} -\\definecolor{lbcolor}{rgb}{0.9,0.9,0.9} -\\lstset{ - backgroundcolor=\\color{lbcolor}, - tabsize=4, - rulecolor=, - language=, - basicstyle=\\scriptsize, - upquote=true, - aboveskip={1.5\\baselineskip}, - columns=fixed, - showstringspaces=false, - extendedchars=true, - breaklines=true, - prebreak = \\raisebox{0ex}[0ex][0ex]{\\ensuremath{\\hookleftarrow}}, - frame=single, - showtabs=false, - showspaces=false, - showstringspaces=false, - identifierstyle=\\ttfamily, - keywordstyle=\\color[rgb]{0,0,1}, - commentstyle=\\color[rgb]{0.133,0.545,0.133}, - stringstyle=\\color[rgb]{0.627,0.126,0.941}, -} - WOK - end - def tex_box_boites - <<-WOK -\\def\\codeblockboitebox{% - \\def\\bkvz@before@breakbox{\\ifhmode\\par\\fi\\vskip\\breakboxskip\\relax}% - \\def\\bkvz@set@linewidth{\\advance\\linewidth -2\\fboxrule - \\advance\\linewidth -2\\fboxsep} % - \\def\\bk@line{\\hbox to \\linewidth{% - \\ifbkcount\\smash{\\llap{\\the\\bk@lcnt\\ }}\\fi - \\psframebox*[framesep=0pt,linewidth=0pt]{% - \\vrule\\@width\\fboxrule \\hskip\\fboxsep - \\box\\bk@bxa - \\hskip\\fboxsep \\vrule\\@width\\fboxrule - }% - }}% - %\\def\\bkvz@top{\\hrule\\@height\\fboxrule} - \\def\\bkvz@top{\\hrule height .6pt}% - \\def\\bkvz@bottom{\\hrule\\@height\\fboxrule}% - \\breakbox} -\\def\\endcodeblockboitebox{\\endbreakbox} - WOK - end - def tex_codeblock - codeblock_box=if @codeblock_box=='listings' - tex_box_listings - elsif @codeblock_box=='boites' - tex_box_boites - else - tex_box_boites - end - codeblock_box - end def markup(data) @tex_file=[] home=the_text.txt_home.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex @@ -788,7 +729,6 @@ module SiSU_TeX end @tex_file << <<-WOK #{@tex_ml.header}#{@tex_ml.footer} -#{tex_codeblock} % (tilde hash amp affected by http) % \\sloppy \\begin{document} @@ -1977,28 +1917,65 @@ module SiSU_TeX_Pdf case @tex2pdf when /xe/ if @md.opt.lng =~/(?:zh|ja|ko)/ - <<-WOK + if @md.opt.lng =~/zh/ + <<-WOK +\\usepackage{xeCJK} +\\setCJKmainfont{Noto} +\\setCJKmainfont{Noto Sans CJK TC} +\\setCJKsansfont{Noto Sans CJK TC} +\\setCJKmonofont{Noto Sans Mono CJK TC} \\setmainlanguage{#{tex_head_lang[:mainlang]}} \\setotherlanguage{english} -\\setmainfont{#{texpdf_fontface_cjk}} -\\setotherfont{#{texpdf_fontface}} -\\setmonofont[Scale=0.85]{#{texpdf_fontface_mono}} - WOK +% \\setmainfont{#{texpdf_fontface_cjk}} +% \\setotherfont{#{texpdf_fontface}} +\\setotherfont{Noto Sans} +% \\setmonofont[Scale=0.85]{#{texpdf_fontface_mono}} + WOK + elsif @md.opt.lng =~/ja/ + <<-WOK +\\usepackage{xeCJK} +\\setCJKmainfont{Noto} +\\setCJKmainfont{Noto Sans CJK JP} +\\setCJKsansfont{Noto Sans CJK JP} +\\setCJKmonofont{Noto Sans Mono CJK JP} +\\setmainlanguage{#{tex_head_lang[:mainlang]}} +\\setotherlanguage{english} +% \\setmainfont{#{texpdf_fontface_cjk}} +% \\setotherfont{#{texpdf_fontface}} +\\setotherfont{Noto Sans} +% \\setmonofont[Scale=0.85]{#{texpdf_fontface_mono}} + WOK + elsif @md.opt.lng =~/ko/ + <<-WOK +\\usepackage{xeCJK} +\\setCJKmainfont{Noto} +\\setCJKmainfont{Noto Sans CJK KR} +\\setCJKsansfont{Noto Sans CJK KR} +\\setCJKmonofont{Noto Sans Mono CJK KR} +\\setmainlanguage{#{tex_head_lang[:mainlang]}} +\\setotherlanguage{english} +% \\setmainfont{#{texpdf_fontface_cjk}} +% \\setotherfont{#{texpdf_fontface}} +\\setotherfont{Noto Sans} +% \\setmonofont[Scale=0.85]{#{texpdf_fontface_mono}} + WOK + else puts "lang error" + end elsif (tex_head_lang[:mainlang] == "english" \ && (tex_head_lang[:otherlang] == "english" \ || tex_head_lang[:otherlang] == "" \ || tex_head_lang[:otherlang].length == 0)) <<-WOK -\\setmainlanguage{#{tex_head_lang[:mainlang]}} -\\setmainfont{#{texpdf_fontface}} -\\setmonofont[Scale=0.85]{#{texpdf_fontface_mono}} +% \\setmainlanguage{#{tex_head_lang[:mainlang]}} +% \\setmainfont{#{texpdf_fontface}} +% \\setmonofont[Scale=0.85]{#{texpdf_fontface_mono}} WOK else <<-WOK -\\setmainlanguage{#{tex_head_lang[:mainlang]}} -\\setotherlanguage{english} -\\setmainfont{#{texpdf_fontface}} -\\setmonofont[Scale=0.85]{#{texpdf_fontface_mono}} +% \\setmainlanguage{#{tex_head_lang[:mainlang]}} +% \\setotherlanguage{english} +% \\setmainfont{#{texpdf_fontface}} +% \\setmonofont[Scale=0.85]{#{texpdf_fontface_mono}} WOK end when /pdf/ @@ -2036,7 +2013,9 @@ module SiSU_TeX_Pdf %\\usepackage{inconsolata} \\usepackage[T1]{fontenc} \\usepackage{newunicodechar} -% \\usepackage[utf8]{inputenc} +\\usepackage[utf8]{inputenc} +\\usepackage{xeCJK} +\\usepackage{noto} \\usepackage{alltt} \\usepackage[ unicode=true, @@ -2296,6 +2275,8 @@ module SiSU_TeX_Pdf <<-WOK #{tex_head_info} \\documentclass[11pt,a4paper,titlepage,makeidx]{scrartcl} +\\usepackage{fontspec} +\\usepackage{lmodern} \\usepackage{geometry} \\geometry{ #{d[:papertype]}, @@ -2498,9 +2479,9 @@ module SiSU_TeX_Pdf def tex_head_codeblock(codeblock_box_type) codeblock_box=if codeblock_box_type=='listings' <<-WOK -\\usepackage{listings} -\\usepackage{color} -\\usepackage{textcomp} +% \\usepackage{listings} +% \\usepackage{color} +% \\usepackage{textcomp} WOK elsif codeblock_box_type=='boites' "\\usepackage{boites}" @@ -2517,7 +2498,7 @@ module SiSU_TeX_Pdf #{tex_head_encode} #{tex_head_pdftex} #{tex_head_codeblock(codeblock_box_type)} -\\selectlanguage{#{tex_head_lang[:mainlang]}} +% \\selectlanguage{#{tex_head_lang[:mainlang]}} WOK end def a4generic -- cgit v1.2.3