Comments (23)
It's a well known issue and I could not find a universal solution. But I'll leave it open until I provide a way to solve it.
from quranapp.
@faisalcodes Uthmani Hafs font's verse count (double digit) is not consistent like other fonts
example
IndoPak (13) ---- Hafs (31) ----- King Fahd complex V1 (13)
|_____> It seems using Left to Right (Expected: Right to Left)
from quranapp.
I have explicitly reversed the order because on some phones, only reversing works and on others it does not. I think I should provide a button which should be used to fix the order.
from quranapp.
@faisalcodes On which android versions , you have seen this bug?
On Android 11, the count is rendering as expected
from quranapp.
It is a brand specific issue.
from quranapp.
I am using Redmi 9t
from quranapp.
I tested on a Redmi Android 10 and it works.
from quranapp.
Have you tried using .ttf hafs font?
Link: https://github.com/mustafa0x/qpc-fonts
from quranapp.
Tried all of them but had no luck. The same font is found everywhere.
from quranapp.
#210 (comment) relates to harfbuzz/harfbuzz#501
from quranapp.
But the behaviour is different on different mobile brands. Some support RTL numbering and others LTR.
from quranapp.
Most likely the phones with bad rendering ship with old versions of HarfBuzz
from quranapp.
I think that too.
from quranapp.
My doubt is that Android 12-> 13 has this issue
so I modified existing script json to "end": "٠١"}
, number render correctly on Android 13 , but broke Android 11
Further Test need to be done on emulators like Android 12, 12L (Emulator from Android Studio are very slow on my Laptop :( .)
My theory is that to make another json script file for android 12+ devices which contains verse count with zeros like here "end": "٠١"}
and existing file works on Android 11 and below
Application should choose .json file based Android Version
from quranapp.
@Luciogi
If the issue is specific to Android Version then it can be solved easily. There is no need to create two different json files as I have done the reversing of numbers manually with following code:
from quranapp.
For this solution hafs font numbers should in RTL like 21
from quranapp.
I would like to see you create new branch to test this solution
from quranapp.
But I doubt that it's the Android version. I tested on an Android 12 phone and it does not work without reversing. It seems to be an issue of phone brands as stated by khaledhosny earlier:
Most likely the phones with bad rendering ship with old versions of HarfBuzz
from quranapp.
Can I get reversing code ?
from quranapp.
Yes, it' here:
from quranapp.
index 47ad86d..ef8bdb6 100644
--- a/app/src/main/java/com/quranapp/android/utils/verse/VerseUtils.java
+++ b/app/src/main/java/com/quranapp/android/utils/verse/VerseUtils.java
@@ -30,6 +30,8 @@ import java.time.Duration;
import java.util.Calendar;
import java.util.Random;
+import android.os.Build;
+
public abstract class VerseUtils {
private static final int VOTD_RESET_MINUTES = 24 * 60; // one day
private static int VOTD_chap_no = -1;
@@ -109,7 +111,12 @@ public abstract class VerseUtils {
boolean shouldReverse,
int verseTextSize
) {
- CharSequence text = shouldReverse ? new StringBuilder(serialText).reverse().toString() : serialText;
+ CharSequence text;
+ if (Build.VERSION.SDK_INT >= 33)
+ text = serialText;
+ else
+ text = new StringBuilder(serialText).reverse().toString();
+ // CharSequence text = shouldReverse ? new StringBuilder(serialText).reverse().toString() : serialText;
SpannableString verseNoSpannable = new SpannableString(text);
// Set the typeface to span over verse number text
Test this patch with android 12 and 10
Edit: This code Worked fine on Android 11 , 13 and Android 14(Preview)
Android SDK/API LEVELS: https://support.google.com/googleplay/android-developer/answer/11926878?hl=en
- Please test if my changes does not affect other fonts
from quranapp.
So, by default the number is rendered properly on API >=33 only?
from quranapp.
Summary: Below Android 13, Font was not rendered as RTL (rather it was using LTR), So Developer reversed as a hack. Which created above issue on , Android 13 >=, it renders RTL as expected.
🙃
from quranapp.
Related Issues (20)
- Toggle button to change view mode (Translation view to Page view) HOT 2
- App Crashing when downloading translation HOT 10
- Bookmark Page view not working HOT 1
- Tajweed pronunciation, external storage downloads HOT 2
- Add History remove button HOT 1
- Add 'Search with arabic/urdu keyboard ' from Qur'an. HOT 1
- Loadtafsir HOT 3
- Option to Hide Arabic text. HOT 1
- Ability to share verse with bookmark note HOT 4
- Issue when trying to share a verse again HOT 1
- Font for Arabic Tafsir HOT 2
- Surahs Auto-next function not working during recitation HOT 1
- French audio translation HOT 6
- Crashes when downloading translations HOT 2
- Some issue HOT 4
- What is usesCleartextTraffic needed for? HOT 6
- Crash when starting audio HOT 3
- java.util.ConcurrentModificationException HOT 1
- add: Tafsir, Hadith, Sīrah, Qisas al-Anbiya, Masnavi HOT 1
- Help and enhancement HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quranapp.