Thai fonts rendering - cocos2d-x

Currently we need to display thai in our game, which use cocos2dx 2.x game engine.
But some fonts are not correctly displayed.
Original text:
ยินดีต้อนรับสู่{p0} ขอให้ท่านเล่นเกมให้สนุก
Displayed in vs code(correct in vscode):
Displayed in sublime 3(wrong in sublime 3, all punctuation marks are wrongly displayed):
Displayed in our game(some punctuation marks are wrongly displayed):
Same result even fontFamily setting in vscode and sublime 3 are same.
What's the reason of this? How can I solve it?

After some researches, I have solved this problem in our game.
Actually, each of these punctuations is a single character in Unicode.
But they need to be combined with other characters, which means their widths is zero.
I guess sublime 3 haven't handled this logic in rendering texts yet.
For our game, I set the widths of these special characters to zero, and it works fine now.

Related

How to properly display Hebrew in text widget?

I'm using Manjaro Linux KDE and the most recent versions of Tcl and Tk, and am attempting to display Hebrew in a text widget. In testing, the Hebrew text was pasted into the Tcl script in the Kate text editor and appears in the correct order, right to left with compound characters.
Without using a specific font in Tcl/Tk, the text prints from left to right and separates the components of compound characters, such that the vowel points and cantillation marks appear as separate characters. After using the SBL Hebrew font, the words look better but the vowel points are not located properly and they are still written from left to right. I tried using the \u200f and \u200e marks but it made no difference; but I really don't know what I'm doing there and simply tried prefixing and suffixing it to the Hebrew word. Reversing the the string helps but the vowel points are not combined with the consonants.
I'm not using Tkinter but this older SO post seems to indicate that it is a Linux issue with Tcl.
If I extract Hebrew from SQLite using Tcl and write it to the command line using puts, it displays correctly. Also, if I copy the reversed text from the Tk text widget and paste it in this SO question, it is displayed in the correct order. To clarify, by reversed here, I don't mean using string reverse but simply that it appears reversed in Tk but when pasted in this SO box, it displays correctly.
Would you please tell me what I'm doing wrong and how to get it to display properly?
I tried to follow this document on internationalization in Tcl and encoding but don't follow how this affects displaying Hebrew in a text Widget. I also came across a web site that has code for a unicode editor that displays several languages including Hebrew but I can't follow that code either. I tried running the code and, if select Hebrew language, it writes right to left but I don't see vowel points or cantillation marks; but I don't know much about typing the Hebrew language.
Thank you.
.tw tag configure heb -font {"SBL Hebrew" 18 normal}
.tw insert end "בְּרֵאשִׁ֖ית" "heb"
# Also tried "בְּרֵאשִׁ֖ית\u200f" and "\u200fבְּרֵאשִׁ֖ית".
# and "בְּרֵאשִׁ֖ית\u200e" and "\u200eבְּרֵאשִׁ֖ית".
# Tried .t insert end [string reverse $h ] "heb", which order the
# consonants but the vowel points and cantillation marks are not correct.
This is the correct rendering.
This is from Tk. The first is in normal order and the second using string reverse. It can be observed that the vowel points are not "on" the consonants and the cantillation marks are not correct. I know little about Hebrew but I can tell they don't match and appear to be printed as separate characters instead of combined. I think what looks like a "t" under the Hebrew letter that looks similar to a "W" is two characters on top of each other-- a dot and the symbol sort of similar to a left parenthesis in the correct rendering.
I don't know why but after rebooting and installing the next batch of updates, not that they have anything to do with Tk, the rendering is different when a font is not set. However, once the SBL Hebrew font is set, then the characters are separated as displayed above.
I can tell you know that the text renders very close to correctly with Tk on macOS (I'm not sure how much is just font differences, and there's a bit of clipping of the descender decorations that I don't like, but I don't think that's Tk itself doing the wrong thing).
That means that it's definitely a rendering bug that you're seeing. I suspect it might relate to the size of chunks of characters fed into the renderer; if the low levels of the renderer are only being given a character at a time, then they've got no chance to get the overall placement correct or to apply any character combining. I'm guessing that the real issue is that TkpDrawCharsInContext() just calls Tk_DrawChars(), if my reading of the comments is right. (By contrast, the macOS renderer does something different here.)
I don't have a workaround.

ETX characters (as L) showing up on websites

In the last few days I have had a couple of clients contact me saying that they are having some uppercase "L"'s appearing in places on their website. Upon investigating, I found that there were some random ETX characters on their websites. They are showing up on the websites on Windows (definitely on Chrome, maybe on other browsers too), but in Firefox on Mac I can see them in the source code. On Chrome on Mac I can't see them anywhere. Here are pictures of the problem:
picture of the issue
source code
My clients websites have not been updated in months so I'm guessing that Windows pushed out an update in the last week to the default language/encoding which is making these show up now.
Removing them is easy, but I wanted to understand where they are coming from and how I can avoid the problem in the future. It looks like the characters are in text that I would have copied out of Photoshop. Is there any easy way to sanitise and remove these kind of characters when I copy from Photoshop or other similar programs?
As I mentioned earlier, I am on Mac, using Chrome primarily. Is there any way to get Chrome to actually show these characters so that I can see if they are appearing?
You are correct that the issue is with Photoshop. Line breaks (Shift+Enter) are encoded in Photoshop as an ETX character (end of text), not an LF (line feed) or CRLF (carriage return + line feed).
These characters can be seen by pasting your content into a plain text editor such as Sublime Text. The find/replace function should make removing them easy.
I don't believe there is any way to get the ETX characters to display in Chrome for Mac.
However, since the characters are still present (even if they are invisible), you could select all the text on the page (Mac: Cmd+A / Win:
Ctrl+A) and paste it all into Sublime Text to find them.

Actionscript TextField doesn't display chinese characters (font is embedded)

So here's the situation. I have a bunch of textfields, containing some phrases, and a locale file containing translations of those phrases in several languages. I also have a textfield on the stage where I copied all the characters from the locale file (this means latin characters, plus special characters from french, spanish, and also characters in arabic, and chinese).
Now the problem: all translations appear ok, even arabic, except for chinese. For chinese, I don't see anything, only white space. If I compile the application with the chinese translations already entered in the textfields, I can see them, but as soon as I try to set them dynamically, everything disappears.
The font I'm using is Arial, Bold, and I even tried embedding the entire Chinese set of glyphs, but with no luck.
Also, I tried launching an alert window using External Interface to trace the chinese characters right before I'm setting them to the textfield, and I can see them appearing just fine in the alert box (I'm using Vizzy for watching traces, but for chinese I'm just seeing some squares).
Help me out..

Error With Google Webfont Not Loading Characters

On my site I am using the Google Font Roboto. I noticed in several places the following:� or what I call a question mark in a black diamond. (Does this symbol have a name?)
I typically see this when a font doesn't have a character it can render, however, this doesn't appear to be the case in this instance. It happens in a few instance. One of them is when there is an extra space the other I have seen is when I use the § symbol.
I tested Roboto using the § symbol with a type tester and it works just fine.
Why doesn't it work on my site? What is going wrong?
I am unsure why this is happening and would still love an answer but I found a solution that I am using in the mean time.
It appears to have have happened with content that was copied into my text. For spaces or other symbols were this appears (such as - or / I am just retyping the character. For the § symbol I replaced it with the HTML character § (or you can use §) and this has solved the issue.

displaying special characters in IE

I have a webpage that uses the special character &#xFE3E in the HTML. In Firefox 4.0B12 this looks like a double downward-pointing chevron (︾). In Internet Explorer 8.0.7600.16385, however, this it just looks like &#xFE3E.
What do I need to do to get this character to display in IE the way it does in FF?
Thanks,
PaulH
Explicitly specify a font that you know contains that character (eg in a font-family CSS rule), so that you're not relying on the font fallback functionality of the browser (which varies, but Firefox is typically better at it than IE).
U+FE3E is a character intended for use as a close bracket in vertical ideographic text (Chinese, Japanese etc). You shouldn't expect it to be available on a machine that doesn't have East Asian fonts installed, and using it to get a particular shape unrelated to parentheses is really a misuse. I would not use it on the web. There are a limited number of ‘symbol’ characters that generally render reliably across the main OS default installs and this isn't one of them.
Make sure to end the character reference with a semicolon, like ︾.
You need to include the semi-colon after the HTML code: ︾.