[Geoserver-users] Display labels in another language

Hello all,

I am wondering if there is a way to display characters of another language
(Chinese etc) to my map. Normally I display the labels using:

<TextSymbolizer>
          <label><ogc:PropertyName>name</ogc:PropertyName>
          </label>

        <CssParameter name="font-family">Times New Roman</CssParameter>
        <CssParameter name="font-style">Normal</CssParameter>
        <CssParameter name="font-size">10</CssParameter>
        <CssParameter name="font-weight">bold</CssParameter>
    
    <Fill>
        <CssParameter name="fill">#000000</CssParameter>
    </Fill>
</TextSymbolizer>

This seems to work fine when my data is in English characters but not
characters/alphabet of another language. What is my SLD missing?

Thank you,

elshae
--
View this message in context: http://old.nabble.com/Display-labels-in-another-language-tp29703100p29703100.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

On Mon, Sep 13, 2010 at 5:24 PM, elshae <itintern12@anonymised.com> wrote:

Hello all,

I am wondering if there is a way to display characters of another language
(Chinese etc) to my map. Normally I display the labels using:

<TextSymbolizer>
<label><ogc:PropertyName>name</ogc:PropertyName>
</label>

   &lt;CssParameter name=&quot;font\-family&quot;&gt;Times New Roman&lt;/CssParameter&gt;
   &lt;CssParameter name=&quot;font\-style&quot;&gt;Normal&lt;/CssParameter&gt;
   &lt;CssParameter name=&quot;font\-size&quot;&gt;10&lt;/CssParameter&gt;
   &lt;CssParameter name=&quot;font\-weight&quot;&gt;bold&lt;/CssParameter&gt;

<Fill>
<CssParameter name="fill">#000000</CssParameter>
</Fill>
</TextSymbolizer>

This seems to work fine when my data is in English characters but not
characters/alphabet of another language. What is my SLD missing?

Change the font-family to a font that has the characters of your
required language. Times New Roman has some accents I believe but for
really different character sets you'll need a specialised font.

Ian
--
Ian Turton

Ian Turton wrote:

Change the font-family to a font that has the characters of your
required language. Times New Roman has some accents I believe but for
really different character sets you'll need a specialised font.

Ian
--
Ian Turton

Hmmm I have tried with all of the usual fonts Arial, Verdana, Times New
Roman. Even if I do specify some specialized font in my SLD and install
that font on my OS, how can I be certain that my labels will always display
in let's say Chinese? I want to basically do what Google has done, the
Chinese names on their map always display as Chinese in the browser. I
really must be missing something here :-/

Thanks for all the help and feedback :slight_smile:

elshae

--
View this message in context: http://old.nabble.com/Display-labels-in-another-language-tp29703100p29784098.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

On 22/09/2010 23:15, elshae wrote:

Ian Turton wrote:

Change the font-family to a font that has the characters of your
required language. Times New Roman has some accents I believe but for
really different character sets you'll need a specialised font.

Ian
--
Ian Turton

Hmmm I have tried with all of the usual fonts Arial, Verdana, Times New
Roman. Even if I do specify some specialized font in my SLD and install
that font on my OS, how can I be certain that my labels will always display
in let's say Chinese? I want to basically do what Google has done, the
Chinese names on their map always display as Chinese in the browser. I
really must be missing something here :-/

The cases I've seen that displayed chinese chars required two things
to work properly:
- a specialized font supporting chinese characters (I don't think any
   of the ones you cited supports chinese)
- setting the proper encoding in the data sources (in that case it
   was a shapefile)

Afaik OpenStreetMap uses a special font that supports most asian
scripts, see here: http://wiki.openstreetmap.org/wiki/Mapnik#Optional:_CJK_font_fallback_support

Hope this helps

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

On Wed, Sep 22, 2010 at 5:15 PM, elshae <itintern12@anonymised.com> wrote:

Ian Turton wrote:

Change the font-family to a font that has the characters of your
required language. Times New Roman has some accents I believe but for
really different character sets you'll need a specialised font.

Ian
--
Ian Turton

Hmmm I have tried with all of the usual fonts Arial, Verdana, Times New
Roman. Even if I do specify some specialized font in my SLD and install
that font on my OS, how can I be certain that my labels will always display
in let's say Chinese? I want to basically do what Google has done, the
Chinese names on their map always display as Chinese in the browser. I
really must be missing something here :-/

Try chinese fonts - Google Search as I don't speak, read
or write Chinese you are on your own when it comes to making a choice
between them.

Ian
--
Ian Turton

I resolved the issue :slight_smile:

It turns out that my understanding of how Geoserver renders fonts was quite
misguided. Geoserver uses the same fonts as your Java runtime. Anyone
having this issue needs to go to the fonts folder of their current Java
Virtual Machine, drop the .ttf file of whichever font they desire to use and
then run

yum install ttmkfdir
cd /opt/sun-java-1.6.0/jre/lib/fonts/
ttmkfdir -o fonts.dir

Take a look at the very bottom of this page for a full description:
http://geoserver.org/display/GEOSDOC/1.1.4+CentOS+(Red+Hat)+5.1+Install

After all that is done, then you will need to go to the sld file that your
layer is using and insert the font name in XML tags in the font symbolizer
like :

<TextSymbolizer>
...
    
        <CssParameter name="font-family">Jomolhari-ID</CssParameter>
        <CssParameter name="font-style">Normal</CssParameter>
        <CssParameter name="font-size">14</CssParameter>
      
...
</TextSymbolizer>

If all has went well and you use the exact name of your font in the SLD as
shown above, then you should be able to see your labels clearly, provided
that you are also using the correct font for the language desired :slight_smile:

I really hope this helps others!

And feel free to let me know if I have made any mistakes/used wrongful
terminology!

Thanks,

elshae
--
View this message in context: http://old.nabble.com/Display-labels-in-another-language-tp29703100p29847085.html
Sent from the GeoServer - User mailing list archive at Nabble.com.