I have a C# console application that I want to run on Linux. I've compiled it in MonoDevelop and on my machine (Ubuntu 12.04 LTS, 64 bit) it runs fine. However, on a VPS I have rented (same OS but no X11), while the application starts without problems, I get exceptions at runtime.
The call that causes the exception is the MeasureText method of class System.Windows.Forms.TextRenderer. In case you're wondering what this method is doing in a console app, it needs to measure the length of text rendered in a certain font for calculating the correct placements of text elements in SVG files it's creating. Exception message and stack trace excerpt below:
An exception was thrown by the type initializer for System.Windows.Forms.XplatUI
at System.Windows.Forms.TextRenderer.MeasureTextInternal (IDeviceContext dc, System.String text, System.Drawing.Font font, Size proposedSize, TextFormatFlags flags, Boolean useMeasureString) [0x00000] in <filename unknown>:0
at System.Windows.Forms.TextRenderer.MeasureText (System.String text, System.Drawing.Font font) [0x00000] in <filename unknown>:0
I think I have installed the font in question correctly on the server, at least it shows up when I call fc-list. So do I need X for this or are there ways around it? Am I just missing some package install on the server? Failing that, is there maybe an alternative that I could use to achieve the text measuring?