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 Vladimir Bulatov <bu...@physics.orst.edu> on 2003/10/07 19:12:35 UTC

custom text rendering?

Hello everybody,
   We are using Batik for writing accessible SVG viewer to be
used by blind computer users to access to graphical information.
We use special tactile graphics printer as output device and
special touch screen as input device and replacement for
a mouse. This is just some background info to explain, that
we may have unusual requirements.

The problem we currently have with Batik is to find a way to
print text in a custom way. Text for blind users should be
printed in a special way. Most popular is Braille code, when
every character is represented by combination of dots on 2 by 3
or 2 by 4 matrix with 1/10 inch distance between dots.
This size roughly corresponds to 29 or 36 points font size.
Other ways to represent text are possible depending on characters
size. But, in any case, tactile representation should be very much
different from visual representation.

We need an advise on the best way to customize Batik
to allow special text rendering. Visual representation should
remain the same to be useful for sighted user. Only printed
copy should be different. Ideally we would like to be to have
the ability to pass text strings directly to printer driver
(we are on windows platform and have quite sophisticated
driver, which converts text into Braille itself), bypassing
Batik rasterizer.

Any advice would be appreciated.

All the best,
        Vladimir Bulatov



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


Re: custom text rendering?

Posted by Vladimir Bulatov <bu...@physics.orst.edu>.
Hi Thomas

Thomas DeWeese wrote:

> Vladimir Bulatov wrote:
> 
> 
> 
>   I assume by 'low resolution raster' you mean the font you have is
> a '20 dpi' raster font so a braille dot is just one pixel correct?
> 

Low resolution means, that our special printer, which prints embossed
graphics and text prints at resolution 20 dpi. At this resolution
human finges tips can not distinguish dot from dot. Braille text dots
are spaced at 10 dpi. This 20 dpi resolution looks pretty low visually,
but blind users are quite happy with it. Our technology used for
tactile printing doesn't allow higher resolution printing.
Mostly because of physical properties of the paper, which will tear
if dots will be embossed (punched) closer to each other.
In reality, that low resolution output creates some troubles for
Graphics2D rasterizer. It render images with some lines missing.


>> It looks like this is the place to change text renderer
>> implementation. But this method is not used anywhere in Batik and
>> I am wondering what was the initial intent to have this method.
> 
> 
>   So people could change the text rendering implementation :)

It is encouraging news :)

