Specific Fonts not found on Mac causes Java Runtime to Hang Momentarily
retiutut opened this issue ยท 7 comments
On Mac, consistently getting this message to console. This also slows down GUI session initilzation. I think this is even happening before I have the chance to change the GPlot fonts.
"SansSerif.plain" is not available, so another font will be used. Use PFont.list() to show available fonts.
"SansSerif.bold" is not available, so another font will be used. Use PFont.list() to show available fonts.
When I do PFont.list():
Serif SansSerif Monospaced Dialog DialogInput .SFNSText .SFNSText-Bold ACIDLABEL ACaslonPro-Bold ACaslonPro-BoldItalic ACaslonPro-Italic ACaslonPro-Regular ..... (no SansSerif.plain or .bold)
I see that the fontName assignment is hardCoded in GTitle.java
public GTitle(PApplet parent, float[] dim) {
this.parent = parent;
this.dim = dim.clone();
relativePos = 0.5f;
plotPos = relativePos * this.dim[0];
offset = 10;
text = "";
textAlignment = CENTER;
fontName = "SansSerif.bold";
fontColor = this.parent.color(100);
fontSize = 13;
font = this.parent.createFont(fontName, fontSize);
}
This fix would apply to GAxisLabel.java, GHistogram.java, GLayer.java, GAxis.java, and GTitle.java .
Maybe we can detect OS and for Mac use just "SansSerif".
I can help fix this in the code if I can get assistance on how to compile this library using Eclipse.
Base Issue:
OpenBCI/OpenBCI_GUI#630
Hi!,
There is this GPlot method that changes all the font properties at once:
https://github.com/jagracar/grafica/blob/master/src/grafica/GPlot.java#L2331
Would that work for you?
The same method is available for the axes and the title.
But I agree, this should be handled directly by the library. I will add some code to check the available fonts with PFont.list() and select the correct font accordingly.
Thank you for reporting the issue!
@jagracar Seems to launch on Windows and Ubuntu Linux just fine, this is limited to Mac OS. ๐
Haven't updated to Catalina yet, so I'm running OS X Mojave 10.14.6.
Hi! I think I fixed the problem in my latests commits. I created a new version of the library (1.9.1). Let me know if it works!
Great use of 1 liner ternary expressions ๐. I'll try to spin this up in the GUI.
Yes! C'est bon: it works!