Called from textFont. Check the validity of args and print possible errors to the user before calling this. Subclasses will want to override this one. @param which font to set, not null @param size size to set, greater than zero
(PFont which, float size)
| 4312 | * @param size size to set, greater than zero |
| 4313 | */ |
| 4314 | protected void textFontImpl(PFont which, float size) { |
| 4315 | textFont = which; |
| 4316 | // if (hints[ENABLE_NATIVE_FONTS]) { |
| 4317 | // //if (which.font == null) { |
| 4318 | // which.findNative(); |
| 4319 | // //} |
| 4320 | // } |
| 4321 | /* |
| 4322 | textFontNative = which.font; |
| 4323 | |
| 4324 | //textFontNativeMetrics = null; |
| 4325 | // changed for rev 0104 for textMode(SHAPE) in opengl |
| 4326 | if (textFontNative != null) { |
| 4327 | // TODO need a better way to handle this. could use reflection to get |
| 4328 | // rid of the warning, but that'd be a little silly. supporting this is |
| 4329 | // an artifact of supporting java 1.1, otherwise we'd use getLineMetrics, |
| 4330 | // as recommended by the @deprecated flag. |
| 4331 | textFontNativeMetrics = |
| 4332 | Toolkit.getDefaultToolkit().getFontMetrics(textFontNative); |
| 4333 | // The following is what needs to be done, however we need to be able |
| 4334 | // to get the actual graphics context where the drawing is happening. |
| 4335 | // For instance, parent.getGraphics() doesn't work for OpenGL since |
| 4336 | // an OpenGL drawing surface is an embedded component. |
| 4337 | // if (parent != null) { |
| 4338 | // textFontNativeMetrics = parent.getGraphics().getFontMetrics(textFontNative); |
| 4339 | // } |
| 4340 | |
| 4341 | // float w = font.getStringBounds(text, g2.getFontRenderContext()).getWidth(); |
| 4342 | } |
| 4343 | */ |
| 4344 | |
| 4345 | handleTextSize(size); |
| 4346 | } |
| 4347 | |
| 4348 | |
| 4349 | /** |
no test coverage detected