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
On Do, 2015-07-16 at 04:21 +0000, Craig wrote:
> Benjamin Berg writes:
>
> > Never tested japanase (I tried some Arabic scripts at some point, but
> > that is ages ago). It may be that I gave up on generating the reportlab
> > based reports, and instead figured that it makes sense to just use the
> > LaTeX report (generated by report_tex).
> >
> > To make it easier to reproduce/find the issue (I am not entirely sure
> > what is still broken for you at this point), could you provide a small
> > example TeX questionnaire?
> >
> > Benjamin
>
> Hi Benjamin,
> Thank you for the reply. Below is a shortened version of the questionnaire
> I'm aiming to use. It has enough Japanese in each part to determine where it
> doesn't show up on the pdf.
>
> I just tried running report_tex and it also has encoding issues. Not a
> problem because the other command (report) is working fine after making the
> changes.
>
> Regards,
> Craig
> -------------------------------
> \documentclass[
> % Babel language, also used to load translations
> english,
> oneside
> ]{sdaps}
> % \usepackage[utf8]{inputenc}
> \usepackage{xeCJK}
> \setmainfont{TakaoExGothic}
>
> \author{金沢医科大学 KMU Course Completion Survey}
> \title{ME IV (4CD) 2015 - 英語でメディカルインタビュー}
>
> \begin{document}
> \begin{questionnaire}[noinfo]
>
> % Set checkbox style to be circular
> \def\checkboxstyle{ellipse}
> % There is a predefined "info" style to hilight some text.
> \begin{info}
> > > このアンケットは無名です。鉛筆で記入してください \checkbox*{}
> \filledbox{} \checkbox*{}: 間違ったら、消してください。
> \end{info}
>
> % Use \addinfo to add metadata (which is printed on the report later on)
> \addinfo{Date}{01.09.2015} % is this dd.mm.yyyy ?
>
> \section{コースについて About the Course} % <--This Japanese doesn't appear
> % Lets ask some questions.
> \singlemark{総合的に、 my learning experience in this course was...}{と
> ても良い}{とても悪い}
> \begin{markgroup}{このコースの...}
> \markline{構成と管理は...}{とても良い}{とても悪い}
> \markline{material was...}{too easy}{too difficult}
> \markline{work I had to do was...}{too much}{too little}
> \markline{assessment methods were...}{fair}{not fair}
> \markline{use of teaching tools was...}{helpful}{not helpful}
> \end{markgroup}
> \end{questionnaire}
> \end{document}
> -------------------------------
>
>
report_2.pdf
Description: Adobe PDF document
questionnaire.pdf
Description: Adobe PDF document
diff --git a/sdaps/defs.py b/sdaps/defs.py
index 24205de..6e20677 100644
--- a/sdaps/defs.py
+++ b/sdaps/defs.py
@@ -194,7 +194,7 @@ c128_chars = [chr(i) for i in xrange(32, 127)] #+ [u'È', u'É', u'Ê', u'Ë', u
# External commands =======================================
#: The binary used to compile latex documents.
-latex_engine = "pdflatex"
+latex_engine = "xelatex"
#: A function that is called after fork and before exec of the latex engine.
#: This is useful when e.g. the LateX environment should be secured.
diff --git a/sdaps/report/buddies.py b/sdaps/report/buddies.py
index 118594c..6e0b468 100644
--- a/sdaps/report/buddies.py
+++ b/sdaps/report/buddies.py
@@ -53,7 +53,7 @@ stylesheet['Question'] = styles.ParagraphStyle(
'Question',
stylesheet['Normal'],
spaceBefore=3 * mm,
- fontName='Times-Bold',
+ fontName='HeiseiMin-W3',
)
stylesheet['Text'] = styles.ParagraphStyle(
diff --git a/sdaps/template.py b/sdaps/template.py
index e22e8e0..779f0d0 100644
--- a/sdaps/template.py
+++ b/sdaps/template.py
@@ -29,6 +29,13 @@ from reportlab.lib import styles
from reportlab.lib import units
from reportlab.lib import pagesizes
+# 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
+
mm = units.mm
PADDING = 15 * mm
@@ -78,7 +85,7 @@ class TitlePageTemplate(platypus.PageTemplate):
def beforeDrawPage(self, canvas, document):
canvas.saveState()
- canvas.setFont('Times-Bold', 24)
+ canvas.setFont('HeiseiMin-W3', 14) # report coverpage top title
canvas.drawCentredString(
document.width / 2.0,
document.height - 50 * mm,
@@ -118,7 +125,7 @@ stylesheet = dict()
stylesheet['Normal'] = styles.ParagraphStyle(
'Normal',
- fontName='Times-Roman',
+ fontName='HeiseiMin-W3', #fixes report coverpage "Author" section for
fontSize=10,
leading=14,
)
signature.asc
Description: This is a digitally signed message part
