How to add a new font to Poster and Badge Designer

Hi
How to add a new font to Poster and Badge Designer to support the Arabic language.

Hey,

so, currently unfortunately we don’t support Arabic fonts in the Badge/Poster Designer. However I took a few minutes to see how complicated it would be to actually make it work. What I will present might work for you if you manage your own instance of Indico.

  1. The changes I applied to Indico:
diff --git a/indico/legacy/pdfinterface/base.py b/indico/legacy/pdfinterface/base.py
index 8b5554ad4e..d71b47d7a0 100644
--- a/indico/legacy/pdfinterface/base.py
+++ b/indico/legacy/pdfinterface/base.py
@@ -126,6 +126,7 @@ def setTTFonts():
         addMapping('LinuxLibertine', 1, 1, 'LinuxLibertine-Bold-Italic')
         pdfmetrics.registerFont(TTFont('Kochi-Mincho', os.path.join(font_dir, 'kochi-mincho-subst.ttf')))
         pdfmetrics.registerFont(TTFont('Kochi-Gothic', os.path.join(font_dir, 'kochi-gothic-subst.ttf')))
+        pdfmetrics.registerFont(TTFont('Geeza-Pro', os.path.join(font_dir, 'Geeza-Pro-Regular.ttf')))
         alreadyRegistered = True


diff --git a/indico/modules/designer/pdf.py b/indico/modules/designer/pdf.py
index e6e323bf7c..31d7249230 100644
--- a/indico/modules/designer/pdf.py
+++ b/indico/modules/designer/pdf.py
@@ -32,7 +32,8 @@ FONT_STYLES = {
     'LinuxLibertine': ['LinuxLibertine', 'LinuxLibertine-Bold', 'LinuxLibertine-Italic', 'LinuxLibertine-Bold-Italic'],
     'Kochi-Mincho': ['Kochi-Mincho', 'Kochi-Mincho', 'Kochi-Mincho', 'Kochi-Mincho'],
     'Kochi-Gothic': ['Kochi-Gothic', 'Kochi-Gothic', 'Kochi-Gothic', 'Kochi-Gothic'],
-    'Uming-CN': ['Uming-CN', 'Uming-CN', 'Uming-CN', 'Uming-CN']
+    'Uming-CN': ['Uming-CN', 'Uming-CN', 'Uming-CN', 'Uming-CN'],
+    'Geeza-Pro': ['Geeza-Pro', 'Geeza-Pro', 'Geeza-Pro', 'Geeza-Pro']
 }

 ALIGNMENTS = {
diff --git a/indico/modules/designer/templates/template.html b/indico/modules/designer/templates/template.html
index ed7a1bc58b..2d207bbcea 100644
--- a/indico/modules/designer/templates/template.html
+++ b/indico/modules/designer/templates/template.html
@@ -185,6 +185,7 @@
                                 <option>Kochi-Mincho</option>
                                 <option>Kochi-Gothic</option>
                                 <option>Uming-CN</option>
+                                <option>Geeza-Pro</option>
                             </optgroup>
                         </select>
                     </div>
  1. Then you need to make sure that Geeza-Pro-Regular.ttf ends up in the right directory. The fonts we are using are installed as a dependency (defined in requirements.txt) so you have two options here.

    • First Option - fork indico-fonts repo and add the font there. Then update requirements.txt so that pip installs your version of indico-fonts rather than the original indico-fonts
    • Second option - this is easier but more prone to future problems. Copy Geeza-Pro-Regular.ttf directly to the indico_fonts directory somewhere in the python2.7 site-packages.

Having done that I managed to have a fixed text field in my Badge template with Arabic text.

Regards,
Michal

1 Like

Thanks, I tried this solution and I received the following error messages:

Something went wrong

ValueError: Can’t map determine family/bold/italic for geeza-pro.

@kolodzie
could you please share with me the font Geeza-Pro-Regular.ttf.
still, I have a problem with Arabic font.

Thanks

Hey,

I just found it somewhere on the Internet. I think I got it from here http://fontsgeek.com/fonts/Geeza-Pro-Regular

1 Like

Thanks, The characters are written in LTR instead of RTL. Also,the characters are not connected to each other (It should be like “سلام” not “س ل ا م”).

Unfortunately, Indico is not yet ready for RTL languages hence these problems.

1 Like