You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Alex Chew <ch...@gmail.com> on 2006/04/06 06:18:47 UTC

how can i display text in g that use clip-path

Hay,all

   I failed to show text correctly when it is rendered by a g element that
apply a clip-path. something like this,

<g clip-path="url(#slideClip)">
<g id="slide">
  <rect width="64.0" x="140.03.0" height="64.0" y="13.0"
style="fill:#FF9143;opacity:0.6"/>
  <rect width="64.0" x="210.03.0" height="64.0" y="13.0"
style="fill:#FF9143;opacity:0.6"/>
  <text x="140.03.0" y="48.0"
style="stroke:black;font-family:'KaiTi_GB2312'">中文</text>
  <text x="210.03.0" y="48.0"
style="stroke:black;font-family:'KaiTi_GB2312'">English</text>
</g>
</g>

Everything goes right, English words were printed successfully, but Chinese
words disappeared.
And, it works perfectly well while i eliminate clip-path.

Would you please tell me
1) why does this happen and
2) how can i make it work well?

Thanks a lot.
alex

Re: how can i display text in g that use clip-path

Posted by Tonny Kohar <to...@kiyut.com>.
Hi,

On Fri, 2006-04-07 at 09:07 +0800, Alex Chew wrote:
> It looks like a joke to me, 
> When I reboot my pc justnow, I found all Chiese words were turned to
> something like 'Ŀ¼'.
> What I did is to turn them back. Then, it worked well.

This may not relevant, but anyway we have similar problem before, it
turn out that we open the svg file (unicode encoding) in a text editor
that does not support unicode and then save the svg file. All unicode
character turn into garbage.

Regards
Tonny Kohar 
-- 
Sketsa 
SVG Graphics Editor
http://www.kiyut.com


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: how can i display text in g that use clip-path

Posted by Alex Chew <ch...@gmail.com>.
Hi, Thomas
Thanks for your immediately respose.

I knew little about clip path though the trouble has ran away. :)

It looks like a joke to me,
When I reboot my pc justnow, I found all Chiese words were turned to
something like 'Ŀ¼'.
What I did is to turn them back. Then, it worked well.

I didn't know what was the really cause.
The file was generated using batik.
I'll try more tests.

thanks again.
alex

following is whole file,

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN'
          'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'>
<svg contentScriptType="text/ecmascript" xmlns:xlink="
http://www.w3.org/1999/xlink" zoomAndPan="magnify"
contentStyleType="text/css" preserveAspectRatio="xMidYMid meet" xmlns="
http://www.w3.org/2000/svg" version="1.0">
<defs>
  <clipPath id="slideClip"  clip-rule="evenodd">
    <path d="M 143.0 13.0 L 623.0 13.0 L 623.0 86.0 L 143.0 86.0"/>
  </clipPath>
</defs>
 <g clip-path="url(#slideClip)">
  <g id="slide">
    <rect width="64.0" x="140.03.0" height="64.0" y="13.0"
style="fill:#FF9143;opacity: 0.6"/>
    <rect width="64.0" x="210.03.0" height="64.0" y="13.0"
style="fill:#FF9143;opacity:0.6"/>
    <text x="144.03.0" y="48.0"
style="stroke:black;font-family:'KaiTi_GB2312'">中文</text>
    <text x="214.03.0" y="48.0"
style="stroke:black;font-family:'KaiTi_GB2312'">English</text>
  </g>
</g>
</svg>

Re: how can i display text in g that use clip-path

Posted by th...@kodak.com.
Hi Alex,

"Alex Chew" <ch...@gmail.com> wrote on 04/06/2006 12:18:47 AM:

> Everything goes right, English words were printed successfully, but 
Chinese 
> words disappeared. 
> And, it works perfectly well while i eliminate clip-path.

   Is it possible that your clip path is, clipping the Chinese text?
It can sometimes be a little tricky getting a clip path where you want it.

> Would you please tell me 
> 1) why does this happen and 
> 2) how can i make it work well?

   I have a hard time imagining what interaction there would be between
the Chinese text layout and clip paths, especially since essentially all 
documents have a clip path defined by the rootmost SVG element. 

Can you provide a complete example that shows the problem (you almost had 
it above but you were missing the clip definition and outmost SVG 
element).


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org