[Koha] Printing spine labels in non-Roman characters, Thai in particular
David Cook
dcook at prosentient.com.au
Tue Feb 25 12:52:48 NZDT 2025
Sawasdee krub Fred and Michael,
I went on this journey back in 2022 with a library in Hong Kong to get the Label Creator to create PDFs that contained Traditional Chinese. I'll try to explain the process I went down (and how it might be different for you now).
In koha-conf.xml you'll find a "ttf" section which lists a number of TrueType Font files which get paired up to font types that you'll see in the Label Creator. From memory, the DejaVu font covers a number of scripts like Latin, Greek, Cyrillic, Arabic, and I think Hebrew. Maybe even Devanagari. But they don't for Chinese and Japanese, and I suspect they don't for Thai either. (You can double-check by using the program FontForge to view the font files as glyphs mapped against Unicode code points.)
What this means is that you need to use a font that supports the Thai script like "Noto Sans Thai".
Most importantly, you need to use a TrueType Font file (.ttf) for this font. Once you have it, you put it on your server, and change the mapping in koha-conf.xml to point to it.
Now... in my case with NotoSansTC-Regular, I don't think there was a TrueType Font file available at that time. Google only provided OTF files and the "fonts-noto-cjk" Linux package only provided TTC files, and the PDF::Reuse library couldn't handle either of those. What I had to do was open the NotoSansTC-Bold.otf in FontForge, flatten the OTF subfonts into one font, re-encoded to UnicodeBMP, and then add in glyphs for "space" and "hyphen" as they'd mysteriously vanished. I then exported as TTF, and I had a file that worked for printing Traditional Chinese in the Koha Label Creator!
These days, it looks like Google supplies .ttf files from their website, so I think that you should be able to just download Noto Sans Thai, map it in koha-conf.xml, and have success. (Note that I have not tried it though.)
Something to remember is that typically Noto Sans fonts also include the Latin script, so you'll have support for both English and Thai.
Alternatively, you can use Bywater's Koha plugin koha-plugin-label-maker which leverages your browser and your system's installed fonts to render many different scripts. This is probably the most robust option, but for Koha built-in features and where you need support for a particular language that isn't supported by the DejaVu font... the above should work.
(If you were so inclined, a person could technically make a font with an assemblage of all the scripts they need to support, but it would take some work and technical knowledge.)
Anyway, I hope that answers most of your questions!
David Cook
Senior Software Engineer
Prosentient Systems
Suite 7.03
6a Glen St
Milsons Point NSW 2061
Australia
Office: 02 9212 0899
-----Original Message-----
------------------------------
Message: 4
Date: Mon, 24 Feb 2025 21:47:39 +0000
From: "King, Fred" <Fred.King at Medstar.net>
To: koha <koha at lists.katipo.co.nz>, Michael Leung <ykleung7 at msn.com>,
"koha-US list" <koha-us at koha-us.org>
Subject: [Koha] Printing spine labels in non-Roman characters, Thai in
particular
Message-ID:
<PH7PR13MB5504FD89C93E444ACC88FB8EE3C02 at PH7PR13MB5504.namprd13.prod.outlook.com>
Content-Type: text/plain; charset="us-ascii"
Hello everybody,
A while back I helped an institution in Thailand set up a Koha instance for their library. Now they need to print spine labels in the Thai alphabet, and I haven't been able to figure out how. I set up their instance to include the Thai language module, but the characters aren't appearing in spine labels. Can anyone assist them? I don't think they're on the Koha discussion list (or Mattermost), so please include Michael Leung ykleung7 at msn.com<mailto:ykleung7 at msn.com> in your replies. (And to the list--I want to know, too!)
Thanks to all,
--Fred
Fred King, MSLS, AHIP; he, him
Medical Librarian, MedStar Washington Hospital Center
fred.king at medstar.net
202-877-6670
ORCID 0000-0001-5266-0279
MedStar Authors Catalog: http://medstarauthors.org
I don't know why people expect art to make sense when they accept the fact that life doesn't make sense.
--David Lynch
------------------------------
Subject: Digest Footer
_______________________________________________
Koha mailing list
Koha at lists.katipo.co.nz
https://lists.katipo.co.nz/mailman/listinfo/koha
------------------------------
End of Koha Digest, Vol 232, Issue 19
*************************************
More information about the Koha
mailing list