stroker = library.createStroker(); stroker.set((int)(parameter.borderWidth * 64f), parameter.borderStraight ? FreeType.FT_STROKER_LINECAP_BUTT : FreeType.FT_STROKER_LINECAP_ROUND,
public Face newMemoryFace(ByteBuffer buffer, int faceIndex) { long face = newMemoryFace(address, buffer, buffer.remaining(), faceIndex); if(face == 0) { if (BufferUtils.isUnsafeByteBuffer(buffer)) BufferUtils.disposeUnsafeByteBuffer(buffer); throw new GdxRuntimeException("Couldn't load font, FreeType error code: " + getLastErrorCode()); } else { fontData.put(face, buffer); return new Face(face, this); } }
stroker = library.createStroker(); stroker.set((int)(parameter.borderWidth * 64f), parameter.borderStraight ? FreeType.FT_STROKER_LINECAP_BUTT : FreeType.FT_STROKER_LINECAP_ROUND,
face = library.newMemoryFace(buffer, faceIndex); if (face == null) throw new GdxRuntimeException("Couldn't create face for font: " + fontFile);
public Face newFace(FileHandle font, int faceIndex) { byte[] data = font.readBytes(); return newMemoryFace(data, data.length, faceIndex); }
public Stroker createStroker() { long stroker = strokerNew(address); if(stroker == 0) throw new GdxRuntimeException("Couldn't create FreeType stroker, FreeType error code: " + getLastErrorCode()); return new Stroker(stroker); }
@Override public void dispose () { doneFreeType(address); for(ByteBuffer buffer: fontData.values()) { if (BufferUtils.isUnsafeByteBuffer(buffer)) BufferUtils.disposeUnsafeByteBuffer(buffer); } }
/** Cleans up all resources of the generator. Call this if you no longer use the generator. */ @Override public void dispose () { face.dispose(); library.dispose(); }
public Face newMemoryFace(ByteBuffer buffer, int faceIndex) { long face = newMemoryFace(address, buffer, buffer.remaining(), faceIndex); if(face == 0) { if (BufferUtils.isUnsafeByteBuffer(buffer)) BufferUtils.disposeUnsafeByteBuffer(buffer); throw new GdxRuntimeException("Couldn't load font, FreeType error code: " + getLastErrorCode()); } else { fontData.put(face, buffer); return new Face(face, this); } }
public Face newMemoryFace(byte[] data, int dataSize, int faceIndex) { ByteBuffer buffer = BufferUtils.newUnsafeByteBuffer(data.length); BufferUtils.copy(data, 0, buffer, data.length); return newMemoryFace(buffer, faceIndex); }
public static Library initFreeType() { new SharedLibraryLoader().load("gdx-freetype"); long address = initFreeTypeJni(); if(address == 0) throw new GdxRuntimeException("Couldn't initialize FreeType library, FreeType error code: " + getLastErrorCode()); else return new Library(address); }
stroker = library.createStroker(); stroker.set((int)(parameter.borderWidth * 64f), parameter.borderStraight ? FreeType.FT_STROKER_LINECAP_BUTT : FreeType.FT_STROKER_LINECAP_ROUND,
public Face newFace(FileHandle fontFile, int faceIndex) { ByteBuffer buffer = null; try { buffer = fontFile.map(); } catch (GdxRuntimeException ignored) { // OK to ignore, some platforms do not support file mapping. } if (buffer == null) { InputStream input = fontFile.read(); try { int fileSize = (int)fontFile.length(); if (fileSize == 0) { // Copy to a byte[] to get the size, then copy to the buffer. byte[] data = StreamUtils.copyStreamToByteArray(input, 1024 * 16); buffer = BufferUtils.newUnsafeByteBuffer(data.length); BufferUtils.copy(data, 0, buffer, data.length); } else { // Trust the specified file size. buffer = BufferUtils.newUnsafeByteBuffer(fileSize); StreamUtils.copyStream(input, buffer); } } catch (IOException ex) { throw new GdxRuntimeException(ex); } finally { StreamUtils.closeQuietly(input); } } return newMemoryFace(buffer, faceIndex); }
public Face newFace(FileHandle fontFile, int faceIndex) { ByteBuffer buffer = null; try { buffer = fontFile.map(); } catch (GdxRuntimeException ignored) { // OK to ignore, some platforms do not support file mapping. } if (buffer == null) { InputStream input = fontFile.read(); try { int fileSize = (int)fontFile.length(); if (fileSize == 0) { // Copy to a byte[] to get the size, then copy to the buffer. byte[] data = StreamUtils.copyStreamToByteArray(input, 1024 * 16); buffer = BufferUtils.newUnsafeByteBuffer(data.length); BufferUtils.copy(data, 0, buffer, data.length); } else { // Trust the specified file size. buffer = BufferUtils.newUnsafeByteBuffer(fileSize); StreamUtils.copyStream(input, buffer); } } catch (IOException ex) { throw new GdxRuntimeException(ex); } finally { StreamUtils.closeQuietly(input); } } return newMemoryFace(buffer, faceIndex); }
public Stroker createStroker() { long stroker = strokerNew(address); if(stroker == 0) throw new GdxRuntimeException("Couldn't create FreeType stroker, FreeType error code: " + getLastErrorCode()); return new Stroker(stroker); }
public Stroker createStroker() { long stroker = strokerNew(address); if(stroker == 0) throw new GdxRuntimeException("Couldn't create FreeType stroker, FreeType error code: " + getLastErrorCode()); return new Stroker(stroker); }
public Face newMemoryFace(byte[] data, int dataSize, int faceIndex) { ByteBuffer buffer = BufferUtils.newUnsafeByteBuffer(data.length); BufferUtils.copy(data, 0, buffer, data.length); return newMemoryFace(buffer, faceIndex); }
/** Creates a new generator from the given font file. Uses {@link FileHandle#length()} to determine the file size. If the file * length could not be determined (it was 0), an extra copy of the font bytes is performed. Throws a * {@link GdxRuntimeException} if loading did not succeed. */ public FreeTypeFontGenerator (FileHandle fontFile, int faceIndex) { name = fontFile.nameWithoutExtension(); library = FreeType.initFreeType(); face = library.newFace(fontFile, faceIndex); if (checkForBitmapFont()) return; setPixelSizes(0, 15); }
public static Library initFreeType() { new SharedLibraryLoader().load("gdx-freetype"); long address = initFreeTypeJni(); if(address == 0) throw new GdxRuntimeException("Couldn't initialize FreeType library, FreeType error code: " + getLastErrorCode()); else return new Library(address); }
/** Cleans up all resources of the generator. Call this if you no longer use the generator. */ @Override public void dispose () { face.dispose(); library.dispose(); }