Added option to display Surah Header and Skip BismiLlah - #20
Conversation
…urah-header-margin-top 200 --skip-start-bismillah
ashaltu
left a comment
There was a problem hiding this comment.
Assalamu alaykum,
JazzakAllahu Khair for the changes and your patience, things are a bit untidy. Some other notes:
- Update the README with the new CLI flags.
- Include an [Unreleased] section in CHANGELOG.md. Here is an example commit (it doesn't have to be verbose like this, short and sweet is fine): 6cb9df1
- Since there isn't complete testing setup, can you list out the different commands you ran to test edge cases. Screenshots are helpful too and save a bunch of time reviewing, otherwise I'll just manually re-run each command to verify.
There was a problem hiding this comment.
Can we not include this in the repo? Imagine every language added in the future we have more than one font for it, it'll bloat the repo. Although, if this font is better in general for Urdu (in your opinion) than whats present, I'm fine if you replace it.
To be honest, this is related to a general problem that needs to be addressed, which is how much and what data to serve. Do you think including all fonts in the data.tar makes most sense rather than in the repo?
| "_comment": "Video dimensions and quality", | ||
| "width": 1280, | ||
| "height": 720, | ||
| "width": 720, |
There was a problem hiding this comment.
Could you keep the default as 1280x720?
| "size": 70, | ||
| "color": "FFFFFF" | ||
| }, | ||
| "translationFont": { |
There was a problem hiding this comment.
Likewise keep English translation font as the default config.json values?
|
|
||
| // Load surahHeaderFont configuration | ||
| if (data.contains("surahHeaderFont") && data["surahHeaderFont"].is_object()) { | ||
| cfg.surahHeaderFont.family = data["surahHeaderFont"].value("family", cfg.arabicFont.family); |
There was a problem hiding this comment.
- Removed the 'surahHeaderFont' section that was previously added in 'config.json'. The project now uses consistent Arabic Surah names as headers.
- Added 'ar.json' in 'data/surah-names' for Surah headers. This fixes issues where Surah names were not rendering correctly due to text/font incompatibility.

| const std::string& localAudioPath, | ||
| bool skipStartBismillah) { | ||
|
|
||
| if (skipStartBismillah) { |
There was a problem hiding this comment.
Is this needed? From what it looks like, your changes in LiveApiClient.cpp alter the condition to be options.surah != 1 && options.surah != 9 && !options.skipStartBismillah, so skipStartBismillah here will always be false (except maybe in the unit tests).
Also, I'm not sure if the following problem is occurring because of this line or another line, but when I generate for Surah Fatiha using ./build/qvm 1 1 7 --skip-start-bismillah or any other verse range in that surah, it shows the verse number twice:

|
|
||
| ass_file << "Dialogue: 0," << format_time_ass(header_start_time) << "," | ||
| << format_time_ass(total_video_duration) | ||
| << ",Translation,,0,0,0,,{\\an8\\pos(" << config.width/2 << "," << header_y_position << ")" |
There was a problem hiding this comment.
You are using Translation here, so the final video shows the Translation font, this probably the source of the bug mentioned in the other comment. Did you mean to use the Arabic font, especially since there's a bunch of logic above where you write out the Surah in Arabic.
Alternatively, if you really do want the surah in the translation font, you can utilize the jsons in data/misc and data/surah-names. The util functions to access that stuff is in localization_utils.cpp.
2. Updates related to the new translation:
* Updated 'quran_data.h' for French translation (id = 5).
* Updated 'numbers.json' in 'data/misc'.
* Updated 'surah.json' in 'data/misc'.
* Added translation file 'fr-hamidullah-clean.json' in 'data/translations/fr/'. Translation got from tanzil.net
3. Added CLI parameter '--show-surah-header'.
4. Added CLI parameter '--surah-header-font-size'.
5. Added CLI parameter '--surah-header-margin-top'.
6. Added CLI parameter '--skip-start-bismillah'.
7. Added CLI parameter '--translation-font-size'.
8. Added CLI parameter '--translation-font-color'.
9. Updated 'ur-fatah-muhammad-jalandhari-simple.json' in 'data/translations/urd' to fix brackets and exclamation marks so they render correctly with the Urdu font.
10. Changed the default/fallback font from 'American Captain.ttf' to 'Roboto-Regular.ttf'.
11. Added 'Roboto-Regular.ttf' in 'assets/fonts' to be used as a common font for French, English, and other LTR languages.
12. Removed 'family' and 'size' from the 'translationFont' section in 'config.json'. These are now read from 'quran_data.h' depending on whether the translation language is LTR or RTL.
13. Removed the 'surahHeaderFont' section that was previously added in 'config.json'. The project now uses consistent Arabic Surah names as headers.
14. Added 'ar.json' in 'data/surah-names' for Surah headers. This fixes issues where Surah names were not rendering correctly due to text/font incompatibility.
15. Set the default video dimension and quality to '720x1280' (portrait), which was required for my use case (social media).
16. Changed the output MP4 filename format to:
'Surah - [SurahNumber]_[StartAyat]_[EndAyat] - [Surah Name] - t[TranslationId]_r[ReciterId].mp4'
Example: 'Surah - 44_10_10 - Ad-Dukhan - t4_r25.mp4'
17. Fixed an issue where two Ayah numbers were being displayed.
|
Salaam, I sincerely apologize for getting back so late, as I did not get the time to work on this or properly follow your advice. Unfortunately, it is not feasible for me due to my extremely busy schedule, and I cannot provide any commitment at this time. I used and modified this project for my specific requirements, but the changes may not meet your well-defined coding standards or documentation expectations. Also, I am not very well-versed in C++ anymore, as it has been over 15–20 years and many things have changed since then. However, I have committed some of my enhancements and listed the functions and changes I added below. If you find any of them useful when comparing with your commits, please feel free to incorporate them in whatever way you think is best. Also, feel free to let me know if I can help in any way. As mentioned, however, I may not be able to provide any firm commitment due to my current engagements. Changes and additions:
Some of the changes are specific to my own requirements and may not be suitable for the main project (for example, portrait video mode or the output filename format I use for my automation). Please feel free to ignore those if they are not relevant. e.g. CLI Urdu ./build/qvm.exe 1 1 7 --reciter 25 --translation 4 --translation-font-size 55 --translation-font-color FFFFFF --show-surah-header --surah-header-font-size 50 --surah-header-margin-top 100 --skip-start-bismillah French |
…mes, compressed as data.zip




CLI = --show-surah-header --surah-header-font-size 40 --surah-header-margin-top 200
config.json =
"surahHeaderFont": {
"family": "Alvi Nastaleeq",
"file": "fonts/Alvi Nastaleeq Regular.ttf",
"size": 50,
"color": "FFFFFF"
},
CLI = --skip-start-bismillah