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 Dylan Browne <db...@mango-solutions.com> on 2007/12/04 17:18:23 UTC

Referencing Font Style Classes During PNG Export

Hi all,

 

I have been struggling with various unexpected behaviour with Text
components when using the ImageTranscoder export for a short while now,
and have managed to distil an example into a small test case.

 

The problem is that, if I reference two style classes which define the
characteristics of the font, although the SVG in both cases is fine, the
PNG/JPEG export is not. The order of referencing the style classes
determines how the font is styled.

 

For example, two style classes:

 

.graphHeaderFontColour {

fill: red;

}

                        

.graphHeaderFont {

font-family: courier new;

font-weight: bold;

font-size: 32px;

}

 

I have these styles defined within "defs" in a CDATA within the SVG
file.

 

And when referenced as below, the PNG is fine:

 

class="graphHeaderFont graphHeaderFontColour"

 

But when referenced as below, only the colour is picked up, and the font
family and size etc, is ignored:

 

class="graphHeaderFontColour  graphHeaderFont"

 

As I say, I have this in a standalone test case which I can post to the
list, if that is permitted? (its 2mb, including all the relevant Batik
libraries).

 

(I am also witnessing problems with occasional skewing of text
locations, which may be related this, or more likely not).

 

Many thanks as ever,

 

Dylan

 


Re: Referencing Font Style Classes During PNG Export

Posted by Cameron McCormack <ca...@mcc.id.au>.
Hi Dylan.

Dylan Browne:
> Thanks a lot for that. 
> 
> Could someone point me towards a link for help on how to use SVN. I just
> want to know how to incorporate that one change into my current Batik
> distribution, or how to build the entire latest version from the
> repository?

This page mentions how to check out the current sources from Subversion:

  http://xmlgraphics.apache.org/batik/download.cgi#Subversion+repository

Once checked out, you can build the jar files by running

  ./build.sh jars			on Unix, or
  build jars				on Windows.

Alternatively I have some nightly builds here:

  http://arc.mcc.id.au/batik-nightly/

-- 
Cameron McCormack, http://mcc.id.au/
	xmpp:heycam@jabber.org  ▪  ICQ 26955922  ▪  MSN cam@mcc.id.au

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


RE: Referencing Font Style Classes During PNG Export

Posted by Dylan Browne <db...@mango-solutions.com>.
>There was a bug in the CSS class name matching code, which surfaced
here
because graphHeaderFont is a prefix of graphHeaderFontColour.  This is
fixed in SVN now


Hi Cameron,

Thanks a lot for that. 

Could someone point me towards a link for help on how to use SVN. I just
want to know how to incorporate that one change into my current Batik
distribution, or how to build the entire latest version from the
repository?

Many thanks again,

Dylan.


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


Re: Referencing Font Style Classes During PNG Export

Posted by Cameron McCormack <ca...@mcc.id.au>.
Hi Dylan.

Dylan Browne:
> Further to my previous email... I have noticed that I have sent a
> version of the two files which were in 'mid-experiment'!
> 
> Basically if you take the first file, and switch the order of the
> references to the style class names, so you have:
> 
> class="graphHeaderFontColour graphHeaderFont"
> 
> ...you get different results. The order of the declaration or the
> contents of the style classes do not appear to have any impact, from
> what I have seen so far.

There was a bug in the CSS class name matching code, which surfaced here
because graphHeaderFont is a prefix of graphHeaderFontColour.  This is
fixed in SVN now:

  http://svn.apache.org/viewvc?view=rev&revision=602579

-- 
Cameron McCormack, http://mcc.id.au/
	xmpp:heycam@jabber.org  ▪  ICQ 26955922  ▪  MSN cam@mcc.id.au

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


RE: Referencing Font Style Classes During PNG Export

Posted by Dylan Browne <db...@mango-solutions.com>.
Further to my previous email... I have noticed that I have sent a
version of the two files which were in 'mid-experiment'!

Basically if you take the first file, and switch the order of the
references to the style class names, so you have:

