Adding fonts to Koha for label creator
Hi all, How does one add fonts to Koha for the label creator? I'm curious about adding "Arial" ( or rather LiberationSans-Regular.ttf as matched by fc-match) and "Arial Bold" (or rather Roboto-Regular.ttf as matched by fc-match) to the Koha label creator. I see we have a hard-coded list of font types in C4/Creators/Lib.pm. There is also a list of TTF files in etc/koha-conf.xml. I could update both places, but I am wondering if that's enough. I've tried to read https://metacpan.org/release/PDF-Reuse/source/lib/PDF/Reuse.pm but the mix of English and Swedish makes progress a bit slow. Based on sub Font in C4/Creators/PDF.pm, I'm guessing that's it? David Cook Systems Librarian Prosentient Systems 72/330 Wattle St Ultimo, NSW 2007 Australia Office: 02 9212 0899 Online: 02 8005 0595
Hi David,
How does one add fonts to Koha for the label creator?
I’m curious about adding “Arial” ( or rather LiberationSans-Regular.ttf as matched by fc-match) and “Arial Bold” (or rather Roboto-Regular.ttf as matched by fc-match) to the Koha label creator.
I see we have a hard-coded list of font types in C4/Creators/Lib.pm. There is also a list of TTF files in etc/koha-conf.xml.
Changing paths in koha-conf.xml is enough, replacing entries for H and HB or any other. Bernardo
On Mon, May 4, 2020 at 6:25 AM Bernardo Gonzalez Kriegel < bgkriegel@gmail.com> wrote:
Hi David,
How does one add fonts to Koha for the label creator?
I’m curious about adding “Arial” ( or rather LiberationSans-Regular.ttf as matched by fc-match) and “Arial Bold” (or rather Roboto-Regular.ttf as matched by fc-match) to the Koha label creator.
I see we have a hard-coded list of font types in C4/Creators/Lib.pm. There is also a list of TTF files in etc/koha-conf.xml.
Changing paths in koha-conf.xml is enough, replacing entries for H and HB or any other.
Hard-coded fonts are effectively defaults. They are installed by a dependency (I don't recall which atm.). Substituting fonts is done as Bernardo pointed out. Chris
Thanks Chris and Bernardo for getting back to me so quickly. That’s good to know, although from the user experience point of view I don’t think that it’ll be sufficient, since it would still have the old font name in the web UI. I’ll take a deeper look today and report back. David Cook Systems Librarian Prosentient Systems 72/330 Wattle St Ultimo, NSW 2007 Australia Office: 02 9212 0899 Online: 02 8005 0595 From: Christopher Nighswonger <chris.nighswonger@gmail.com> Sent: Monday, 4 May 2020 10:51 PM To: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Cc: David Cook <dcook@prosentient.com.au>; koha-devel <koha-devel@lists.koha-community.org> Subject: Re: [Koha-devel] Adding fonts to Koha for label creator On Mon, May 4, 2020 at 6:25 AM Bernardo Gonzalez Kriegel <bgkriegel@gmail.com <mailto:bgkriegel@gmail.com> > wrote: Hi David, How does one add fonts to Koha for the label creator? I’m curious about adding “Arial” ( or rather LiberationSans-Regular.ttf as matched by fc-match) and “Arial Bold” (or rather Roboto-Regular.ttf as matched by fc-match) to the Koha label creator. I see we have a hard-coded list of font types in C4/Creators/Lib.pm. There is also a list of TTF files in etc/koha-conf.xml. Changing paths in koha-conf.xml is enough, replacing entries for H and HB or any other. Hard-coded fonts are effectively defaults. They are installed by a dependency (I don't recall which atm.). Substituting fonts is done as Bernardo pointed out. Chris
Thanks again for your help! I’ve tried your suggestion, and I tried adding options to C4::Creators::Lib with mappings in koha-conf.xml. Both ideas worked. For now, I think I’ll advise people to use your suggestion (and use Javascript to change the labels in the Staff client). I’ve opened a bug report (https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25384) to improve this in the future. I think I’ll even have a quick crack at it. Cheers, David Cook Systems Librarian Prosentient Systems 72/330 Wattle St Ultimo, NSW 2007 Australia Office: 02 9212 0899 Online: 02 8005 0595 From: Koha-devel <koha-devel-bounces@lists.koha-community.org> On Behalf Of dcook@prosentient.com.au Sent: Tuesday, 5 May 2020 9:21 AM To: 'Christopher Nighswonger' <chris.nighswonger@gmail.com>; 'Bernardo Gonzalez Kriegel' <bgkriegel@gmail.com> Cc: 'koha-devel' <koha-devel@lists.koha-community.org> Subject: Re: [Koha-devel] Adding fonts to Koha for label creator Thanks Chris and Bernardo for getting back to me so quickly. That’s good to know, although from the user experience point of view I don’t think that it’ll be sufficient, since it would still have the old font name in the web UI. I’ll take a deeper look today and report back. David Cook Systems Librarian Prosentient Systems 72/330 Wattle St Ultimo, NSW 2007 Australia Office: 02 9212 0899 Online: 02 8005 0595 From: Christopher Nighswonger <chris.nighswonger@gmail.com <mailto:chris.nighswonger@gmail.com> > Sent: Monday, 4 May 2020 10:51 PM To: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com <mailto:bgkriegel@gmail.com> > Cc: David Cook <dcook@prosentient.com.au <mailto:dcook@prosentient.com.au> >; koha-devel <koha-devel@lists.koha-community.org <mailto:koha-devel@lists.koha-community.org> > Subject: Re: [Koha-devel] Adding fonts to Koha for label creator On Mon, May 4, 2020 at 6:25 AM Bernardo Gonzalez Kriegel <bgkriegel@gmail.com <mailto:bgkriegel@gmail.com> > wrote: Hi David, How does one add fonts to Koha for the label creator? I’m curious about adding “Arial” ( or rather LiberationSans-Regular.ttf as matched by fc-match) and “Arial Bold” (or rather Roboto-Regular.ttf as matched by fc-match) to the Koha label creator. I see we have a hard-coded list of font types in C4/Creators/Lib.pm. There is also a list of TTF files in etc/koha-conf.xml. Changing paths in koha-conf.xml is enough, replacing entries for H and HB or any other. Hard-coded fonts are effectively defaults. They are installed by a dependency (I don't recall which atm.). Substituting fonts is done as Bernardo pointed out. Chris
Ok I have a patch at https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25384. I haven’t applied it locally, so I’m not super invested in this approach at this point. Open to feedback and testing! (Really I should add some unit tests to t/db_dependent/Creators/Lib.t and t/Creators.t as well to prove the configurability and not just default behaviour. Suppose I wanted to see first if people approved of the approach before finishing it 100%.) David Cook Systems Librarian Prosentient Systems 72/330 Wattle St Ultimo, NSW 2007 Australia Office: 02 9212 0899 Online: 02 8005 0595 From: Koha-devel <koha-devel-bounces@lists.koha-community.org> On Behalf Of dcook@prosentient.com.au Sent: Wednesday, 6 May 2020 11:37 AM To: 'Christopher Nighswonger' <chris.nighswonger@gmail.com>; 'Bernardo Gonzalez Kriegel' <bgkriegel@gmail.com> Cc: 'koha-devel' <koha-devel@lists.koha-community.org> Subject: Re: [Koha-devel] Adding fonts to Koha for label creator Thanks again for your help! I’ve tried your suggestion, and I tried adding options to C4::Creators::Lib with mappings in koha-conf.xml. Both ideas worked. For now, I think I’ll advise people to use your suggestion (and use Javascript to change the labels in the Staff client). I’ve opened a bug report (https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25384) to improve this in the future. I think I’ll even have a quick crack at it. Cheers, David Cook Systems Librarian Prosentient Systems 72/330 Wattle St Ultimo, NSW 2007 Australia Office: 02 9212 0899 Online: 02 8005 0595 From: Koha-devel <koha-devel-bounces@lists.koha-community.org <mailto:koha-devel-bounces@lists.koha-community.org> > On Behalf Of dcook@prosentient.com.au <mailto:dcook@prosentient.com.au> Sent: Tuesday, 5 May 2020 9:21 AM To: 'Christopher Nighswonger' <chris.nighswonger@gmail.com <mailto:chris.nighswonger@gmail.com> >; 'Bernardo Gonzalez Kriegel' <bgkriegel@gmail.com <mailto:bgkriegel@gmail.com> > Cc: 'koha-devel' <koha-devel@lists.koha-community.org <mailto:koha-devel@lists.koha-community.org> > Subject: Re: [Koha-devel] Adding fonts to Koha for label creator Thanks Chris and Bernardo for getting back to me so quickly. That’s good to know, although from the user experience point of view I don’t think that it’ll be sufficient, since it would still have the old font name in the web UI. I’ll take a deeper look today and report back. David Cook Systems Librarian Prosentient Systems 72/330 Wattle St Ultimo, NSW 2007 Australia Office: 02 9212 0899 Online: 02 8005 0595 From: Christopher Nighswonger <chris.nighswonger@gmail.com <mailto:chris.nighswonger@gmail.com> > Sent: Monday, 4 May 2020 10:51 PM To: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com <mailto:bgkriegel@gmail.com> > Cc: David Cook <dcook@prosentient.com.au <mailto:dcook@prosentient.com.au> >; koha-devel <koha-devel@lists.koha-community.org <mailto:koha-devel@lists.koha-community.org> > Subject: Re: [Koha-devel] Adding fonts to Koha for label creator On Mon, May 4, 2020 at 6:25 AM Bernardo Gonzalez Kriegel <bgkriegel@gmail.com <mailto:bgkriegel@gmail.com> > wrote: Hi David, How does one add fonts to Koha for the label creator? I’m curious about adding “Arial” ( or rather LiberationSans-Regular.ttf as matched by fc-match) and “Arial Bold” (or rather Roboto-Regular.ttf as matched by fc-match) to the Koha label creator. I see we have a hard-coded list of font types in C4/Creators/Lib.pm. There is also a list of TTF files in etc/koha-conf.xml. Changing paths in koha-conf.xml is enough, replacing entries for H and HB or any other. Hard-coded fonts are effectively defaults. They are installed by a dependency (I don't recall which atm.). Substituting fonts is done as Bernardo pointed out. Chris
The concept of your patch looks great, David. I'm sorry I can't test it at the moment. I did add a comment on your description in order to clarify the purpose of the 12 default fonts. Kind regards, Chris On Tue, May 5, 2020 at 9:37 PM <dcook@prosentient.com.au> wrote:
Thanks again for your help!
I’ve tried your suggestion, and I tried adding options to C4::Creators::Lib with mappings in koha-conf.xml. Both ideas worked.
For now, I think I’ll advise people to use your suggestion (and use Javascript to change the labels in the Staff client).
I’ve opened a bug report ( https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25384) to improve this in the future. I think I’ll even have a quick crack at it.
Cheers,
David Cook
Systems Librarian
Prosentient Systems
72/330 Wattle St
Ultimo, NSW 2007
Australia
Office: 02 9212 0899
Online: 02 8005 0595
*From:* Koha-devel <koha-devel-bounces@lists.koha-community.org> *On Behalf Of *dcook@prosentient.com.au *Sent:* Tuesday, 5 May 2020 9:21 AM *To:* 'Christopher Nighswonger' <chris.nighswonger@gmail.com>; 'Bernardo Gonzalez Kriegel' <bgkriegel@gmail.com> *Cc:* 'koha-devel' <koha-devel@lists.koha-community.org> *Subject:* Re: [Koha-devel] Adding fonts to Koha for label creator
Thanks Chris and Bernardo for getting back to me so quickly.
That’s good to know, although from the user experience point of view I don’t think that it’ll be sufficient, since it would still have the old font name in the web UI.
I’ll take a deeper look today and report back.
David Cook
Systems Librarian
Prosentient Systems
72/330 Wattle St
Ultimo, NSW 2007
Australia
Office: 02 9212 0899
Online: 02 8005 0595
*From:* Christopher Nighswonger <chris.nighswonger@gmail.com> *Sent:* Monday, 4 May 2020 10:51 PM *To:* Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> *Cc:* David Cook <dcook@prosentient.com.au>; koha-devel < koha-devel@lists.koha-community.org> *Subject:* Re: [Koha-devel] Adding fonts to Koha for label creator
On Mon, May 4, 2020 at 6:25 AM Bernardo Gonzalez Kriegel < bgkriegel@gmail.com> wrote:
Hi David,
How does one add fonts to Koha for the label creator?
I’m curious about adding “Arial” ( or rather LiberationSans-Regular.ttf as matched by fc-match) and “Arial Bold” (or rather Roboto-Regular.ttf as matched by fc-match) to the Koha label creator.
I see we have a hard-coded list of font types in C4/Creators/Lib.pm. There is also a list of TTF files in etc/koha-conf.xml.
Changing paths in koha-conf.xml is enough, replacing entries for H and HB or any other.
Hard-coded fonts are effectively defaults. They are installed by a dependency (I don't recall which atm.).
Substituting fonts is done as Bernardo pointed out.
Chris
Thanks for reviewing the patch and adding that comment, Chris. It is very appreciated. Perhaps Bernardo or someone else will be able to test and sign off. Happy to do more work on this one if necessary. David Cook Systems Librarian Prosentient Systems 72/330 Wattle St Ultimo, NSW 2007 Australia Office: 02 9212 0899 Online: 02 8005 0595 From: Christopher Nighswonger <chris.nighswonger@gmail.com> Sent: Wednesday, 6 May 2020 10:36 PM To: David Cook <dcook@prosentient.com.au> Cc: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>; koha-devel <koha-devel@lists.koha-community.org> Subject: Re: [Koha-devel] Adding fonts to Koha for label creator The concept of your patch looks great, David. I'm sorry I can't test it at the moment. I did add a comment on your description in order to clarify the purpose of the 12 default fonts. Kind regards, Chris On Tue, May 5, 2020 at 9:37 PM <dcook@prosentient.com.au <mailto:dcook@prosentient.com.au> > wrote: Thanks again for your help! I’ve tried your suggestion, and I tried adding options to C4::Creators::Lib with mappings in koha-conf.xml. Both ideas worked. For now, I think I’ll advise people to use your suggestion (and use Javascript to change the labels in the Staff client). I’ve opened a bug report (https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25384) to improve this in the future. I think I’ll even have a quick crack at it. Cheers, David Cook Systems Librarian Prosentient Systems 72/330 Wattle St Ultimo, NSW 2007 Australia Office: 02 9212 0899 Online: 02 8005 0595 From: Koha-devel <koha-devel-bounces@lists.koha-community.org <mailto:koha-devel-bounces@lists.koha-community.org> > On Behalf Of dcook@prosentient.com.au <mailto:dcook@prosentient.com.au> Sent: Tuesday, 5 May 2020 9:21 AM To: 'Christopher Nighswonger' <chris.nighswonger@gmail.com <mailto:chris.nighswonger@gmail.com> >; 'Bernardo Gonzalez Kriegel' <bgkriegel@gmail.com <mailto:bgkriegel@gmail.com> > Cc: 'koha-devel' <koha-devel@lists.koha-community.org <mailto:koha-devel@lists.koha-community.org> > Subject: Re: [Koha-devel] Adding fonts to Koha for label creator Thanks Chris and Bernardo for getting back to me so quickly. That’s good to know, although from the user experience point of view I don’t think that it’ll be sufficient, since it would still have the old font name in the web UI. I’ll take a deeper look today and report back. David Cook Systems Librarian Prosentient Systems 72/330 Wattle St Ultimo, NSW 2007 Australia Office: 02 9212 0899 Online: 02 8005 0595 From: Christopher Nighswonger <chris.nighswonger@gmail.com <mailto:chris.nighswonger@gmail.com> > Sent: Monday, 4 May 2020 10:51 PM To: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com <mailto:bgkriegel@gmail.com> > Cc: David Cook <dcook@prosentient.com.au <mailto:dcook@prosentient.com.au> >; koha-devel <koha-devel@lists.koha-community.org <mailto:koha-devel@lists.koha-community.org> > Subject: Re: [Koha-devel] Adding fonts to Koha for label creator On Mon, May 4, 2020 at 6:25 AM Bernardo Gonzalez Kriegel <bgkriegel@gmail.com <mailto:bgkriegel@gmail.com> > wrote: Hi David, How does one add fonts to Koha for the label creator? I’m curious about adding “Arial” ( or rather LiberationSans-Regular.ttf as matched by fc-match) and “Arial Bold” (or rather Roboto-Regular.ttf as matched by fc-match) to the Koha label creator. I see we have a hard-coded list of font types in C4/Creators/Lib.pm. There is also a list of TTF files in etc/koha-conf.xml. Changing paths in koha-conf.xml is enough, replacing entries for H and HB or any other. Hard-coded fonts are effectively defaults. They are installed by a dependency (I don't recall which atm.). Substituting fonts is done as Bernardo pointed out. Chris
participants (3)
-
Bernardo Gonzalez Kriegel -
Christopher Nighswonger -
dcook@prosentient.com.au