That's what I get for not reading the entire email. Appologies.
Okay, step by step. Lets look at phrase...
public Phrase(String string, Font font) {
this(Float.NaN, string, font);
}
public Phrase(float leading, String string, Font font) {
this.leading = leading;
this.font = font;
/* bugfix by August Detlefsen */
if (string != null && string.length() != 0) {
super.add(new Chunk(string, font));
}
}
Okay, that's promising. Have you called getChunks() and gone looking
for fonts there? And I don't see anything in Phrase that would null out
the font... Are you sure Fonts.RED isn't null?
PS: Setting the stroke color doesn't change the /text/ color at all...
Unless you're using a non-standard text render mode. Are you guessing
you're getting null because setStrokeColor doesn't do anything? The
default behavior (text render mode 0) is to fill text paths, not stroke
them.
PPS: both stroking and filling text and playing with the line width is a
way to whip up a "poor man's bold" font if all you have is the
"regular".
--Mark Storer
Senior Software Engineer
Cardiff.com
import legalese.Disclaimer;
Disclaimer<Cardiff> DisCard = null;
> -----Original Message-----
> From: Jason Berk [mailto:[email protected]]
> Sent: Tuesday, September 14, 2010 1:14 PM
> To: Post all your questions about iText here
> Subject: [iText-questions] get font color from phrase
>
> How do I get the color of a font used to create a phrase?
>
> // in the statement decorator
> Phrase footer = new Phrase(String.format(FOOTER, phone,
> email), Fonts.RED); statement.addPhrase(footer, 130, 275f);
>
> // in the statement class
> public void addPhrase(Phrase phrase, float x, float y) {
> String text = phrase.getContent();
> canvas.saveState();
> canvas.setColorStroke(Colors.BLACK);
> // fails - canvas.setColorStroke(phrase.getFont().getColor());
> // phrase.getFont().getColor() returns null
> canvas.beginText();
> canvas.moveText(x, y);
> canvas.setFontAndSize(phrase.getFont().getBaseFont(),
> phrase.getFont().getSize());
> canvas.showText(text);
> canvas.endText();
> canvas.restoreState();
> }
>
> ***This is a transmission from Purdue Employees Federal
> Credit Union (PEFCU) and is intended solely for its
> authorized recipient(s), and may contain information that is
> confidential and or legally privileged. If you are not an
> addressee, or the employee or agent responsible for
> delivering it to an addressee, you are hereby notified that
> any use, dissemination, distribution, publication or copying
> of the information contained in this email is strictly
> prohibited. If you have received this transmission in error,
> please notify us by telephoning (765)
> 497-3328 or returning the email. You are then instructed to
> delete the information from your computer. Thank you for your
> cooperation.***
>
>
> --------------------------------------------------------------
> ----------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Buy the iText book: http://www.itextpdf.com/book/
> Check the site with examples before you ask questions:
> http://www.1t3xt.info/examples/
> You can also search the keywords list:
> http://1t3xt.info/tutorials/keywords/
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 9.0.851 / Virus Database: 271.1.1/3131 - Release
> Date: 09/13/10 23:35:00
>
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/