[Geoserver-users] Bold fonts in styles folder rendered wrong

Hi all,

it seems that there is a problem with rendering bold and/or italic fonts correctly which are *not* installed on the system but only put into the %GEOSERVER_DATA_DIR/styles folder.

The GS loads the font and renders it. However, if the font-weight is specified as 'bold' or the font-style as 'italic' in the SLD, the display is not quite correct. It is, however, correct for the 'normal' font-style/weight.

Now I made some tests and found out that the bold/italic fonts are correctly rendered only if they are installed on the system or put into the $JRE_HOME/lib/fonts folder. Then the web interface also recognises all font types as "being installed in the JVM". This is not the case (deliberately?) if the fonts are instead being put into the styles folder.

I attached some screenshots to illustrate the issue and show the slight differences in rendering. The geometry with the star fill gets the different font-styles assigned while the other geometries have the normal style. The screenshots with *_JRE.png show the correct rendering, those with *_styles.png the wrong one.

I tested this exemplarily with the font "Gudea" from Google Web Fonts (cf. http://www.google.com/fonts/specimen/Gudea) but it also happens with plain Arial...

I have three separate .ttf files for each font styling, i.e. "Gudea-Bold.ttf", "Gudea-Regular.ttf" and "Gudea-Italic.ttf".

My setup is:
- Ubuntu 13.04
- GeoServer 2.3.0
- Java version: Sun Microsystems Inc.: 1.6.0_45 (Java HotSpot(TM) Server VM)

The workaround to just install the fonts in the JVM is basically O.K. but can get annoying if you have many fonts and servers. I'd prefer the solution to have the fonts in the styles folder so if anyone knows anything about this issue I would appreciate any help!

Thanks in advance and best regards,
Matthias

gudea_bold_JRE.png

gudea_bold_styles.png

gudea_italic_bold_JRE.png

gudea_italic_bold_styles.png

gudea_italic_JRE.png

gudea_italic_styles.png

On Thu, Sep 26, 2013 at 10:53 AM, Matthias Uden <matthias.uden@anonymised.com>wrote:

Hi all,

it seems that there is a problem with rendering bold and/or italic fonts
correctly which are *not* installed on the system but only put into the
%GEOSERVER_DATA_DIR/styles folder.

The GS loads the font and renders it. However, if the font-weight is
specified as 'bold' or the font-style as 'italic' in the SLD, the display
is not quite correct. It is, however, correct for the 'normal'
font-style/weight.

As far as I remember when we load font from the data dir the ability to
turn then bold/italic is lost, you basically
have to refer directly to the ttf file name having the styling you desire,
eg.., Gudea-Bold.ttf.
However, not sure how you'd get a bold/italic effect, unless you also have
a file like that.

It may be a limitation in our implementation, but as far as I can see Java
itself does not allow to load more
than a single TFF file when creating a font:
http://docs.oracle.com/javase/6/docs/api/java/awt/Font.html#createFont(int,%20java.io.File)

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

Hi Andrea,

thanks for your explanation, it does make sense to me that this is not a bug but rather a limitation in the Java environment.
I'd say it's fine as long as you know about this behaviour and use the workaround instead. I just wanted to let you and the ML know, maybe there will be a solution for this in some future release..

Cheers,
Matthias

Am 30.09.2013 12:15, schrieb Andrea Aime:

On Thu, Sep 26, 2013 at 10:53 AM, Matthias Uden <matthias.uden@anonymised.com
<mailto:matthias.uden@anonymised.com>> wrote:

    Hi all,

    it seems that there is a problem with rendering bold and/or italic
    fonts correctly which are *not* installed on the system but only put
    into the %GEOSERVER_DATA_DIR/styles folder.

    The GS loads the font and renders it. However, if the font-weight is
    specified as 'bold' or the font-style as 'italic' in the SLD, the
    display is not quite correct. It is, however, correct for the
    'normal' font-style/weight.

As far as I remember when we load font from the data dir the ability to
turn then bold/italic is lost, you basically
have to refer directly to the ttf file name having the styling you
desire, eg.., Gudea-Bold.ttf.
However, not sure how you'd get a bold/italic effect, unless you also
have a file like that.

It may be a limitation in our implementation, but as far as I can see
Java itself does not allow to load more
than a single TFF file when creating a font:
http://docs.oracle.com/javase/6/docs/api/java/awt/Font.html#createFont(int,%20java.io.File)

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it for
more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk

_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users