> 
>   FOP does/did this so it could generate 'cleaner' text for PDF.
> You might want to look at what they did (http://xml.apache.org/fop) I
> think the code of interest would be in the org.apache.fop.pdf package.

Thanks for the link.

> 
> So a user stylesheet like:
> 
> @media braille { text  { font-family: SVGBraille !important; font-size: 
> 30 !important }
>          tspan { font-family: SVGBraille !important; font-size: 30 
> !important }
>          tref  { font-family: SVGBraille !important; font-size: 30 
> !important }
>         }
> Would pretty much ensure that all text was drawn with the SVGBraille 
> font at
> a size of 30 (in the local coordinate system - which may not always be 
> what you
> want) when the document is displayed on a 'braille' "media".  In the 
> Squiggle
> preferences you can set what the output media type is and provide a user 
> style sheet.
> Similarly the svgrasterizer allows you to specify the media and user 
> style sheet to use.

Thanks for this idea. I now have something to play with before new
questions will appear.


All the best,
       Vladimir




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


Re: custom text rendering?

Posted by Thomas DeWeese <Th...@Kodak.com>.
Vladimir Bulatov wrote:

> Hi Thomas,
> 
> Thomas DeWeese wrote:
> 
>> Hi Vladimir,
>>
>> Vladimir Bulatov wrote:
>>
> ......
> 
>>   I'm not sure I fully understand what you mean by
>> 'pass text strings directly to print driver'.  This is
>> Java we never talk to something as low level as a driver.
>> We do talk to Java's implementation of Graphics2D for Print.
> 
>  > _Most_ of our text is drawn using 'drawGlyphVector'  in
>  > cases where the text is stroked, or based on an SVG Font
>  > we may draw shapes to the Graphics2D.
> 
> I understand this. In reality Graphics2D rasterises text, which
> it does bad in case of low resolution raster we have (20 dpi).
> However, if simple text output is used it may actually pass
> text directly to system (windows) to render it and system
> passes it to our printer driver. But this is not my main concern.
> My main concern is where to insert my special rendering code to
> be compatible with Batik architecture.

   I assume by 'low resolution raster' you mean the font you have is
a '20 dpi' raster font so a braille dot is just one pixel correct?

   Have you tried constructing an SVGFont for Braille. It seems like
it would be _really_ easy (even if you restricted yourself to
the 'd' attribute and didn't use 'circle' elements as children of the
Glyphs - which I would recommend - it wouldn't be that hard).  This should
solve the problem of the low resolution raster..

>>   If you want to 'reimplement' text most of the work
>> is done by the SVGTextElementBridge in the org.apache.batik.bridge
>> package. However if all you want to do is extract the text
>> from the document I wouldn't bother with Batik I
>> would just use a little XSLT - so I imagine you want
>> something more than just "text strings".
> 
> Just text extraction is not an option.
> We are working on graphics, which represent information, like data
> plots, maps, diagrams. So, actual rendering of the shapes is
> important. I looked into SVGTextElementBridge already.
> I traced down text rendering to intresting method:
> org.apache.batik.bridge.BridgeContext.setTextPainter(TextPainter 
> textPainter);
> It looks like this is the place to change text renderer
> implementation. But this method is not used anywhere in Batik and
> I am wondering what was the initial intent to have this method.

   So people could change the text rendering implementation :)

   FOP does/did this so it could generate 'cleaner' text for PDF.
You might want to look at what they did (http://xml.apache.org/fop) I
think the code of interest would be in the org.apache.fop.pdf package.

>>   That all said my initial response on how to modify output
>> for braille would be to use something like a user style sheet, with
>> an '@media braille' rule.  The Batik browser allows you to set
>> the CSS Media in use for display.
> 
> Can you explain a little more. What happens if I will use
> '@media braille' in CSS? Will rendering be done by something else.
> How I implement rendering for that rule? Is it possible to use
> different rules for printing and for monitor?

So a user stylesheet like:

@media braille { text  { font-family: SVGBraille !important; font-size: 30 !important }
		 tspan { font-family: SVGBraille !important; font-size: 30 !important }
		 tref  { font-family: SVGBraille !important; font-size: 30 !important }
		}

Would pretty much ensure that all text was drawn with the SVGBraille font at
a size of 30 (in the local coordinate system - which may not always be what you
want) when the document is displayed on a 'braille' "media".  In the Squiggle
preferences you can set what the output media type is and provide a user style sheet.
Similarly the svgrasterizer allows you to specify the media and user style sheet to use.

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




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


Re: custom text rendering?

Posted by Vladimir Bulatov <bu...@physics.orst.edu>.
Hi Thomas,

Thomas DeWeese wrote:

> Hi Vladimir,
> 
> Vladimir Bulatov wrote:
> 
......
>   I'm not sure I fully understand what you mean by
> 'pass text strings directly to print driver'.  This is
> Java we never talk to something as low level as a driver.
> We do talk to Java's implementation of Graphics2D for Print.
 > _Most_ of our text is drawn using 'drawGlyphVector'  in
 > cases where the text is stroked, or based on an SVG Font
 > we may draw shapes to the Graphics2D.

I understand this. In reality Graphics2D rasterises text, which
it does bad in case of low resolution raster we have (20 dpi).
However, if simple text output is used it may actually pass
text directly to system (windows) to render it and system
passes it to our printer driver. But this is not my main concern.
My main concern is where to insert my special rendering code to
be compatible with Batik architecture.

> 
>   If you want to 'reimplement' text most of the work
> is done by the SVGTextElementBridge in the org.apache.batik.bridge
> package. However if all you want to do is extract the text
> from the document I wouldn't bother with Batik I
> would just use a little XSLT - so I imagine you want
> something more than just "text strings".

Just text extraction is not an option.
We are working on graphics, which represent information, like data
plots, maps, diagrams. So, actual rendering of the shapes is
important. I looked into SVGTextElementBridge already.
I traced down text rendering to intresting method:
org.apache.batik.bridge.BridgeContext.setTextPainter(TextPainter textPainter);
It looks like this is the place to change text renderer
implementation. But this method is not used anywhere in Batik and
I am wondering what was the initial intent to have this method.

> 
>   That all said my initial response on how to modify output
> for braille would be to use something like a user style sheet, with
> an '@media braille' rule.  The Batik browser allows you to set
> the CSS Media in use for display.
> 

Can you explain a little more. What happens if I will use
'@media braille' in CSS? Will rendering be done by something else.
How I implement rendering for that rule? Is it possible to use
different rules for printing and for monitor?

Vladimir






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


Re: custom text rendering?

Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Vladimir,

Vladimir Bulatov wrote:

> Hello everybody,
>   We are using Batik for writing accessible SVG viewer to be
> used by blind computer users to access to graphical information.
> We use special tactile graphics printer as output device and
> special touch screen as input device and replacement for
> a mouse. This is just some background info to explain, that
> we may have unusual requirements.
> 
> The problem we currently have with Batik is to find a way to
> print text in a custom way. Text for blind users should be
> printed in a special way. Most popular is Braille code, when
> every character is represented by combination of dots on 2 by 3
> or 2 by 4 matrix with 1/10 inch distance between dots.
> This size roughly corresponds to 29 or 36 points font size.
> Other ways to represent text are possible depending on characters
> size. But, in any case, tactile representation should be very much
> different from visual representation.
> 
> We need an advise on the best way to customize Batik
> to allow special text rendering. Visual representation should
> remain the same to be useful for sighted user. Only printed
> copy should be different. Ideally we would like to be to have
> the ability to pass text strings directly to printer driver
> (we are on windows platform and have quite sophisticated
> driver, which converts text into Braille itself), bypassing
> Batik rasterizer.

   I'm not sure I fully understand what you mean by
'pass text strings directly to print driver'.  This is
Java we never talk to something as low level as a driver.
We do talk to Java's implementation of Graphics2D for Print.
_Most_ of our text is drawn using 'drawGlyphVector'  in
cases where the text is stroked, or based on an SVG Font
we may draw shapes to the Graphics2D.

   If you want to 'reimplement' text most of the work
is done by the SVGTextElementBridge in the org.apache.batik.bridge
package. However if all you want to do is extract the text
from the document I wouldn't bother with Batik I
would just use a little XSLT - so I imagine you want
something more than just "text strings".

   That all said my initial response on how to modify output
for braille would be to use something like a user style sheet, with
an '@media braille' rule.  The Batik browser allows you to set
the CSS Media in use for display.

> Any advice would be appreciated.
> 
> All the best,
>        Vladimir Bulatov
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 
> 




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