images using fonts from King Fahed Complex / qurancomplex.org
بسم الله الرحمن الرحيم In the name of Allah, Most Gracious, Most Merciful
These are a set of scripts that generate Quran page images based on the old madani fonts provided by the King Fahd Quran Complex in Saudi Arabia. They are currently being used in quran.com and its mobile apps.
This script outputs images, and also updates a database with the bounds of each of the generated glyphs (allowing apps to highlight individual words or verses).
The code is copyleft GPL (read: free) but the actual fonts and pages (in the
res/fontsdirectory) belong to the King Fahd Quran Complex in Saudia Arabia
Following prerequisites are required before instructions below can work. I tried this on my windows box (no reason to believe it will not work on other platform as long as you use the right tools for this platform)
Now you should be good to go with the following instructions
perl Makefile.PL make make install mysql -u root -p your_password < sql/schema.sql mysql -u root -p your_password < sql/database.sql mysql -u root -p your_password -e "create user 'nextgen'@'localhost' identified by 'nextgen'" mysql -u root -p your_password -e "grant all privileges on nextgen.* to 'nextgen'@'localhost'" mysql -u root -p your_password -e "flush privileges"
Build and run services (mysql and perl libs):
docker-compose up -d
To run scripts (see Usage section below) use the
docker-compose run gen /app/script/generate.pl --output ./output/ ... docker-compose run gen zopflipng --prefix=comp/ ... ./output/*.png
Stop sevices when done:
Note that mysql data is persisted on the host as a docker volume. You must set the
--outputoption value to
./output/to persist the output on the host machine. Any other output path will be local to the container.
generate page 50 with a width of 1300:
./script/generate.pl --width 1300 --output ./output/ --pages 50
generate pages 1 through 3 with a width of 1300:
./script/generate.pl --width 1300 --output ./output/ --pages 1..3
zopflipng --prefix=out/ --lossy_transparent --lossy_8bit --splitting=2 --iterations=100 *.png
For generating ayah by ayah images, see our legacy branch