How should I set font size?

View: New views
3 Messages — Rating Filter:   Alert me  

How should I set font size?

by Andrea_Conti :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am using Adobe Open Type Font (OTF) files.  The page is set to be Letter size.
 I am using the HTMLWorker and have styles set up using LoadTagStyle.  I have
tried to set the font size using "font-size" and "size".  Assuming the size in
points I want is 10, I have tried "10", "10px", and "10pt".  The fonts don't
look the way I expect them to be sized.  I even tried the "px" with the point
size modified as per the message at the URL below.

http://www.junlu.com/msg/382253.html

The leading also doesn't seem to work properly.  Is that in points?


Thanks in advance for any insight into this.

Andrea Conti


-------------------------------------------------------------------------
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=/
_______________________________________________
itextsharp-questions mailing list
itextsharp-questions@...
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions

Re: How should I set font size?

by Paulo Soares-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Works for me. That's all I can say considering that you posted no standalone code to reproduce the problem.

Paulo

> -----Original Message-----
> From: itextsharp-questions-bounces@...
> [mailto:itextsharp-questions-bounces@...]
> On Behalf Of Andrea Conti
> Sent: Wednesday, September 03, 2008 5:49 AM
> To: itextsharp-questions@...
> Subject: [itextsharp-questions] How should I set font size?
>
> I am using Adobe Open Type Font (OTF) files.  The page is set
> to be Letter size.
>  I am using the HTMLWorker and have styles set up using
> LoadTagStyle.  I have
> tried to set the font size using "font-size" and "size".
> Assuming the size in
> points I want is 10, I have tried "10", "10px", and "10pt".
> The fonts don't
> look the way I expect them to be sized.  I even tried the
> "px" with the point
> size modified as per the message at the URL below.
>
> http://www.junlu.com/msg/382253.html
>
> The leading also doesn't seem to work properly.  Is that in points?
>
>
> Thanks in advance for any insight into this.
>
> Andrea Conti

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 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=/
_______________________________________________
itextsharp-questions mailing list
itextsharp-questions@...
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions

Re: How should I set font size?

by Andrea_Conti :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Paulo Soares <psoares@...> writes:

> > -----Original Message-----
> > From: itextsharp-questions-bounces@...
> > [mailto:itextsharp-questions-bounces@...]
> > On Behalf Of Andrea Conti
> > Sent: Wednesday, September 03, 2008 5:49 AM
> > To: itextsharp-questions@...
> > Subject: [itextsharp-questions] How should I set font size?
> >
> > I am using Adobe Open Type Font (OTF) files.  The page is set
> > to be Letter size.
> >  I am using the HTMLWorker and have styles set up using
> > LoadTagStyle.  I have
> > tried to set the font size using "font-size" and "size".
> > Assuming the size in
> > points I want is 10, I have tried "10", "10px", and "10pt".
> > The fonts don't
> > look the way I expect them to be sized.  I even tried the
> > "px" with the point
> > size modified as per the message at the URL below.
> >
> > http://www.junlu.com/msg/382253.html
> >
> > The leading also doesn't seem to work properly.  Is that in points?
> >
> >
> > Thanks in advance for any insight into this.
> >
> > Andrea Conti
>
> Works for me. That's all I can say considering that you posted no standalone
code to reproduce the problem.
>
> Paulo

*note: I am using Gmane to keep this threaded and it won't allow top-posting*

I have created a sample project solution using Visual Studio 2005.  

http://www.box.net/shared/jud57jinv1

If you download this and open the Solution file you will see that there is a
WindowsApplication1 project.  There is also ItextSharp and fonts.  So the whole
thing is self contained.  You should be able to run the project by pressing F5.

I put in crazy font sizes for the text and use "p", "body", "h5", and "h6" to
try various sizes for the main text.  You will see that the text does not look
like the sizes that are set.  Also, I put breakpoints in each place that I found
"font-size" referenced.  The code is not hit!

Below are the places and questions I have about that.
======================================
text\html\markup.cs

/** the CSS tag for the font size */
public const string CSS_KEY_FONTSIZE = "font-size";


public static float ParseLength(string str)
This parses the font-size and will handle these suffixes:
// inches
if (str.StartsWith("in")) {
    return f * 72f;
}
// centimeters
if (str.StartsWith("cm")) {
    return (f / 2.54f) * 72f;
}
// millimeters
if (str.StartsWith("mm")) {
    return (f / 25.4f) * 72f;
}
// picas
if (str.StartsWith("pc")) {
    return f * 12f;
}
// default: we assume the length was measured in points
return f;



text\html\simpleparser\FactoryProperties.cs

else if (key.Equals(Markup.CSS_KEY_FONTSIZE)) {
h["size"] =
Markup.ParseLength(prop[key]).ToString(NumberFormatInfo.InvariantInfo) + "px";}

QUESTION: Why is "px" being added here automatically?


text\html\htmlwriter.cs

if (font.Size != Font.UNDEFINED) {
 WriteCssProperty(Markup.CSS_KEY_FONTSIZE, font.Size.ToString() + "pt");
 

QUESTION: Why add "pt" here?

======================================


Thanks in advance for looking at this.
Andrea Conti


-------------------------------------------------------------------------
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=/
_______________________________________________
itextsharp-questions mailing list
itextsharp-questions@...
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions
LightInTheBox - Buy quality products at wholesale price!