forked from processing/processing-web-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateFont.xml
More file actions
executable file
·85 lines (63 loc) · 3.45 KB
/
Copy pathcreateFont.xml
File metadata and controls
executable file
·85 lines (63 loc) · 3.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<name>createFont()</name>
<category>Typography</category>
<subcategory>Loading & Displaying</subcategory>
<usage>Web & Application</usage>
<example>
<image></image>
<code><![CDATA[
PFont myFont;
void setup() {
size(200, 200);
// Uncomment the following two lines to see the available fonts
//String[] fontList = PFont.list();
//println(fontList);
myFont = createFont("FFScala", 32);
textFont(myFont);
text("!@#$%", 10, 50);
}
]]></code>
</example>
<description><![CDATA[
Dynamically converts a font to the format used by Processing from either a font name that's installed on the computer, or from a .ttf or .otf file inside the sketches "data" folder. This function is an advanced feature for precise control. On most occasions you should create fonts through selecting "Create Font..." from the Tools menu.
<br /><br />
Use the <b>PFont.list()</b> method to first determine the names for the fonts recognized by the computer and are compatible with this function. Because of limitations in Java, not all fonts can be used and some might work with one operating system and not others. When sharing a sketch with other people or posting it on the web, you may need to include a .ttf or .otf version of your font in the data directory of the sketch because other people might not have the font installed on their computer. Only fonts that can legally be distributed should be included with a sketch.
<br /><br />
The <b>size</b> parameter states the font size you want to generate. The <b>smooth</b> parameter specifies if the font should be antialiased or not, and the <b>charset</b> parameter is an array of chars that specifies the characters to generate.
<br /><br />
This function creates a bitmapped version of a font in the same manner as the Create Font tool. It loads a font by name, and converts it to a series of images based on the size of the font. When possible, the text() function will use a native font rather than the bitmapped version created behind the scenes with createFont(). For instance, when using the default renderer setting (JAVA2D), the actual native version of the font will be employed by the sketch, improving drawing quality and performance. With the P2D, P3D, and OPENGL renderer settings, the bitmapped version will be used. While this can drastically improve speed and appearance, results are poor when exporting if the sketch does not include the .otf or .ttf file, and the requested font is not available on the machine running the sketch.
]]></description>
<syntax><![CDATA[
createFont(<kbd>name</kbd>, <kbd>size</kbd>)
createFont(<kbd>name</kbd>, <kbd>size</kbd>, <kbd>smooth</kbd>)
createFont(<kbd>name</kbd>, <kbd>size</kbd>, <kbd>smooth</kbd>, <kbd>charset</kbd>)
]]></syntax>
<parameter>
<label>name</label>
<description><![CDATA[String: name of the font to load]]></description>
</parameter>
<parameter>
<label>size</label>
<description><![CDATA[float: point size of the font]]></description>
</parameter>
<parameter>
<label>charset</label>
<description><![CDATA[char[]: array containing characters to be generated]]></description>
</parameter>
<parameter>
<label>smooth</label>
<description><![CDATA[boolean: true for an antialiased font, false for aliased]]></description>
</parameter>
<returns>PFont</returns>
<related>
PFont
textFont()
text()
loadFont()
</related>
<availability>1.0</availability>
<type>Function</type>
<partof>Core</partof>
<level>Extended</level>
</root>