WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 05-26-2008, 12:53 AM
dan12345 dan12345 is offline
Member
 
Join Date: Jan 2008
Posts: 58
Vizard with non-latin language

Hello -
I wanted to add hebrew text in vizard, and wasn't able to...
Is there any way to enable it? If not, we would be very very
happy if in future versions it might be supported....
Reply With Quote
  #2  
Old 05-27-2008, 11:53 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Have you tried setting the encoding of your script to UTF-8? (File -> Encoding -> UTF-8). Once this is set, you should be able to add hebrew text in your script. This won't work if you are adding text through the stage though.
Reply With Quote
  #3  
Old 05-29-2008, 04:17 AM
dan12345 dan12345 is offline
Member
 
Join Date: Jan 2008
Posts: 58
i actually have tried changing the encoding

i actually have tried changing the encoding, which allowed me adding
hebrew to the script itself, but i wasn't able to add a textnode with
hebrew letters, that will be shown in the VR. ( the script compiled, but
letters which were not hebrew were shown on the screen )
Is this supposed to be possible?
Reply With Quote
  #4  
Old 05-29-2008, 10:05 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
I installed hebrew on my computer and ran the following script and it displayed the attached image. Is the text in the image real hebrew?
Code:
# coding: UTF-8
import viz
viz.go()

text = viz.addText('קראטוןםפשדגכעיחלךזסבהנמצ',viz.SCREEN,pos=(0.5,0.5,0),align=viz.TEXT_CENTER_CENTER)
Attached Thumbnails
Click image for larger version

Name:	hebrew.jpg
Views:	721
Size:	23.6 KB
ID:	251  
Reply With Quote
  #5  
Old 06-01-2008, 05:59 AM
dan12345 dan12345 is offline
Member
 
Join Date: Jan 2008
Posts: 58
still didn't work

The text in the image is real hebrew indeed, but when i run your code
on my computer (after copy pasting) i still don't get the right characters...
The computer does work with hebrew in general...
any ideas why?
Reply With Quote
  #6  
Old 06-02-2008, 07:45 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
What characters show up? Other than enabling UTF-8 encoding from the file menu, you shouldn't have to do anything else.
Reply With Quote
  #7  
Old 06-04-2008, 02:08 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Another problem might be that the arial font on your system does not support hebrew. Vizards default font is arial.ttf. Try changing the font of the text object to something that supports hebrew. You can set the font using the following sample code:
Code:
text.font('font.ttf')
Reply With Quote
  #8  
Old 06-05-2008, 03:36 AM
dan12345 dan12345 is offline
Member
 
Join Date: Jan 2008
Posts: 58
Nope, still doesn't work... how do i add pictures to forum messages? i wanted to add
a jpeg of the result, but couldn't find how to do it.... after changing the text using text.font('some hebrew font.ttf'), nothing changed....
Reply With Quote
  #9  
Old 06-05-2008, 12:03 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
The last thing I can think of is to manually set the encoding of the text object to UTF8:
Code:
text.setEncoding(viz.ENCODING_UTF8)
Vizard will check for a UTF8 BOM in your main script and automatically enable UTF8 encoding, so manually setting the encoding is not usually necessary, but its worth a shot.

You can attach images to a post by clicking the "Manage attachments" button when replying.
Reply With Quote
  #10  
Old 06-09-2008, 10:42 PM
dan12345 dan12345 is offline
Member
 
Join Date: Jan 2008
Posts: 58
worked!

it worked
thanks a bunch
Reply With Quote
  #11  
Old 07-10-2008, 12:05 AM
dan12345 dan12345 is offline
Member
 
Join Date: Jan 2008
Posts: 58
another small problem with hebrew

when using the code written before - it reverses the order of the letters ( which can also be seen in the jpg you attached )

i tried fixing this using method such as

aa = array.array('c', chars)
aa.reverse()
newa = aa.tostring()

or

temp = list(string)
temp.reverse()
newString = string.join(temp, '')

but for some reason this scrambled the hebrew, and adding a text with the new strings led to strange results...

any solution?
thanks
dan
Reply With Quote
  #12  
Old 07-10-2008, 10:36 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Here is some sample code that will reverse an utf8 string:
Code:
# coding: UTF-8
import viz
viz.go()

def reverse_hebrew(s):
	u = unicode(s,'utf8')
	u = u[::-1]
	return u.encode('utf8')

text = viz.addText(reverse_hebrew('קראטוןםפשדגכעיחלךזסבהנמצ'),viz.SCREEN,pos=(0.5,0.5,0),align=viz.TEXT_CENTER_CENTER)
Reply With Quote
  #13  
Old 09-01-2008, 01:23 AM
luakt luakt is offline
Member
 
Join Date: Jul 2008
Posts: 31
Can we get the avatar to speak Mandarin (Chinese language)?
Reply With Quote
  #14  
Old 02-18-2009, 05:46 AM
dan12345 dan12345 is offline
Member
 
Join Date: Jan 2008
Posts: 58
more problems with hebrew

Hi - I used to be able to write hebrew letters in vizard, but now i cannot anymore. ( maybe not supported in the new version? )
How can i fix this?
Even when i try to run the .py file not through the vizard environment
( so i could write hebrew letters, did it in notepad )
Vizard doesn't show the hebrew letters properly
( in the same way that it used to, with the solutions in this thread )
Thanks,
dan
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
McAfee Privacy Service 8.1 causes Vizard not to run mspusch Vizard 2 09-24-2008 05:17 PM
Vizard and Augmented Reality realvision Vizard 4 04-04-2008 10:59 AM
Vizard won't run wouters Vizard 5 02-05-2008 11:12 AM
Fall 2007 release of Vizard R3 3 D Announcements 0 10-15-2007 04:50 PM
McAfee Privacy Service 8.1 causes Vizard not to run mspusch Vizard 0 03-01-2007 08:24 PM


All times are GMT -7. The time now is 03:56 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC