Labels on figures fail to display in a deployed Matlab application

조회 수: 3(최근 30일)
Itai
Itai 2012년 9월 19일
답변: Juulia Suvilehto 2015년 3월 3일
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
Tasha
Tasha 2014년 7월 14일
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.

댓글을 달려면 로그인하십시오.

답변(2개)

Malcolm Lidierth
Malcolm Lidierth 2012년 9월 19일
Have you tried one of Java's virtual fonts e.g. 'Serif' or 'SansSerif"? Those should work cross-platform
  댓글 수: 2
Itai
Itai 2012년 9월 20일
tried loading fonts as suggested in this post, by jianboli http://ubuntuforums.org/showthread.php?t=818607. No change.

댓글을 달려면 로그인하십시오.


Juulia Suvilehto
Juulia Suvilehto 2015년 3월 3일
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