Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. problem with using local language font in the textbox.

problem with using local language font in the textbox.

Scheduled Pinned Locked Moved C#
help
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    prasadbuddhika
    wrote on last edited by
    #1

    i need to use the local language font (sinhala) with textbox in my app in xp, so the user can type in the local language. for this i'm using ttf font. i can set the font to textbox without any problem. but when i'm typing in the text box it shows the english font,but i tried

    char[] ch = {'\u0db8' };
    textBox2.Text = new string(ch);

    in the form load and it showed the correct letter, but when type in the text box still only the english letters. (at the same time i set true regional setting->language->install files for east asian languages,when i set this off , characters in the textbox shows as black squares) so any one got any idea why this happens, but i tried the same app with the same font in win 7 and it works perfect, but i need this app to run in xp. thanx in advance.

    N 1 Reply Last reply
    0
    • P prasadbuddhika

      i need to use the local language font (sinhala) with textbox in my app in xp, so the user can type in the local language. for this i'm using ttf font. i can set the font to textbox without any problem. but when i'm typing in the text box it shows the english font,but i tried

      char[] ch = {'\u0db8' };
      textBox2.Text = new string(ch);

      in the form load and it showed the correct letter, but when type in the text box still only the english letters. (at the same time i set true regional setting->language->install files for east asian languages,when i set this off , characters in the textbox shows as black squares) so any one got any idea why this happens, but i tried the same app with the same font in win 7 and it works perfect, but i need this app to run in xp. thanx in advance.

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      prasadbuddhika wrote:

      but when i'm typing in the text box it
      shows the english font

      That's because the font will be a Unicode font. In that case, you need to emit proper Unicode code points for Sinhala to get the characters displayed correctly. This is why the text set by you at the load is showing correctly but when you type you are entering English characters which is nowhere in the Sinhala code point range.

      prasadbuddhika wrote:

      time i set true regional setting->language->install files for east asian languages,when i set this off , characters in the textbox shows as black squares

      Windows XP requires this to be installed to get the proper rendering. From Windows 7 onwards, this comes by default and you don't have to install separately. I think you have two choices here. 1 - Use a Sinhala ASCII font which you can supply with your application. In a ASCII font, English characters will be mapped to a Sinhala character. So typing using a English keyboard will show the Sinhala letter. When user wants the text out from the textbox, you need to convert it to Unicode. 2 - Interpret English characters and emit the Sinhala Unicode encoded (UTF8 or UTF16) characters.

      prasadbuddhika wrote:

      i tried the same app with the same font in win 7 and it works perfect

      I can't think of how this will work on Windows 7 with a Unicode font other than using the methods that I explained. :)

      Best wishes, Navaneeth

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups