MCPcopy Index your code
hub / github.com/benfry/processing4 / PFont

Class PFont

core/src/processing/core/PFont.java:80–1128  ·  view source on GitHub ↗

PFont is the font class for Processing. To create a font to use with Processing, select "Create Font..." from the Tools menu. This will create a font in the format Processing requires and also adds it to the current sketch's data directory. Processing displays fonts using the .vlw font format, which

Source from the content-addressed store, hash-verified

78 * @see PGraphics#textFont(PFont)
79 */
80public class PFont implements PConstants {
81
82 /** Number of character glyphs in this font. */
83 protected int glyphCount;
84
85 /**
86 * Actual glyph data. The length of this array won't necessarily be the
87 * same size as glyphCount, in cases where lazy font loading is in use.
88 */
89 protected Glyph[] glyphs;
90
91 /**
92 * Name of the font as seen by Java when it was created.
93 * If the font is available, the native version will be used.
94 */
95 protected String name;
96
97 /**
98 * Postscript name of the font that this bitmap was created from.
99 */
100 protected String psname;
101
102 /**
103 * The original size of the font when it was first created
104 */
105 protected int size;
106
107 /** Default density set to 1 for backwards compatibility with loadFont(). */
108 protected int density = 1;
109
110 /** true if smoothing was enabled for this font, used for native impl */
111 protected boolean smooth;
112
113 /**
114 * The ascent of the font. If the 'd' character is present in this PFont,
115 * this value is replaced with its pixel height, because the values returned
116 * by FontMetrics.getAscent() seem to be terrible.
117 */
118 protected int ascent;
119
120 /**
121 * The descent of the font. If the 'p' character is present in this PFont,
122 * this value is replaced with its lowest pixel height, because the values
123 * returned by FontMetrics.getDescent() are gross.
124 */
125 protected int descent;
126
127 /**
128 * A more efficient array lookup for straight ASCII characters. For Unicode
129 * characters, a QuickSort-style search is used.
130 */
131 protected int[] ascii;
132
133 /**
134 * True if this font is set to load dynamically. This is the default when
135 * createFont() method is called without a character set. Bitmap versions of
136 * characters are only created when prompted by an index() call.
137 */

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected