Hello all,

I've been tracking down a bug in my software that takes a WMF file, and 
puts it into a PDF using iTesxtSharp v4.0.5. The content of the WMF is 
legal text that certain jurisdictions require be no-smaller-than a 
particular point-size. (The "fine print" cannot be too fine.) I put the 
WMF into a PDF using PdfContentByte.AddImage of a iTextSharp.text.Image 
instantiated from the WMF file.

Trouble is that the PDF contains text that has shrunk by a factor of 0.86.

I walked through the code and came to this method in 
iTextSharp.text.pdf.codec.wmf.MetaFont that I do not understand:

         public float GetFontSize(MetaState state) {
             return Math.Abs(state.TransformY(height) - 
state.TransformY(0)) * 0.86f;
         }

The math is fairly clear in the WMF file and what you're doing with it, 
but I don't understand why you apply that 0.86f fudge factor.

Is this a bug? Are you compensating for some difference between the 
WMF's LOGFONT structure and your MetaFont object? Do you expect an 
inexact match to the closest available font?

(I'm inclined to the former, because I saw another place where you 
replaced the LOGFONT height with its absolute value. (When negative, 
this causes a discrepancy by the amount of the font's internal leading.) 
Moreover, your code that reads META_CREATEFONTINDIRECT gets confused if 
the WMF record erroneously fails to pad the unused characters after the 
zero-terminated typeface name.)

Please advise,

steve

------------------------------------------------------------------------------
This SF Dev2Dev email is sponsored by:

WikiLeaks The End of the Free Internet
http://p.sf.net/sfu/therealnews-com
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to