a colleague of mine in japan contacted us asking whether our in-world collaboration tools could be extended to support japanese characters — he had tried our internal, public sametime 3d servers and had noticed that while in-world chat and instant messaging worked just fine, our flipcharts, brain storming boards, calendar, and voting tools did just display rather boring little rectangles :-(
not good. even worse when it means lost leads. so i set out to investigate. since OpenSim is being used in japan, it was a fair assumption that we might have a font problem here. this was confirmed by a twitter from adamfrisby:
@DrScofield so it should load fine.Only issue you need to be aware of is fonts - you need to use a font with the correct charset availible.
so, first port of call: how are we specifying the font to use for text
rendering? digging through the OpenSim source i ended up in the
VectorRenderModule:
[csharp] private void GDIDraw(string data, Graphics graph, char dataDelim) { Point startPoint = new Point(0, 0); Point endPoint = new Point(0, 0); Pen drawPen = new Pen(Color.Black, 7); string fontName = "Arial"; float fontSize = 14; Font myFont = new Font(fontName, fontSize); SolidBrush myBrush = new SolidBrush(Color.Black); … [/csharp]
gulp: we’ve got it hard coded :-(
so, next question: can we change it dynamically? looking through the code, it seems like we might:
[csharp] … else if (nextLine.StartsWith("FontName")) { nextLine = nextLine.Remove(0, 8); fontName = nextLine.Trim(); myFont = new Font(fontName, fontSize); } … [/csharp]
except, hmph, there is no osSetFontName() OSSL function :-(
a couple of SMOPs later, we had osSetFontName() and could also
configure the default font name in OpenSim.ini, good. now to figure
out which linux font would do the trick.
i tried:1
- Arial — no good: doesn’t have japanese script support
- DejaVu Sans/Serif — again, no good, no japanese script support
- Kochi Mincho — works!
— the configuration for that one is:
[plain] [VectorRender] font_name = "Kochi Mincho" [/plain]
my next quest was to see whether i could find a font that would support the whole range: european scripts as well as japanese and also chinese.
…unfortunately, while windows users have Arial Unicode MS there is
no such complete beast available to linux users — yes, there are
fonts such as bitstream cybit, but their license conditions either
don’t allow commercial use or only for a single user. so, if you are
running under linux you need to localize your OpenSim installation via
OpenSim.ini.
but! at least we figured out how to get japanese character sets supported in OpenSim on linux and can now configure one of our sametime 3d servers to support japanese OpenSim users properly! :-)
-
lest you get the wrong impression: i know no japanese, instead i’m using google translate to produce suchs gems as “OpenSimは岩!”2 ↩
-
and hoping that the good folks at google don’t do a “Έχω τρεις όρχεις” on me… ↩
