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
coloured text rendering #1
Comments
وعلیکم السلام ورحمة اللہ وبرکاتہ I considered adding support for spans while developing the library. But it is not as simple. There are some technical hurdles and some ground work needs to be done first. For example, android spans API is locked to platform paint class for customization. There is no way to inject Tehreer typefaces in it and even if there is, platform canvas cannot use it. So I need to find a suitable solution for this problem before implementation. Until then, you can manually create Typesetter objects, extract ComposedLine from it, search glyph range for black/red text in GlyphRun, and draw the glyphs with Renderer class. You can explore the source code of TLabel class for reference. |
ماشاء الله |
وعلیکم السلام ورحمة اللہ وبرکاتہ You are right. The bug must be in SheenFigure. I'll definitely look into it. |
The issue has been fixed in |
بارك الله فيكم First comes stock android textview for comparison. This tool is useful to analyze what glyphs string contains (page may be saved to work offline with chrome for example) Thinking as a good goal and ultimate test for your library - correctly render Mushaf, at least without big errors like this when harakat stays almost in place where previous is sitting. Quite sure it's all fonts fault need to investigate further... |
I have investigated the issue and mark-to-mark positioning implementation turned out to be the culprit. It handled glyphs even when they belonged to different components of a ligature. And so harakats were placed on one another causing the glitch. The open type spec does not say anything about this specific case. But from the behaviour of different browsers, it seems standard approach to suppress mark-to-mark positioning across different components of a ligature. I have pushed the fix in |
جزاك الله خيراً |
I have revised the logic of finding base glyph for mark attachments. It fixes glitches of "KFGQPC Uthmanic Script HAFS" as well as "Al Qalam Quran Majeed" font. "_PDMS_Saleem_QuranFont" was breaking due to another reason. It uses anchor table format 3 whose support was not added in SF as it depends on device table. Since all anchor formats have common design units requirements, I have used same implementation for format 2 and 3. But the position of glyphs may be off by some units. Let me know your findings on latest SF commit. |
جزاك الله خيراً |
Made mark to base attachment work with only first glyph of base in case of multiple substitution sequence. It fixes glitches of 'Traditional Arabic' font as well. From the findings of reported scenarios, it seems that all mark to * attachments should be based on actual characters and not the glyph string as mentioned in open type specification. But more research is required to prove this possibility. |
جزاك الله خيراً |
Made Arabic engine explicitly set advance of all marks zero at the end of positioning. It fixes both test cases. |
Support for many of android's spans has been added in version 2.1. Please see the release notes for details. |
as-Salamu alaykum wa rahmatuLLahi wa barakatuh.
Brother please consider implementing coloured rendering in widget like regular textview does when applying setText with formatted strings like this:
<item><![CDATA[<br>some <font color="#00ff00">couloured</font> text]]></item>
<item><![CDATA[<br><font color="#2693ff">another</font> one]]></item>
Due to lack of knowledge of android internals and java in general i've only done partial demo app modification. Now it's accepting formatted strings like above example.
Here is gist with patch and images https://gist.github.com/AbdullahRusi/0a55169396653a06db3452ba79c7f4dd
As seen on screenshots standart textview lacks of good font rendering/shaping engine.
It produce many artifacts(broken ligatures, marks not on right places).
Your excellent library does that part (shaping and rendering glyphs) very well (besides vertical line).
On desctop firefox browser is correctly rendering that formatted text. As i know it uses Harfbuzz or something, so it's good.
so it may become very useful for many Muslims and big sawab(ajr) for you inshaaLLah
The text was updated successfully, but these errors were encountered: