On 2015年07月18日 21:35, Benjamin Berg wrote:
Hi,

thanks for the japanese testcase.

I do have an issue that apparently there are some glyphs missing when I
view the questoinnaire.pdf file using evince. But while the english
text in the report looks rather broken here, everything seems to work
fine here (see attachment).

I think I only did the changes that you suggested (see attached patch).

Is there anything I am missing, or could it be that there was a fix at
some point and you are using an older version of SDAPS. Though no fix
comes into my mind right now.

Regards,
Benjamin
Hi Benjamin,

Thanks for helping. I have the following versions installed;
sdaps 1.1.10-1
reportlab 3.0-1build1
texlive-xetex 2013.20140215-1

I reproduced the same problem with a fresh install on a separate machine. I don't know why it works for you, though the font you are using for Japanese looks different.

Anyway, problem is now solved!
Courtesy of this site: https://www.sharelatex.com/learn/Japanese

Regarding point 2 in my change log, I needed to simply change;
\setmainfont{TakaoExGothic}
to
\setCJKmainfont{TakaoExGothic}

That fixed it for both machines. I have attached the change file.

Thanks again,
Craig




How to get SDAPS to work for Japanese surveys
----------------------------

1. In /usr/lib/python2.7/dist-packages/sdaps/defs.py

At the bottom of the file,
Change 
latex_engine = "pdflatex"
To
latex_engine = "xelatex" # make sure to install this engine on your system
----------------------------

2. In <YourSurvey>.tex
Change
\usepackage[utf8]{inputenc}
To
\usepackage{xeCJK}
\setCJKmainfont{TakaoExGothic} % or any other Japanese font on your system
----------------------------

3. In /usr/lib/python2.7/dist-packages/sdaps/template.py
3.1 At the top, under the section;
from reportlab import platypus
from reportlab.lib import styles
from reportlab.lib import units
from reportlab.lib import pagesizes

Add;
# Start for Japanese
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.cidfonts import UnicodeCIDFont
fontname = "HeiseiMin-W3" # or "HeiseiKakuGo-W5"
pdfmetrics.registerFont(UnicodeCIDFont(fontname))
# End for Japanese

3.2 Around line 89
Change
canvas.setFont('Times-Bold', 14)
To
canvas.setFont('HeiseiMin-W3', 14)  # report coverpage top title

3.3 Around line 127
Change
stylesheet['Normal'] = styles.ParagraphStyle(
    'Normal',
    fontName='Times-Roman',   

To
stylesheet['Normal'] = styles.ParagraphStyle(
    'Normal',
    fontName='HeiseiMin-W3',  #fixes report coverpage "Author" for Japanese 
plus elsewhere I think...
----------------------------

4. In /usr/lib/python2.7/dist-packages/sdaps/report/buddies.py
Around line 56
Change
fontName='Times-Bold',

To
fontName='HeiseiMin-W3',  #fixes Japanese in subsubheadings eg. 1.2.1 xxxxx
----------------------------

Reply via email to