Skip to content

Commit b5baaa4

Browse files
committed
include Source Sans and use it as the default font
1 parent 740e4b5 commit b5baaa4

5 files changed

Lines changed: 113 additions & 3 deletions

File tree

core/build.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@
126126
<fileset dir="src">
127127
<include name="processing/opengl/shaders/*.glsl" />
128128
<include name="processing/opengl/cursors/*.png" />
129+
<include name="font/ProcessingSansPro-*" />
129130
<include name="icon/*.png" />
130131
</fileset>
131132
</copy>
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
"Processing Sans" fonts are just "Source Sans", but renamed to
2+
prevent conflicts on Windows with other versions of Source Sans.
3+
https://github.com/processing/processing/issues/4747
4+
5+
6+
Copyright 2010, 2012, 2014 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries.
7+
8+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
9+
10+
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
11+
12+
13+
-----------------------------------------------------------
14+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
15+
-----------------------------------------------------------
16+
17+
PREAMBLE
18+
The goals of the Open Font License (OFL) are to stimulate worldwide
19+
development of collaborative font projects, to support the font creation
20+
efforts of academic and linguistic communities, and to provide a free and
21+
open framework in which fonts may be shared and improved in partnership
22+
with others.
23+
24+
The OFL allows the licensed fonts to be used, studied, modified and
25+
redistributed freely as long as they are not sold by themselves. The
26+
fonts, including any derivative works, can be bundled, embedded,
27+
redistributed and/or sold with any software provided that any reserved
28+
names are not used by derivative works. The fonts and derivatives,
29+
however, cannot be released under any other type of license. The
30+
requirement for fonts to remain under this license does not apply
31+
to any document created using the fonts or their derivatives.
32+
33+
DEFINITIONS
34+
"Font Software" refers to the set of files released by the Copyright
35+
Holder(s) under this license and clearly marked as such. This may
36+
include source files, build scripts and documentation.
37+
38+
"Reserved Font Name" refers to any names specified as such after the
39+
copyright statement(s).
40+
41+
"Original Version" refers to the collection of Font Software components as
42+
distributed by the Copyright Holder(s).
43+
44+
"Modified Version" refers to any derivative made by adding to, deleting,
45+
or substituting -- in part or in whole -- any of the components of the
46+
Original Version, by changing formats or by porting the Font Software to a
47+
new environment.
48+
49+
"Author" refers to any designer, engineer, programmer, technical
50+
writer or other person who contributed to the Font Software.
51+
52+
PERMISSION & CONDITIONS
53+
Permission is hereby granted, free of charge, to any person obtaining
54+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
55+
redistribute, and sell modified and unmodified copies of the Font
56+
Software, subject to the following conditions:
57+
58+
1) Neither the Font Software nor any of its individual components,
59+
in Original or Modified Versions, may be sold by itself.
60+
61+
2) Original or Modified Versions of the Font Software may be bundled,
62+
redistributed and/or sold with any software, provided that each copy
63+
contains the above copyright notice and this license. These can be
64+
included either as stand-alone text files, human-readable headers or
65+
in the appropriate machine-readable metadata fields within text or
66+
binary files as long as those fields can be easily viewed by the user.
67+
68+
3) No Modified Version of the Font Software may use the Reserved Font
69+
Name(s) unless explicit written permission is granted by the corresponding
70+
Copyright Holder. This restriction only applies to the primary font name as
71+
presented to the users.
72+
73+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
74+
Software shall not be used to promote, endorse or advertise any
75+
Modified Version, except to acknowledge the contribution(s) of the
76+
Copyright Holder(s) and the Author(s) or with their explicit written
77+
permission.
78+
79+
5) The Font Software, modified or unmodified, in part or in whole,
80+
must be distributed entirely under this license, and must not be
81+
distributed under any other license. The requirement for fonts to
82+
remain under this license does not apply to any document created
83+
using the Font Software.
84+
85+
TERMINATION
86+
This license becomes null and void if any of the above conditions are
87+
not met.
88+
89+
DISCLAIMER
90+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
91+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
92+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
93+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
94+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
95+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
96+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
97+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
98+
OTHER DEALINGS IN THE FONT SOFTWARE.
282 KB
Binary file not shown.

core/src/processing/core/PGraphics.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4237,7 +4237,18 @@ protected void shape(PShape shape, float x, float y, float z, float c, float d,
42374237
* Used by PGraphics to remove the requirement for loading a font.
42384238
*/
42394239
protected PFont createDefaultFont(float size) {
4240-
Font baseFont = new Font("Lucida Sans", Font.PLAIN, 1);
4240+
Font baseFont;
4241+
try {
4242+
// For 4.0 alpha 4 and later, include a built-in font
4243+
InputStream input = getClass().getResourceAsStream("/font/ProcessingSansPro-Regular.ttf");
4244+
baseFont = Font.createFont(Font.TRUETYPE_FONT, input);
4245+
4246+
} catch (Exception e) {
4247+
// Fall back to how this was handled in 3.x, ugly!
4248+
e.printStackTrace(); // dammit
4249+
baseFont = new Font("Lucida Sans", Font.PLAIN, 1);
4250+
}
4251+
// Create a PFont from this java.awt.Font
42414252
return createFont(baseFont, size, true, null, false);
42424253
}
42434254

todo.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ X implement auto-download for JNA updates
1010
X “Exception in thread "Contribution Uninstaller" NullPointerException” during Remove
1111
X https://github.com/processing/processing4/issues/174
1212
X catch NoClassDefError in Platform.deleteFile() (still unclear of its cause)
13+
X need to set a nicer default font
14+
X increases export size, but impact is so worth it
1315

1416
earlier
1517
o further streamline the downloader
@@ -33,8 +35,6 @@ _ include JNA so that sketches can also scale properly?
3335
_ what happens re: getting scaled/high-res graphics?
3436
_ make that a preference? (and double the size by default?)
3537

36-
_ need to set a nicer default font
37-
_ increases export size, but impact is so worth it
3838
_ new FloatList(float...)
3939

4040
already fixed in 4.x? (confirm/close on release)

0 commit comments

Comments
 (0)