Labels on figures fail to display in a deployed Matlab application

2 ビュー (過去 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 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 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.

カテゴリ

Help Center および File ExchangeDesktop についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by