1

I am creating an App that will display Unicode into a Text box and a picture box. App Image

I have some issues when I try to use Thai, I do not speak Thai but know the rules allow me to have a character and then on top of it a max of two other marks.

I try to get the following Unicode into the text box. 0E2c then add on top of it 0E36 followed by 0E4B. I have set the font size to 30 for the Textbox. The Textbox I try and autosize as follows note for height I try and add more than I need in case that would help but alas it does not.

Size size = TextRenderer.MeasureText(txtbx_text.Text, txtbx_text.Font);
txtbx_text.Width = size.Width;
txtbx_text.Height = size.Height + 25;

What I am trying to get is picturebox image but what the textbox shows is Textbox image notice the bit at the top is missing. Any idea how I can force the textbox to show the Thai properly?

I think the txtbx_text.height is not working as I increased the size by 2000 and nothing happens. The width is good so how do I make the height work?

The code is available from http://www.filedropper.com/i-braille. Choose page 0e set height to 30. Right click on each char to build the string left click gives info. Form1.cs line 116'ish is where I am trying to set size of text box.

user3884423
  • 556
  • 1
  • 5
  • 20
  • 1
    I think your assumption might be wrong. I just tested this using a virtual keyboard to create the desired combined character and set that as text box value. Displays just fine including the little plus. Show how you create the character. I rather suspect the problem there. – LocEngineer Nov 20 '17 at 11:40
  • Making the Height larger does not help, that merely creates more space at the bottom of the letter. The Font matters a great deal. No real idea which font is ideal for Thai text, but not the default font in Winforms. "Segoe UI" gets the job done properly for example. – Hans Passant Nov 20 '17 at 15:12
  • @HansPassant I tried with the default MS Sans Serif font as well as with AngsanaUPC. Both look just fine for me. – LocEngineer Nov 20 '17 at 15:30
  • 1
    I had no trouble reproducing the OP's problem. And fixing it with a better font. Questions like these need to document the Windows version. – Hans Passant Nov 20 '17 at 15:34
  • I am using Windows 7 Professional SP1 with VS2015 – user3884423 Nov 20 '17 at 16:00
  • Don't post links to your code so we download it and the sift through the mess. Post the relevant portions here directly. – LocEngineer Nov 20 '17 at 17:12

2 Answers2

0

I had a message from a Thai person and they tell me that the font is the issue, Not all fonts work, so they cannot use them all in a UI, this I did not know. They suggest using "Angsana New", I tried this and so far all is working OK. Here is the proof with Bembo I get the characters off the top of the textbox

Using Bembo

But when I just change only the font type, size remains the same I get

Using Angsana New

This is how it should appear so I think using this font will be better. If anyone else has experience of Thai and can help I would appreciate any comments and help. For the moment I think I have an answer for the way forward.

user3884423
  • 556
  • 1
  • 5
  • 20
-1

Found the issue. Set the Font Property GdiVerticalFont of your textbox to True.

LocEngineer
  • 2,847
  • 1
  • 16
  • 28
  • Almost but not for all combinations.e.g. I try (all from page 0E) char C2 followed by 43 then A4 and that does not resize the Text box. B2 with 43 and A4 fits in. I think it is the extra items I add do not set an event somewhere to resize the height of the text box? – user3884423 Nov 20 '17 at 16:29
  • Works for me, but I strongly assume you meant 2C, 34 and 4A as the ones you mentioned are not in the Thai map. How do you add these items? Please post code. – LocEngineer Nov 20 '17 at 17:02
  • I definitely mean C2,43 and A4. If you are in doubt of how to number Unicode go to page 00 and look at the Zero it will be in position 30 so take the number from horizontal then vertical gives you 30. – user3884423 Nov 21 '17 at 08:22
  • @user3884423 I am actually not in doubt. Check here, complete with addresses and all: http://jrgraphix.net/r/Unicode/0E00-0E7F Thai only goes to E0*7F*, so C2 is definitely out of range. – LocEngineer Nov 21 '17 at 09:17
  • @user3884423 "I definitely mean C2,43 and A4.". So you mean mixing a Lao character with a Thai character followed by Lao? Have you actually downvoted me for that? – LocEngineer Nov 21 '17 at 10:09