How to display a SVG with Chinese text element on mobile phone?

View: New views
4 Messages — Rating Filter:   Alert me  

How to display a SVG with Chinese text element on mobile phone?

by kingble :: Rate this Message:

| View Threaded | Show Only this Message


I use WTK2.5.2,there is a demo which name is SVGDemo,I start SVG Browser MIDlets in this demo and open a SVG file test.svg,it's path is file:///root1/test.svg ,test.svg's code:
 
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
<svg viewbox="0 0 50 25" width="150.0" height="75.0">
    <text x="30" y="40" fill="#00007E" stroke="black"
        stroke-width=".33" >测试 testtest</text>
</svg>
and then ,we can see testtest,but 测试(测试 is Chinese) can't display normally.I think JSR226 maybe not support Chinese,and who can tell me the way display a SVG with Chinese test element on mobile phone?thanks.



网易邮箱,中国第一大电子邮件服务商

Re: How to display a SVG with Chinese text element on mobile phone?

by Robin Berjon-2 :: Rate this Message:

| View Threaded | Show Only this Message

On Mar 16, 2009, at 10:31 , wangkaiyu wrote:

> I use WTK2.5.2,there is a demo which name is SVGDemo,I start SVG  
> Browser MIDlets in this demo and open a SVG file test.svg,it's path  
> is file:///root1/test.svg ,test.svg's code:
>
> <?xml version="1.0" standalone="no"?>
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd 
> ">
> <svg viewbox="0 0 50 25" width="150.0" height="75.0">
>     <text x="30" y="40" fill="#00007E" stroke="black"
>         stroke-width=".33" >测试 testtest</text>
> </svg>
> and then ,we can see testtest,but 测试(测试 is Chinese) can't  
> display normally.I think JSR226 maybe not support Chinese,and who  
> can tell me the way display a SVG with Chinese test element on  
> mobile phone?thanks.

Is the file in the correct encoding? If it's not then the Chinese  
characters are likely to show up wrong (you don't say what the  
rendering is, is it weird meaningless characters or is it a series of  
little boxes or blocks?)

Otherwise it could be an issue with your phone not having the right  
fonts to display Chinese. You might want to try adding an SVG font for  
Chinese characters.

--
Robin Berjon - http://berjon.com/
     Feel like hiring me? Go to http://robineko.com/



Re: How to display a SVG with Chinese text element on mobile phone?

by Helder Magalhães :: Rate this Message:

| View Threaded | Show Only this Message

Hi wangkaiyu,

> Is the file in the correct encoding? If it's not then the Chinese characters
> are likely to show up wrong

Taking Robin's suggestion, I'm attaching a file, based on yours, with
the proper XML namespace declaration and the UTF-8 encoding hint. I've
quickly tested and seems to work as expected in Firefox 3.0.7, Opera
9.64 and Safari 4 (Public beta). ASV 6 (Developer release) only seems
to work if a font with Unicode support is specified (see suggestion
below and/or attachment).

Also, Robin's suggestion of using a SVG font would surely help. If
implementation supports it, I'd suggest that as the best idea. If not,
other things which may be happening (and possible workarounds):
 * Cause: parser may not be compatible with non-ANSI characters
(although the rendering engine may). Workaround: use XML notation [1]
("ሴ") for non-ASCII characters;
 * Cause: default font doesn't support Unicode characters. Workaround:
find a font which does and use the "font-family" [2] to force its
usage (the file attached makes use of this). Note that this is pretty
tied to a particular set of devices, as available font names will
vary.

If the suggestions don't put you in the right track, please consider
providing more information. You may also try SVG Developers group [3]
instead, as it's a lot more aimed at general SVG support and questions
then this mailing list. ;-)

Hope this helps,
 Helder Magalhães

[1] http://www.w3.org/TR/unicode-xml/#Notation
[2] http://www.w3.org/TR/SVG11/text.html#FontFamilyProperty
[3] http://tech.groups.yahoo.com/group/svg-developers/


ChineseCharacters.svg (380 bytes) Download Attachment

Re: How to display a SVG with Chinese text element on mobile phone?

by kingble :: Rate this Message:

| View Threaded | Show Only this Message

I  alter my test.svg code and save by UTF-8 format:

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
<svg viewbox="0 0 50 25" width="150.0" height="75.0">
<g>
    <rect x="25" y="25" transform="translate(75 36.375)
        rotate(15) translate(-70 -35.375)" fill="#00007E"
        width="100" height="22.75" stroke="#000000" stroke-width=".5"/>
    <rect x="25" y="25" fill="#FF9800" width="108.5"
        height="22.75" stroke="#000000" stroke-width=".5"/>
    <text x="30" y="40" fill="#00007E" stroke="black"
        stroke-width=".33" style="font-family:SimSun;sans-serif">测试 test</text>
</g>
</svg>

------------------
and I can show test.svg correctly on PC,but on mobile it still display normally.test in <text> </text>display correctly,but 测试 is replaced by 2 box.
Can I send the test.svg with the font SimSun?or maybe these is a svg Parser in mobile can display Chinese?