How to render an arabic character in OpenGL? - visual-studio

I am able to display chinese character correctly but when I try to display arabic string the output that display in OpenGL scene is different from the arabic string that display in Visual Studio Editor. I know it should be something to do with "Complex Script" but I am not able to find any good example regarding to this matter. I would like to know how to display arabic text correctly?

Unlike Latin characters which each have a single visual representation, each Arabic character can have many different appearances depending on the surrounding characters. The logical characters in an Arabic string need to be converted to a sequence of visual glyphs in order to be correctly displayed. OpenGL doesn't do this processing for you so you're seeing the logical characters rendered without this processing.
To get around this you will need to use a library such as Uniscribe to transform the logical string into a visual string which you then give to OpenGL for rendering. There are some samples here.

Related

Displaying Chinese (Taiwanese) Characters in VB6

I am having problems when I try to display Chinese characters in my VB6 application:
Not the correct characters are displayed.
There are ?'s being displayed.
System setup:
Windows 10
VB6
a) Why am I still using VB6 well it is because the DLL's that I have to interface to our serial devices were written in VB6 and using them in VB.NET is slow.
A translation file that contains all the strings that I display in my code and the corresponding Chinese characters the two things are separated by a pipe symbol "|"
Things that I have tried:
I changed to Region and Language to Taiwan Traditional.
I tried changing the font to anyone that supports the Big5 character set.
Please help and let me know if you need any more information.
Thank you

Is it possible to render zero-width unicode characters as a special replacement character with a custom font?

I'm trying to figure out a way to render certain unicode characters as a custom character instead of how they are supposed to appear.
For example, I would like the character U+0E4A to render as something else rather than how it currently appears in Windows.
I tried to create a quick custom font and to replace those glyphs but it only seems to work in some programs. My font will work correctly in LibreOffice Writer but it won't display properly in WordPad. Replacing regular letters works fine, but for other unicode characters they seem to revert back to a default way of rendering and don't display correctly.
Here is a screenshot of my custom font in WordPad, as you can see I made an obvious edit to the B character but I also did the same to the U+0E4A code point and yet it renders as normal.
If there is a special font that already does this that would probably save me the time of making a custom font, but either way I can't figure out how to render these characters as a custom character.

How to add ASCI Char in TStringGrid Cells

I'm not expert in Delphi and I'm trying to add "Extended ASCII String" broken into individual character and then add into the TSgringGrid.Cells[x,y]. Some of the characters are getting displayed but rest of the characters are not shown in these cells. Another way for me is to convert these characters in Hex-Mode and then show it but this is not Required.
ChartSet used was OEM_CHARSET and Font = Terminal. I simply wish to display all 255 characters in Cell. Basically I wanted to created the Binary Editor like Edit.com in Delphi/ Lazarus which is available in XP.
I used AnsiToUtf8(chr(i)) and it was solved.

How to get glyph unicode representation of Unicode character

Windows use uniscribe library to substitute arabic and indi typed characters based on their location. The new glyph is still have the original unicode of the typed character althogh it has its dedicated representation in Unicode
How to get the Unicode of what is actually displayed not what is typed.
There are lots of tools for this like ICU, Charmap and the rest. I myself recommand http://unicode.codeplex.com, it uses Unicode Character Database to represent characters.
Note that unicode is just some information about characters and never spoke about representation. They just suggest to implement a word just like their example. so that to view each code you need Standard Unicode Font like MS Arial Unicode whichis the largest and the best choise in windows platform.
Most of the characters are implemented in this font but for new characters you need an update for it (if there are such an update) or you can use the font which you know that it implemented your desire characters
Your interpretation of what is happening in Uniscribe is not correct.
Once you have glyphs the original information is gone there is no reliable way to go back to Unicode.
Even without going to Arabic, there is no way to distinguish if the glyph for the fi ligature (for example) comes from 'f' and 'i' (U+0066 U+0069) or from 'fi' (U+FB01).
(http://www.fileformat.info/info/unicode/char/fb01/index.htm)
Also, some of the resulting glyphs do not have a Unicode value associated with them, so there is no "Unicode of what is actually displayed"

How can I change the background color of specific characters in a RTF document?

I'm trying to output RTF (Rich Text Format) from a Ruby program - and I'd prefer to just emit RTF directly without using the RTF gem as I'm doing pretty simple stuff.
I would like to highlight specific characters in a DNA sequence alignment and from the docs it seems that I can either use \highlightN ... \highlight0 or \cbN ... \cb1
The problem is that I cannot get \cb to work in either Word:Mac 2008 or Mac TextEdit (\cf works fine so I know it's not a color table issue)
\highlight does work but seemingly only with two of the possible colors (black and red) and \highlight does not use the custom color table.
By creating simple docs in Word with character shading and saving as RTF I can see blocks of ridiculously verbose RTF code that presumably does what I want, but it is so impenetrable that I'm not seeing the wood for the trees.
Part of the problem may well be that Mac Word is just not implementing RTF properly. I don't have a Windows version of Word handy.
Anyone know the right way to shade blocks of text?
Thanks
--Rob
There is a note in the RTF Pocket Guide that says MS Word does not implement the \cb command. It says MS Word uses \chshdng0\chcbpatN (where "N" is the color number that you would use with \cb). The book recommends using something like the following for compatibility with programs that implement \cbN and/or \chshdng0\chcbpatN: {\chshdng0\chcbpat5\cb5 text}.
Note: The copy of the book I have was published in 2003, so it might be a bit out-of-date.
The sequence of RTF commands that seems to be most universally supported by RTF-capable applications is:
\chshdng10000\chcbpatN\chcfpatN\cbN
These commands:
set the shading to 100 percent
set the pattern foreground and background colors to the color from the color table (we're not actually specifying a shading pattern)
set the character background to the color from the color table
Word was the most difficult application to properly render background colors in:
Despite what the latest (1.9.1) RTF spec says, Word 2013 does not resolve \highlightN colors from the \colortbl. Instead, \highlightN maps to a predefined list of colors. It looks like those colors come from the 1.5 version of the RTF spec.
Regarding \cb, the 1.9.1 spec contains this helpful pointer at the end of the section on Color Table:
Note: Windows versions of Word have never supported \cbN, but it can be emulated by the control word sequence \chshdng0\chcbpatN.
This is almost a useful suggestion, except that if you read the documentation for \chshdngN:
Character shading. The N argument is a value representing the shading of the text in hundredths of a percent.
So, 0 turns out to not be a very useful value; 100 / 0.01 gives us the 10000 we used in the sequence above.
Use WordPad to create RTF documents, not Word. WordPad creates much simpler documents, i.e. approaching human-readable.
I use WordPad every time I need to display formatted text in a WinForms application, and need something that the RichTextBox control can handle being assigned to its Rtf parameter.

Resources