Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JEditorPane html font size

163 views
Skip to first unread message

Carina Ehrmann

unread,
Feb 2, 2004, 11:28:09 AM2/2/04
to
Hello,

i want to display text with font size 30pt in a JEditorPane with the tag
"<font size="30pt">". But it is not displayed that big. How can i
display the text that big with the font size tag? Is there a limitation
for the size?

Thanks Carina

Christian Kaufhold

unread,
Feb 2, 2004, 4:35:27 PM2/2/04
to
Carina Ehrmann <carina....@gmx.de> wrote:

> i want to display text with font size 30pt in a JEditorPane with the tag
> "<font size="30pt">". But it is not displayed that big. How can i

Just wanting is not enough.

> display the text that big with the font size tag? Is there a limitation
> for the size?

RTFM: http://www.w3.org/TR/html4/present/graphics.html#edef-FONT


size = cdata [CN]

Deprecated. This attribute sets the size of the font. Possible values:

An integer between 1 and 7. This sets the font to some fixed size, whose
rendering depends on the user agent. Not all user agents may render all
seven sizes.
A relative increase in font size. The value "+1" means one size larger.
The value "-3" means three sizes smaller. All sizes belong to the scale
of 1 to 7.

You *can* use the style attribute:

<font style="font-size: 30pt">


Christian
--
And in short, I was afraid.

Andrew Thompson

unread,
Feb 2, 2004, 10:47:24 PM2/2/04
to
"Christian Kaufhold" ...

> Carina Ehrmann wrote:
>
> > i want to display text with font size 30pt in a JEditorPane with the tag
> > "<font size="30pt">". But it is not displayed that big. How can i
>
> Just wanting is not enough.
>
> > display the text that big with the font size tag? Is there a limitation
> > for the size?
...

> size = cdata [CN]
>
> Deprecated. This attribute sets the size of the font. Possible values:

I took particular interest in this post, since
I have been consulting the c.i.w.a.s groups
recently while updating my sites.

Now, the following test html validates*..

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test Font Size</title>
<meta http-equiv="CONTENT-TYPE" content="text/html; charset=iso-8859-1">
</head>
<body>
<p><font size='30pt'>Abc</font>de.</p>
</body>
</html>

* http://validator.w3.org/

Note that if I had not lazily copied the doctype
from another document, it would have read
"3.2", the flavour that a JEP will understand.

If the JEP fails for that html, my guess is that
either the html the OP is supplying is invalid,
or the JEP has a 'maximum size' set internally.

Unfortunately for the OP, I am too lazy to go
checking it further at this instant, but I would
not mind having a look over an sscce..
http://www.physci.org/codes/sscce.jsp

So ..given you (Christian) know about 10 times
as much as I ever want to know about GUI's,
I'll put the question to you.

Did I misunderstand something here, or
did you perhaps get this one wrong?

--
Andrew Thompson
* http://www.PhySci.org/ Open-source software suite
* http://www.PhySci.org/codes/ Web & IT Help
* http://www.1point1C.org/ Science & Technology


Christian Kaufhold

unread,
Feb 3, 2004, 9:15:41 AM2/3/04
to
Andrew Thompson <SeeMy...@www.invalid> wrote:
> "Christian Kaufhold" ...
>> Carina Ehrmann wrote:
>>
>> > i want to display text with font size 30pt in a JEditorPane with the tag
>> > "<font size="30pt">". But it is not displayed that big. How can i
>>
>> Just wanting is not enough.
>>
>> > display the text that big with the font size tag? Is there a limitation
>> > for the size?
> ...
>> size = cdata [CN]

^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^


> Now, the following test html validates*..
>
> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <title>Test Font Size</title>
> <meta http-equiv="CONTENT-TYPE" content="text/html; charset=iso-8859-1">
> </head>
> <body>
> <p><font size='30pt'>Abc</font>de.</p>
> </body>
> </html>

http://www.w3.org/TR/html4/sgml/intro.html#h-19.1

http://www.w3.org/TR/html4/types.html#type-cdata

For some HTML 4 attributes with CDATA attribute values, the specification
imposes further constraints on the set of legal values for the attribute
that may not be expressed by the DTD.


Specifying that the allowed values are 1, 2, 3, 4, 5, 6, 7, +1, +2, +3, +4,
-1, -2 (for usual BASEFONT=3) is not expressible by the DTD.

Christian

andreadoria

unread,
Sep 13, 2014, 5:49:49 PM9/13/14
to
html in a Java String use:
"<FONT style=\"font-size: 16pt\" COLOR=000064 FACE=SansSerif>"


Roedy Green

unread,
Sep 25, 2014, 6:49:43 AM9/25/14
to
On Sat, 13 Sep 2014 16:49:44 -0500, andreadoria
<andrea...@hotmail.com> wrote, quoted or indirectly quoted someone
who said :

>html in a Java String use:
>"<FONT style=\"font-size: 16pt\" COLOR=000064 FACE=SansSerif>"

It also understands css inline style.

e.g.

/**
* want a mono font so code will align.
*/
private static final String stylesheet = "<style
type=\"text/css\">\n"
+
"body{font-family:Consolas,\"Bitstream Vera Sans Mono\"," +
"\"Lucida
Console\",monospace;}\n"
+
"span.depth{color:blue;background-color:white!important;}\n"
+ "</style>\n";

/**
* DOCTYPE for generated HTML
*/
private static final String DOCTYPE = "<!DOCTYPE HTML PUBLIC
\"-//W3C//DTD HTML 4.01 Transitional//EN\" " +
"\"http://www.w3.org/TR/html4/loose.dtd\">";


/**
* where we display the code with unbalanced delimiter
*/
private JEditorPane jep;


sb.append( DOCTYPE );
sb.append( "<html lang=\"en-CA\"><head>" );
sb.append( stylesheet ); // in theory this should not work.
Only HTML 3.2 guaranteed to be supported.
sb.append( "</head><body><pre><span>" );

jep.setContentType( "text/html" );
jep.setText( sb.toString() );
--
Roedy Green Canadian Mind Products http://mindprod.com
There are only two industries that refer to their customers as users.
~ Edward Tufte (born: 1942 age: 72)
0 new messages