New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ClickableSpan support in widget #2
Comments
وعلیکم السلام ورحمة اللہ وبرکاتہ I have added experimental support for hit testing. So your above example should work by modifying to something like this:
|
جزاك الله خيراً |
Sorry for the mishaps. As of now, lines are being manually created in label widget. Eventually, they will be replaced by a single I implemented a quick solution for hit test by calculating line positions beforehand. Apparently, change in gravity did not request re-layout. Maybe that's what caused glitches. I have pushed a fix for this case. Hopefully it will resolve the issue. For performance, you might want to use typesetters instead of spanned strings. Also, make sure to run the app in release mode. |
السلام علیکم ورحمة الله وبرکاته |
وعلیکم السلام ورحمة اللہ وبرکاتہ |
السلام عليكم ورحمة الله وبركاته Thank you for your effort and fast fix. Source of tajweed markup i have originally was this: https://github.com/GlobalQuran/data/blob/master/Quran/quran-tajweed.txt Which was using tanzil.net text - seems like it was variant of Uhthmanic script with rub-el-hizb, but not version with different tanween shapes support. Then i've got xml markup from it with some simple scripts. Bi`izniLLahi i've done support for different tanween shapes in almost all fonts i have. I think it's worth to make inshaa Allah new markup using text with different tanween shapes support from tanzil.net May be you have some ideas how to improve markup or is it possible to enhance color support in ligatures. Actually i want for you brother to participate in such task: inshaa Allah prepare/impove data/markup to use with your good library to display as correct as possible Mushaf with tajweed rules. It may become inshaa Allah as useful as tanzil.net prepared text. If you interested i'm ready to share markup |
وعلیکم السلام ورحمة اللہ وبرکاتہ Maybe I'm missing something but I have not been able to color tajweed rules in tanzil.net. Please note that individual characters cannot be recognized in a ligature. The best a font developer can do is provide advance width for each character in Ligature Caret List Table table. But even this table is optional and might not work correctly if characters are overlapping, such as a lam-alef ligature. Things get more complicated when a component of a ligature has marks on it, such as lam-fatha-alef. In this case, all three characters will form a cluster of two glyphs, lam-alef ligature and fatha mark. So they will no longer be individually recognizable. Having said all that, there are definitely ways of improvement. Currently, SheenFigure only provides character to glyph mapping based on clusters. I can add the ability for glyph to character mapping as well, based on actual characters. This way, marks would become recognizable in a cluster. For ligatures, Ligature Caret List Table can be utilized if available. Otherwise, individual character width can be approximated simply by dividing ligature width with total number of components. Then in Tehreer-Android, an algorithm would be integrated to make ligature splitable runs and finally the ability to draw parts of ligature by clipping. The process is complex, but I can add these features one by one. It might take a long time, so don't get your hopes high. Alternatively, you may update the fonts by converting all ligatures to individual glyphs along with their substitution and positioning rules. |
السلام عليكم ورحمة الله وبركاته |
وعلیکم السلام ورحمة اللہ وبرکاتہ You have started a noble project and it would be an honor to work on it. But it would be too difficult for me to maintain these many projects. Maybe you can open source this project and one day I might start contributing in it with pull requests. As of now, my top priority is the addition of missing features in SheenFigure and Tehreer-Android. Regarding font technologies, AAT seems to be fully supported on apple devices only. So it would be better to use OpenType instead. This link will be of interest to you: https://www.adobe.com/devnet/opentype/afdko/topic_overview.html |
Hit testing can be performed with |
السلام علیکم ورحمة الله وبرکاته |
وعلیکم السلام ورحمة اللہ وبرکاتہ The creation of typesetter is an expensive operation. It runs different operations on text such as Line Breaking, BiDi, Span Handling and OpenType Shaping. So if you can lazy create typesetters and cache them for later use, that would increase the performance. But of course, you need to make sure first if there are performance issues. |
السلام علیکم ورحمة الله وبرکاته
Brother please consider implementing this useful feature, use cases include support of clicking on individual word, having some links with references etc
As of now widget doesn't have ClickableSpan support to use something like this:
static View.OnTouchListener ssilkaToch = new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { boolean ret = false; CharSequence text = ((TextView) v).getText(); Spannable stext = Spannable.Factory.getInstance().newSpannable(text); TextView widget = (TextView) v; int action = event.getAction();
My use case is support of clicking on individual word and get it recitated or meaning searched through dictionary. Also needed setLineSpacing
Thank you for your effort and support
The text was updated successfully, but these errors were encountered: