Labels on figures fail to display in a deployed Matlab application

1 Ansicht (letzte 30 Tage)
Itai
Itai am 19 Sep. 2012
Beantwortet: Juulia Suvilehto am 3 Mär. 2015
I have a Matlab application deployed using Builder JA. I incorporated it into a larger Java-based web application. It was built on a Windows machine, which has actual matlab on it, and worked fine when I tested it there. I've deployed the application onto a Linux server, which has only the MCR on it. what happens now is that I can run the application via the web page, but the resulting graphs display only the graphics and not the text (title, axis labels, etc). This happens both when I use WebFigure(gcf) and when I use figtoImStream(gcf, jpg), so I don't think it's an issue with any one format. The issue seems to be in the hardcopy.p function, since the server logs show an error
{Warning: Failed to draw text string}
{> In /usr/local/MATLAB/MATLAB_Compiler_Runtime/v717/toolbox/matlab/graphics/hardcopy.p>hardcopy at 28
In compiler/private/hardcopyOutput at 58
In figToImStream at 73
In Gaussian_WBfigures_jpg at 635}
I've seen some things that suggest that this is an issue of Matlab looking for a font that isn't there, and some that suggest that this is an issue with the renderer, but I've tried all three possible renderers with no change (actually, OpenGL wasn't available and it defaulted to ZBuffer). I also added a couple of lines which should have been able to take care of an unavailable font problem:
list=listfonts;
set(0, 'defaultAxesFontName',list{1});
Somewhere, I saw a suggestion that Matlab was just generating white text strings on white background, but with the error I got, can that be the case?
Does anyone have a solution for this?
  1 Kommentar
Tasha
Tasha am 14 Jul. 2014
Was this problem resolved? I'm seeing similar behavior, but in a different environment (R2014a + MCR + Java Servlet deployment).
I am using MATLAB WebFigures and when I deploy the .war file on a Linux machine, the figure shows up in the web browser with only graphics and no text. Works fine (text appears) on the MacOS of the development machine as well as the localhost (VMware + Ubuntu) on that same development machine.

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Malcolm Lidierth
Malcolm Lidierth am 19 Sep. 2012
Have you tried one of Java's virtual fonts e.g. 'Serif' or 'SansSerif"? Those should work cross-platform
  2 Kommentare
Itai
Itai am 20 Sep. 2012
Tried resetting the default axis fonts in Matlab to 'Serif' and to 'SansSerif', with no change. Also tried using a nonsensical font name 'weaselweasel'- in Matlab on my development machine (windows), the graph still printed with all text labels, while on the Linux server the text labels still do not show up and the same error is generated. Is there some way I can change the font elsewhere?
Itai
Itai am 20 Sep. 2012
tried loading fonts as suggested in this post, by jianboli http://ubuntuforums.org/showthread.php?t=818607. No change.

Melden Sie sich an, um zu kommentieren.


Juulia Suvilehto
Juulia Suvilehto am 3 Mär. 2015
I had a similar problem (R2014a + MCR). My error pointed to line where I save the figure using export_fig. Manually setting font to one of the system fonts
b = listfonts;
title(title,'FontName', b{1});
and saving with saveas (as opposed to export_fig) solved the problem for me.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by