/** * Registers a font with the graphics system. * * @param name the name under which to register the font. * @param path the path to the font resource (relative to the asset manager's path prefix). * Currently only TrueType ({@code .ttf}) fonts are supported. */ public void registerFont(String name, String path) { try { _fonts.put(name, ((JavaAssets) assets()).requireResource(path).createFont()); } catch (Exception e) { platform.reportError("Failed to load font [name=" + name + ", path=" + path + "]", e); } }
/** * Registers a font with the graphics system. * * @param name the name under which to register the font. * @param path the path to the font resource (relative to the asset manager's path prefix). * Currently only TrueType ({@code .ttf}) fonts are supported. */ public void registerFont(String name, String path) { try { _fonts.put(name, ((JavaAssets) assets()).requireResource(path).createFont()); } catch (Exception e) { platform.reportError("Failed to load font [name=" + name + ", path=" + path + "]", e); } }
/** * Loads a Java font from {@code path}. Currently only TrueType ({@code .ttf}) fonts are * supported. * * @param path the path to the font resource (relative to the asset manager's path prefix). * @throws Exception if an error occurs loading or decoding the font. */ public Font getFont(String path) throws Exception { return requireResource(path).createFont(); }
/** * Loads a Java font from {@code path}. Currently only TrueType ({@code .ttf}) fonts are * supported. * * @param path the path to the font resource (relative to the asset manager's path prefix). * @throws Exception if an error occurs loading or decoding the font. */ public Font getFont(String path) throws Exception { return requireResource(path).createFont(); }