Thanks Markus.
|
In the Matlab Live Editor, I see the following:
No warnings, and the text displays fine (although clipped at the right edge of the figure).
|
Out of curiosity, has Matlab completely removed the use of the "*" placeholder or can it still be used to name The default font (that) depends on your operating system and locale [1]?
For example
[1] https://www.mathworks.com/help/matlab/ref/matlab.graphics.primitive.text-properties.html#budt_bq-1_sep_shared-FontName
|
In the Matlab Live Editor both return 'Helvetica'.
Replacing "Helvetica" by "*" in annotation.m like Pantxo suggested avoids the warnings for me. That looks like a reasonable change for the stable branch.
|
I think we should use the default "*" font for annotation objects. Hardcoding the font name was a bad design and we should not try to find a "better" one. There will always be systems where this or that font is not installed.
Now whether we want to follow Matlab and let "get (h, 'fontname')" return the name of the actual font that is used by default, is another question.
What does Matlab return here:
|
Same results on Windows with Matlab R2018b:
|
The annotation object has several subtypes. See https://www.mathworks.com/help/matlab/ref/annotation.html. The only ones that appear to have a "FontName" property are TextArrow and TextBox objects. Testing with Matlab R2018b showed "Helvetica" was the default font, and that setting the "DefaultTextFontName" property affected the font used by TextArrow, TextBox objects.
|
Can this be fixed with the fontconfig configuration that is shipped with Octave? Helvetica is a sensible default font since it is the default in the PostScript file format.
Is there a way in Matlab to configure the default font that is used for annotation objects? The documentation doesn't make it clear if there is. Is it taken from 'DefaultTextFontName' or 'DefaultAxesFontName'?
|
Replacing "Helvetica" with "Calibri" in annotation.m also works well in Windows
|
You're right: Almost every Windows system will see this warning. Unless Helvetica was installed manually.
But I don't think that we should change to Arial on all platforms. Afaik, Arial isn't available by default on Linux. So almost all Linux users would probably see this warning.
Also it would be interesting to see which default fonts Matlab uses on which platform. I am pretty sure this is Helvetica for Linux (and Mac?). On Windows, this is probably Arial. But it might also be Calibri which seems to have become the new default font in recent Windows versions.
If possible, we should use the same defaults for compatibility imho.
|
Just to clarify, there is no problem with "my" system,
because I am using the Windows MXE-Octave.
Second, it seems that the problem is from annotation.m
If we change the "Helvetica" to "Arial" everything is fine,
in Windows. I did not check in linux.
A simple patch attached.
(file #46295)
|
The time until the release of Octave is quite short. This is "just" a warning and the replacement font used seems to be Arial anyway. Given these facts, I am re-targeting this bug to the development branch.
Maybe we can consider grafting any possible changes for a dot release of Octave 5.
If someone provides a changeset that prevents this warning without needing too intrusive changes in the next few days, it can still be considered for the final release.
|
Sounds like a plan.
That "Helvetica" in
looks to happen only when the fld variable is "displayname", i.e., obj.displayname. I don't see "DisplayName" in properties anywhere.
Nonetheless, I put some text inside that _maybe_munge_text_ routine and although for the demo in question the "string" gets called, the "displayname" never does. So, that particular "Helvetica" isn't being used in this case. (But it should be changed, as you suggest. Why even set the font here rather than use
?)
Yeah, I see "Helvetica" is specifically called out in the annotation.m demos. I temporarily declared a handle to be recorded as global:
Looking at the global variable after test indicates:
Creating some text object without a font results in:
I don't know if there needs to be a font declared for the demo... unless the demo were trying to illustrate font properties, naming, sizing, substitution, etc.
|
The problem is probably that we shouldn't use "Helvetica" on Windows (because it isn't installed by default).
It is used as the default font in annotation.m.
If I search the Octave sources for "Helvetica", it is also used in _gnuplot_draw_axes_.m and gl2ps-print.cc.
In _gnuplot_draw_axes_ at line 2328 we set "Arial" as a fall back font on Windows. A little bit further down in line 2386, "Helvetica" is used as a fall back font.
Maybe we should use "Arial" as the default font for Windows everywhere?
I wonder what Matlab is doing.
|
Good point. I didn't understand that the Octave print script didn't even print with the change from bug #55648.
I've done
and see no warning on my system. (Perhaps warnings are directed somewhere else on my system, but I see plenty of warnings coming from GTK+ and the usual GUI framework, generally speaking, not from this particular Octave/gnuplot script.) I've replaced "Helvetica" with "Sans", "Times", "BogusFont" and see no warnings. The "Times" selection results in a font that does have serifs, so at least the substitution seems to make sense.
I don't think I'd consider this an Octave bug. In fact, it isn't even a gnuplot bug, as I don't see the phrase "ugly output" in the gnuplot source tree anywhere. I've cloned the Pango source
https://www.pango.org/Download
git clone https://gitlab.gnome.org/GNOME/pango.git
and here's where I see the phrase 'ugly output':
So it is a Pango warning.
Why Avinoam sees the warning and I don't, I have no idea. A.K., when you started seeing this warning, had you just finished a system upgrade or something? Perhaps a linux bundle decided to compile Pango or gnuplot in some kind of verbose mode or something.
I've searched the Pango code for g_warning but don't see it inside a header file, so it's definition must come glib:
https://developer.gnome.org/glib/unstable/glib-Message-Logging.html#g-warning
and I'm guessing there is some way to compile with/without warning messages and perhaps on Avinoam's system the glib warnings are appearing somehow. However, I do imagine on my system there is all kinds of font substitution going on as well.
|
@Dan: Attached is the output of running the following with the patch from bug #55648:
I don't know how to call drawnow to produce the debug file without the patch from bug #55648.
Is this what you were asking for?
(file #46280)
|
This is a gnuplot warning, merely saying it can't find the requested font. The best thing to do is call drawnow() to get a look at the actual gnuplot code generated before/after the application of the patch for bug #@55648. It could be that the patch is actually doing something correct such that the font request is now complete, or vice versa it is doing something wrong such that the requested font string is incorrect. Look at
"help drawnow"
sending the gnuplot script code to files before.gp and after.gp. We can then see if the gnuplot code makes sense.
|
Reopen, since I get this message after using the patch from
bug #55648
|
No response. Assuming this is no longer an issue.
|
@Avinoam: Is this warning still present? I think Octave tries to use FreeSans as the default font now and we ship that font with MXE Octave.
|
This is a new warning, did not appear in previous versions.
|