[Koha] Printing spine labels in non-Roman characters, Thai in particular
David Liddle
david at liddles.net
Thu Feb 27 09:17:23 NZDT 2025
Thank you, David, for chiming in with immensely useful information! I
manage another system with which Michael is familiar, and your contribution
has helped me understand it better. (I came into administration of this
server only a few years ago. At one point, I discovered that there is a
crazy number of font packages installed, and I wasn't sure why.)
Michael, if it helps, the Debian package "fonts-unifont" is installed on
our server. The relevant section of "koha-conf.xml" reads as follows:
<!-- true type font mapping according to type from $font_types in
C4/Creators/Lib.pm -->
<ttf>
<font type="Ft1" >/usr/share/fonts/truetype/unifont/unifont.ttf</font>
<font type="Ft2"
>/usr/share/fonts/truetype/unifont/unifont_upper.ttf</font>
<font type="TR"
>/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf</font>
<font type="TB"
>/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-Bold.ttf</font>
<font type="TI"
>/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-Italic.ttf</font>
<font
type="TBI">/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-BoldItalic.ttf</font>
<font type="C" >/usr/share/fonts/truetype/unifont/unifont.ttf</font>
<font type="CB"
>/usr/share/fonts/truetype/unifont/unifont_upper.ttf</font>
<font type="CO"
>/usr/share/fonts/truetype/unifont/unifont_csur.ttf</font>
<font
type="CBO">/usr/share/fonts/truetype/unifont/unifont_csur.ttf</font>
<font type="H" >/usr/share/fonts/truetype/unifont/unifont.ttf</font>
<font type="HB"
>/usr/share/fonts/truetype/unifont/unifont_upper.ttf</font>
<font type="HO"
>/usr/share/fonts/truetype/unifont/unifont_csur.ttf</font>
<font
type="HBO">/usr/share/fonts/truetype/unifont/unifont_csur.ttf</font>
</ttf>
I can't immediately explain the added entries, or why some of the default
types continue to use DejaVu. But if spine labels work in Thai from there,
then perhaps the same or similar configuration will work for the system you
and Fred have put together.
All the best,
David Liddle
System Administrator
On Tue, Feb 25, 2025 at 12:52 AM David Cook <dcook at prosentient.com.au>
wrote:
> 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
> *************************************
>
> _______________________________________________
>
> Koha mailing list http://koha-community.org
> Koha at lists.katipo.co.nz
> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
>
More information about the Koha
mailing list