  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | JSP - A mailing list about Java Server Pages specification and reference | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | -none- | -none- 2007-09-04 - By Paulo Soares
Back Forget about getWidths(), that's only for single byte fonts.
String s = "some text"; String out = ""; for (int k = 0; k < s.Length(); ++k) { char c = s.getAt(k); if (c > 32 && c < 128) c += 0xff00; out += c; }
You can use 'out' now.
Paulo
> -- --Original Message-- -- > From: itext-questions-bounces@(protected) > [mailto:itext-questions-bounces@(protected)] On > Behalf Of m_squall-m > Sent: Tuesday, September 04, 2007 10:55 AM > To: itext-questions@(protected) > Subject: Re: [iText-questions] Justification/Character width size > > > I'm newbie in itext. How can i use full width forms starting > at \uff01? > bf.getWidths() does't return full set of font width array? > Sounds to me i'm so far away from the right code.:confused: > > > > Paulo Soares wrote: > > > > Use the full width forms starting at \uff01. > > > > Paulo > > > >> -- --Original Message-- -- > >> From: itext-questions-bounces@(protected) > >> [mailto:itext-questions-bounces@(protected)] On > >> Behalf Of m_squall-m > >> Sent: Tuesday, September 04, 2007 3:05 AM > >> To: itext-questions@(protected) > >> Subject: [iText-questions] Justification/Character width size > >> > >> > >> Hello, > >> > >> With Courier font i can get the text alignment properly. For > >> example i can > >> fix one line with 12 characters and it was align perfectly. > >> > >> But if i use other font (in my case ST-Song) it will not > >> align correctly. > >> Spaces will take less space and each character have it's own > >> width size. > >> > >> How can i set ST-Song font behave the same like Courier in > >> term of character > >> width size. > >> > >> I can set the character width using below code for Courier > but not for > >> ST-Song > >> > >> //Working > >> Font FontCourier = new Font(Font.COURIER); > >> FontCourier.setSize(12f); > >> BaseFont bfChinese = BaseFont.createFont(BaseFont.COURIER, > >> BaseFont.CP1252, > >> BaseFont.EMBEDDED); > >> > >> int[] widths = bfChinese.getWidths(); > >> for (int k = 0; k < widths.length; ++k) { > >> if (widths[k] != 0) > >> widths[k] = 1000; > >> } > >> bfChinese.setForceWidthsOutput(true); > >> Font FontChinese = new Font(bfChinese, 12, Font.NORMAL); > >> > >> //NOT WORKING > >> BaseFont bfChinese = BaseFont.createFont("STSongStd-Light", > >> "UniGB-UCS2-H", > >> BaseFont.NOT_EMBEDDED); > >> > >> int[] widths = bfChinese.getWidths(); > >> for (int k = 0; k < widths.length; ++k) { > >> if (widths[k] != 0) > >> widths[k] = 1000000; > >> } > >> bfChinese.setForceWidthsOutput(true); > >> Font FontChinese = new Font(bfChinese, 12, Font.NORMAL); > >> > >> Thank you. > >> > >> Regards, > >> Squall
Aviso Legal: Esta mensagem ? destinada exclusivamente ao destinat?rio. Pode conter informa? ?o confidencial ou legalmente protegida. A incorrecta transmiss?o desta mensagem n?o significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. ? proibido a qualquer pessoa que n?o o destinat?rio de usar, revelar ou distribuir qualquer parte desta mensagem.
Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message.
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ __ ____ ____ ____ ____ ____ ____ ____ ____ ____ iText-questions mailing list iText-questions@(protected) https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
|
|
 |