No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

60 líneas
1.3 KiB

  1. /**
  2. * libcaca Java bindings for libcaca
  3. * Copyright (c) 2009 Adrien Grand <jpountz@dinauz.org>
  4. *
  5. * This library is free software. It comes without any warranty, to
  6. * the extent permitted by applicable law. You can redistribute it
  7. * and/or modify it under the terms of the Do What the Fuck You Want
  8. * to Public License, Version 2, as published by Sam Hocevar. See
  9. * http://www.wtfpl.net/ for more details.
  10. */
  11. package org.zoy.caca;
  12. public class Font extends NativeObject {
  13. static {
  14. Caca.load();
  15. }
  16. private static native long loadFont(String fontName);
  17. private static native long loadFont(byte[] fontBytes);
  18. public Font(String fontName) {
  19. ptr = loadFont(fontName);
  20. }
  21. public Font(byte[] fontBytes) {
  22. ptr = loadFont(fontBytes);
  23. }
  24. public static native String[] getFontNames();
  25. private static native int getFontWidth(long fontPtr);
  26. public int getWidth() {
  27. return getFontWidth(ptr);
  28. }
  29. private static native int getFontHeight(long fontPtr);
  30. public int getHeight() {
  31. return getFontHeight(ptr);
  32. }
  33. private static native int[][] getFontBlocks(long fontPtr);
  34. public int[][] getBlocks() {
  35. return getFontBlocks(ptr);
  36. }
  37. private static native void freeFont(long fontPtr);
  38. @Override
  39. public void finalize() throws Throwable {
  40. freeFont(ptr);
  41. super.finalize();
  42. }
  43. }