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.
- 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>
-
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 inrequirements.txt
) so you have two options here.- First Option - fork
indico-fonts
repo and add the font there. Then updaterequirements.txt
so thatpip
installs your version ofindico-fonts
rather than the originalindico-fonts
- Second option - this is easier but more prone to future problems. Copy
Geeza-Pro-Regular.ttf
directly to theindico_fonts
directory somewhere in thepython2.7
site-packages.
- First Option - fork
Having done that I managed to have a fixed text field in my Badge template with Arabic text.
Regards,
Michal
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
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.