v3.4.3 bug: Text Trait format inconsistent between clients

I have been testing a module on Linux and finding that text is not fitting in the same space that it fits into on the Mac (and, I believe on the PC). I have seen this on my own Linux laptop (recently installed) and also a tester reported it.

This occurs in Vassal v3.4.2 and v3.4.3.

Here is the comparison…

[attachment=1]text trait - bad format (linux).png[/attachment]

[attachment=0]Text Trait - correct format (mac).png[/attachment]

The Font on Linux is not correct and that looks like it may be causing the problem. The font is specified in HTML in the text trait,

Perhaps, that is not a Vassal issue ?

Different OSes have different fonts available, and different font rendering engines. Mac, Windows and Linux have whole different font rendering philosophies. Even on the same system, font rendering can be different between Java versions, and even the same Java version on the same platform can render fonts differently, depending on whether it’s Oracle’s JVM with their proprietary fonts and font rendering engine, or OpenJDK VM with their open-source fonts and rendering engine. On top of that, it’s a subjective matter, some prefer Windows’ font rendering, others Mac’s and Linux’es.

The new HTML-enabled text labels have turned module designers into part-time web developers, the only thing we can suggest is to familiarize yourself with the different font rendering engines, and test modules on all platforms.

Or just leave 50-100% extra space for labels.

Generally, this is quite an old problem in computer science. Decades ago, one Donald Knuth wanted to publish books and write them in a format that creates the books just as he wanted them to look like. When he found out there is no such format, he wrote his own format and font rendering engine.

You are not using one of the “standard Java fonts” that are quasi-guaranteed to be both available and approximately the same on different platforms. Once you go “off the reservation” and use a specific named font family (like in your case Georgia), you then have a problem as soon as the module is run on a machine that does not come with the Georgia font family installed. Their OS will pick “some other font” to load instead, and those OS algorithms as you can see are not great.

You’ve probably wondered why Vassal doesn’t let you select from all the many pretty fonts on your system (when configuring a text box, etc), and this is actually the reason why – trying to make cross-platform development sane.

Thanks both. I can adjust and re-test until I find something that works.

So, the solution I have arrived at - thanks to the pointers given above - is to set a fixed width in HTML e.g. <p style=text-align:center;width:160px;font-family:"+gblPromptFonts+";> This was a useful discovery, as it means I can create & maintain such text panels much more easily now (yes, I am one of those Vassal module “part-time web developers” :slight_smile: ).

One thing that I noticed is that the pixel width specified in HTML (in a text trait) did not match with the pixels on the map. For example, to overlay a piece sized 50 pixels wide (verified outside of Vassal and with the LoS thread), I had to specified the html width tag as 40px. Curious as to what is going on there but my cross-platform issue is looking solved, thanks again both.