Hi, 
I am actually using iTextSharp, but I don't know if this problem is specific
to iTextSharp or is a general problem (or misunderstanding by me) of iText.
I am working with some embedded fonts that don't have italic options. So, to
get around this, I am doing a skew transformation, and the italicization
looks ok. But it is offsetting the x value as well, even though I am passing
0 for x and y (e and f) values in my matrix. 
In other words, I am doing something like this:

float x = 28F;
float y = 100F;
float italicization = xFontSize / 100F;
Matrix m = new Matrix(1F, 0F, italicization, 1F, 0F, 0F);
cb.Transform(m);
cb.ShowTextAligned(0, Content[i].Trim(), x, y, 0F);
m = new Matrix(1F, 0F, 0F-italicization, 1F, 0F, 0F);
cb.Transform(m);
cb.ShowTextAligned(0, Content[i].Trim(), x, y, 0F);

so, first I write the string (Content[i]) in pseudo-italics, then transform
back to original and write it un0-italicized for comparison. 
The offset varies, but depending (I think) on font size and maybe also on
string length, the offset is by 2 to 6 characters. 

I have been trying many combinations of italicization values, offsetting x
by variable amounts, and so on, but I can’t get this to come out right. 
I also tried this but it does exactly the same thing.:

Matrix m = new Matrix(1F, 0F, italicization, 1F, x, 0F);
cb.Transform(m);
cb.ShowTextAligned(iAlign, Content[i].Trim(), 0F, y, 0F);
m = new Matrix(1F, 0F, 0F-italicization, 1F, 0F-x, 0F);
cb.Transform(m);
cb.ShowTextAligned(iAlign, Content[i].Trim(), x, y, 0F);


Interstingly,m I had this working, sort of – I was just doing this:

cb.ConcatCTM(1F, 0F, italicization, 1F, 0F, 0F);
cb.SaveState();
cb.ShowTextAligned(0, Content[i].Trim(), x, y, 0F);
cb.RestoreState();

and this was giving me good results, but was then causing a PDf error:
Illegal operation 'Q' inside a text object. (this all happens inside a
beginText()-endText() block, which I guess is not ok).

Does anyone have any ideas about this? I am going crazy. I can give you more
info as needed – I tried to give enough, but maybe not…

Thanks, 
Ian



-- 
View this message in context: 
http://www.nabble.com/pseudo-italic-%28transform%29-causing-horizontal-offset-tp19533150p19533150.html
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to