@@ -2055,8 +2055,20 @@ protected float textWidthImpl(char[] buffer, int start, int stop) {
20552055 protected void textLineImpl (char [] buffer , int start , int stop ,
20562056 float x , float y ) {
20572057 Font font = (Font ) textFont .getNative ();
2058- // if (font != null && (textFont.isStream() || hints[ENABLE_NATIVE_FONTS])) {
20592058 if (font != null ) {
2059+ // If using the default font, warn the user when their code calls
2060+ // text() called with unavailable characters. Not done with all
2061+ // fonts because it would be too slow, but useful/acceptable for
2062+ // the default case because it will hit beginners/casual use.
2063+ if (textFont .getName ().equals (defaultFontName )) {
2064+ if (font .canDisplayUpTo (buffer , start , stop ) != -1 ) {
2065+ final String msg =
2066+ "Some characters not available in the current font, " +
2067+ "use createFont() to specify a typeface the includes them." ;
2068+ showWarning (msg );
2069+ }
2070+ }
2071+
20602072 /*
20612073 // save the current setting for text smoothing. note that this is
20622074 // different from the smooth() function, because the font smoothing
@@ -2109,7 +2121,7 @@ protected void textLineImpl(char[] buffer, int start, int stop,
21092121 //g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, textAntialias);
21102122 g2 .setRenderingHint (RenderingHints .KEY_ANTIALIASING , antialias );
21112123
2112- } else { // otherwise just do the default
2124+ } else { // otherwise, just do the default
21132125 super .textLineImpl (buffer , start , stop , x , y );
21142126 }
21152127 }
0 commit comments