xmlgraphics-fop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher R. Maden" <cr...@maden.org>
Subject Re: How to translate characters?
Date Fri, 02 Sep 2011 19:48:10 GMT
On 09/02/2011 02:44 PM, Eric Douglas wrote:
> I see.  As I said I saw something in the FOP classes which appeared
> to be looking for such a code and translating it, but I just pulled
> up a .FO file and I see it's already translated to be
> <fo:inline>□</fo:inline> so there must be something in the Oracle
> Transformer.
> So it seems FOP just gets the actual square and still has to know
> what character it maps to in the font.
> 
> So I'm trying to pass in this text ("&#x25A1;") and get it to display
> with Java's Graphics2D.drawText().
> So I'm wondering if I translate that the same way I do to create this
> FO, with an XSL file and a Transformer or if there's a simpler
> method.
> So I'm looking at the class java.nio.charset.Charset trying to figure
> out if or how that connects to a custom font file.

Passing that string, you are passing a series of characters: ampersand,
number sign, lower-case Latin letter x, Arabic numeral two, etc.  You
need to pass the text “□” — a single character, white square.

If all you have is the character code (U+25A1), you can create a new
String using the code; one of the String constructors takes an array of
integer code points as an argument.

~Chris
-- 
Chris Maden, text nerd  <URL: http://crism.maden.org/ >
“The present tendency and drift towards the Police State gives all
 free Americans pause.” — Alabama Supreme Court, 1955
 (Pike v. Southern Bell Tel. & Telegraph, 81 So.2d 254)

Mime
View raw message