Hey there,

I did some digging and fixed my problem. The problem was that
RtfWriter uses Font.getFamilyname() all over the place, and the family
name of Arial Italic and Arial Bold is just plain Arial. So when being
written to the RTF, the name Arial was put into the font table and
being used. And because FontFactory assumes that the writer was doing
things properly, it just reports the full font name as Arial Italic
and sets the style to 0 (plain) so that Arial Italic doesn't get
italisized :).

The solution was a new method in Font called getFullName() (code
below), and to change every occurance of getFamilyname() in
RtfWriter.java to getFullName(). This works for me, perhaps someone
that is in charge of this sort of thing has a better solution.

Thanks,
Craig

/**
 * Gets the full name as a String. If baseFont is null, then this
merely returns the value from
 * getFamilyname().
 *
 * @return the full name
 */
    public String getFullName() {
        if( baseFont == null ) return getFamilyname();

        String tmp = "unknown";
        String[][] names = baseFont.getFullFontName();
        for (int i = 0; i < names.length; i++) {
          if ("0".equals(names[i][2])) {
            return names[i][3];
          }
          if ("1033".equals(names[i][2])) {
            tmp = names[i][3];
          }
          if ("".equals(names[i][2])) {
            tmp = names[i][3];
          }
        }
        return tmp;
    }

On Wed, 12 May 2004 11:43:27 -0700, Craig Fleming
<[EMAIL PROTECTED]> wrote:

>I'm using FontFactory.getFont(...) to read font names from an existing
>document and output some text to RTF. Using the Font.BOLD and
>Font.ITALIC values for the 'style' parameter, the text comes out
>plain. However, if I use Font.UNDERLINE the text comes out underlined.
>I have tried this with both Arial and Times New Roman text in case the
>font had any issues, with the same results. Is this just a case where
>\b and \i are not being emitted by the document writer? (ie, is this
>easily fixed? :))




-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to