Bug 12832 - Basketgroup printing doesn't support non-latin characters
Summary: Basketgroup printing doesn't support non-latin characters
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Karam Qubsi
QA Contact: Testopia
URL:
Keywords:
Depends on: 11944 13596
Blocks:
  Show dependency treegraph
 
Reported: 2014-08-27 14:22 UTC by Zeno Tajoli
Modified: 2017-01-19 03:47 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
This patch will use DejaVuSans.ttf font instead of Times to support non-Latin characters (5.71 KB, patch)
2016-12-29 17:21 UTC, Karam Qubsi
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Zeno Tajoli 2014-08-27 14:22:07 UTC
If you create an order with nolatin chars in the title, and put in in a basket and after ina basketgroup, if you try to print the basketgoup the tiltle is not present in pdf.

If you export as CSV the basketgrouo closed, the title is present.

This bug could be connect with a wrong setup of tff files in koha-conf.xml.

Now the bug is visible in sandbox 15 (http://pro.test15.biblibre.com).
Comment 1 Jonathan Druart 2014-08-27 14:41:53 UTC
This bug exists in master but it should be fixed on top of bug 11944.

I will try to provide a patch when bug 11944 will be pushed.
Comment 2 Mathieu Saby 2014-08-27 18:04:36 UTC
I struggled with that 2 years ago with no result.
My idea was that the perl module used to generate the Table in PDF (PDF::Table) is responsible for that (If the non latin chars are in the libray name for example, they can be printed), but maybe I was wrong...

Mathieu Saby
Comment 3 Dobrica Pavlinusic 2016-01-07 15:11:26 UTC
I don't think that it's enough to just add utf-8 encoding to $pdf->corefont.

Just as with labels, we need to use true type fonts here to support all available utf-8 characters (otherwise western utf-8 characters work, but Croatian for example don't).

Replacing

$pdf->corefont("Times", -encoding => "utf8")

with something like

$pdf->ttfont('/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf')

will nicely fix this problem (but also somewhat break tables which are created using PDF::Table, I will have to investigate this a bit more).

But, now I'm wondering if we should use same <ttf> mapping from koha-conf.xml which we use for labels (if available)?
Comment 4 Karam Qubsi 2016-12-29 17:21:55 UTC
Created attachment 58503 [details] [review]
This patch will use DejaVuSans.ttf font instead of Times to support non-Latin characters


This patch will use DejaVuSans.ttf font instead of Times and this will
support the non-Latin characters I tested it with Greek text and Arabic
text and it worked  for Arabic texts I added Text::Bidi to support
direction of text until now the arabic text characters appears but not
connected as it should be .

Test plan :
Create a basket group with metadata that include non-latin characters
close and export the group  the titles will not appear .
apply the patch
re export the pdf file , you should find the text appear for the items

I used google translate to get Greek text you might use it as will
Title :       αυτό είναι ένα τίτλο ενός βιβλίου
Author : συγγραφέας

Arabic :
Title : عنوان بالعربي
author : مؤلف
---
Comment 5 Caitlin Goodger 2017-01-19 03:47:39 UTC
I was able to apply the patch after fixing a merge conflict. 
CONFLICT (content): Merge conflict in acqui/pdfformat/layout3pages.pm

With the patch exporting basketgroups with no latin characters in the title of an order doesn't work but exporting other basketgroups does.