class="graphHeaderFontColour graphHeaderFont"

...you get different results. The order of the declaration or the
contents of the style classes do not appear to have any impact, from
what I have seen so far.

Thanks again,
Dylan



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


RE: Referencing Font Style Classes During PNG Export

Posted by Dylan Browne <db...@mango-solutions.com>.
Hi Cameron/all,

I've tried to email the test case, but I keep getting bounces from the
list, even though its now down to about 11k. I guess it doesn't like
some of the file types I'm trying to send.

These two svg files should illustrate the issue I believe I am seeing.
The first will be exported to PNG/JPEG correctly, the second one not.

A bit more investigation has narrowed this down slightly... 

It seems the problem is related to the style class names as well as the
style class order. If you have two style class names, one of which is
the prefix of the other, (eg in my case 'graphHeaderFont' and '
graphHeaderFont Colour'), and the longer precedes the shorter in the
'class=' reference, the second style is ignored or not referenced. 

I'll keep on investigating, but any advice/tips as to whether my CSS
does not comply with the Spec, or this is a bug, would be very
gratefully received.

Best regards,
Dylan

------------------------

<svg contentScriptType="text/ecmascript" zoomAndPan="magnify"
     xmlns:xlink="http://www.w3.org/1999/xlink"
     contentStyleType="text/css" version="1.0" width="820.0"
     viewBox="0 0 820.0 650.0"
     height="650.0" xmlns="http://www.w3.org/2000/svg">
    
		<defs>
			<style type="text/css">
			<![CDATA[
			
				.graphHeaderFontColour {
					fill: red;
				}
		
				.graphHeaderFont {
					font-family: courier new;
					font-weight: bold;
					font-size: 32px;
				}
				
			 ]]>
			</style>
    </defs>

    <text x="400.0" y="100" class="graphHeaderFont
graphHeaderFontColour" text-anchor="middle">
        Text test - how do the fonts look!?
    </text>
    
</svg>

-----------------------------------------

<svg contentScriptType="text/ecmascript" zoomAndPan="magnify"
     xmlns:xlink="http://www.w3.org/1999/xlink"
     contentStyleType="text/css" version="1.0" width="820.0"
     viewBox="0 0 820.0 650.0"
     height="650.0" xmlns="http://www.w3.org/2000/svg">
    
		<defs>
			<style type="text/css">
			<![CDATA[
			
				.graphHeaderFont {
					fill: red;
					font-family: courier new;
					font-weight: bold;
					font-size: 32px;
				}

				.graphHeaderFontColour {
					
				}		
				
			 ]]>
			</style>
    </defs>

    <text x="400.0" y="100" class="graphHeaderFontColour
graphHeaderFont" text-anchor="middle">
        Text test - how do the fonts look!?
    </text>
    
</svg>

-------------------------------------





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


Re: Referencing Font Style Classes During PNG Export

Posted by Cameron McCormack <ca...@mcc.id.au>.
Hi Dylan.

Dylan Browne:
> I have been struggling with various unexpected behaviour with Text
> components when using the ImageTranscoder export for a short while now,
> and have managed to distil an example into a small test case.
> 
> The problem is that, if I reference two style classes which define the
> characteristics of the font, although the SVG in both cases is fine, the
> PNG/JPEG export is not. The order of referencing the style classes
> determines how the font is styled.

Hmm, it shouldn’t.

…
> As I say, I have this in a standalone test case which I can post to the
> list, if that is permitted? (its 2mb, including all the relevant Batik
> libraries).

If you can post a test case without all of the Batik libraries, that
would be helpful.  The list may reject a large attachment, though, so
you may have to upload it somewhere else.

> (I am also witnessing problems with occasional skewing of text
> locations, which may be related this, or more likely not).

Cameron

-- 
Cameron McCormack, http://mcc.id.au/
	xmpp:heycam@jabber.org  ▪  ICQ 26955922  ▪  MSN cam@mcc.id.au

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