Grayscale bitmap font class used by Processing. Awful (and by that, I mean awesome) ASCII (non-)art for how this works: | | height is the full used height of the image | | ..XX.. } | ..XX.. } | ...... } | XXXX.. } topExtent (
| 61 | * @see PGraphics#textFont(PFont) |
| 62 | */ |
| 63 | public class PFont implements PConstants { |
| 64 | |
| 65 | /** Number of character glyphs in this font. */ |
| 66 | protected int glyphCount; |
| 67 | |
| 68 | /** |
| 69 | * Actual glyph data. The length of this array won't necessarily be the |
| 70 | * same size as glyphCount, in cases where lazy font loading is in use. |
| 71 | */ |
| 72 | protected Glyph[] glyphs; |
| 73 | |
| 74 | /** |
| 75 | * Name of the font as seen by Java when it was created. |
| 76 | * If the font is available, the native version will be used. |
| 77 | */ |
| 78 | protected String name; |
| 79 | |
| 80 | /** |
| 81 | * Postscript name of the font that this bitmap was created from. |
| 82 | */ |
| 83 | protected String psname; |
| 84 | |
| 85 | /** |
| 86 | * The original size of the font when it was first created |
| 87 | */ |
| 88 | protected int size; |
| 89 | |
| 90 | /** Default density set to 1 for backwards compatibility with loadFont(). */ |
| 91 | protected int density = 1; |
| 92 | |
| 93 | /** true if smoothing was enabled for this font, used for native impl */ |
| 94 | protected boolean smooth; |
| 95 | |
| 96 | /** |
| 97 | * The ascent of the font. If the 'd' character is present in this PFont, |
| 98 | * this value is replaced with its pixel height, because the values returned |
| 99 | * by FontMetrics.getAscent() seem to be terrible. |
| 100 | */ |
| 101 | protected int ascent; |
| 102 | |
| 103 | /** |
| 104 | * The descent of the font. If the 'p' character is present in this PFont, |
| 105 | * this value is replaced with its lowest pixel height, because the values |
| 106 | * returned by FontMetrics.getDescent() are gross. |
| 107 | */ |
| 108 | protected int descent; |
| 109 | |
| 110 | /** |
| 111 | * A more efficient array lookup for straight ASCII characters. For Unicode |
| 112 | * characters, a QuickSort-style search is used. |
| 113 | */ |
| 114 | protected int[] ascii; |
| 115 | |
| 116 | /** |
| 117 | * True if this font is set to load dynamically. This is the default when |
| 118 | * createFont() method is called without a character set. Bitmap versions of |
| 119 | * characters are only created when prompted by an index() call. |
| 120 | */ |
nothing calls this directly
no outgoing calls
no test coverage detected