Skip to content

Commit

Permalink
Use new google noto font
Browse files Browse the repository at this point in the history
  • Loading branch information
paddywwoof committed Oct 11, 2016
1 parent 107f8f1 commit 783eafd
Show file tree
Hide file tree
Showing 14 changed files with 114 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Blur.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
next_time = time.time()+2.0

#load ttf font and set the font colour to 'raspberry'
arialFont = pi3d.Font("fonts/FreeMonoBoldOblique.ttf", (221,0,170,255),
arialFont = pi3d.Font("fonts/NotoSerif-Regular.ttf", (221,0,170,255),
add_codepoints=[256])
arialFont.blend = True #much better anitaliased look but must String.draw() after everything else
mystring = pi3d.String(font=arialFont, string=MESSAGE,
Expand Down
2 changes: 1 addition & 1 deletion FilterDemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
CAMERA = pi3d.Camera(scale=0.5)
CAM2D = pi3d.Camera(is_3d=False)

font = pi3d.Font("fonts/FreeMonoBoldOblique.ttf", (221,221,128,255))
font = pi3d.Font("fonts/NotoSerif-Regular.ttf", (221,221,128,255))
# list [[name, [list of custom vals -> unif[48:]], [list increments each frame]]]
filter_list = [ ["shaders/filter_toon", [0.0, 0.0, 0.0]], # outline_colour_r, g, b
["post_base", [2.5]], # sampling distance for convolution sampling
Expand Down
4 changes: 2 additions & 2 deletions FixedString.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
rendering and aims to provide
a host of exciting commands.'''

str1 = pi3d.FixedString('fonts/FreeSans.ttf', mytext, font_size=32, background_color=(200,140,20,235),
str1 = pi3d.FixedString('fonts/NotoSans-Regular.ttf', mytext, font_size=32, background_color=(200,140,20,235),
camera=CAMERA2D, shader=flatsh, f_type='SMOOTH')
str1.sprite.positionX(-300) #NB note Shape methods act on FixedString.sprite

str2 = pi3d.FixedString('fonts/FreeSans.ttf', mytext, font_size=24, f_type='BUMP')
str2 = pi3d.FixedString('fonts/NotoSerif-Regular.ttf', mytext, font_size=24, f_type='BUMP')
mycuboid = pi3d.Cuboid(camera=CAMERA, z=2, x=0.5)
mycuboid.set_draw_details(shader, [tex, str2], 1.0, 0.0)
#following is a bit low level but makes it fit nicely look in docs to see
Expand Down
24 changes: 12 additions & 12 deletions ForestQuickNumbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
#this block added for fast text changing
import time
CAMERA2D = pi3d.Camera(is_3d=False)
myfont = pi3d.Font('fonts/FreeMonoBoldOblique.ttf', codepoints='0123456789. FPStm:')
myfont = pi3d.Font('fonts/NotoSerif-Regular.ttf', codepoints='0123456789. FPStm:')
myfont.blend = True
tstring = "{:.0f}FPS tm:{:.1f} ".format(60,time.time())
lasttm = time.time()
Expand All @@ -125,17 +125,6 @@

# Display scene and move camera
while DISPLAY.loop_running():
####################
#this block added for fast text changing
tm = time.time()
fcount += 1
if tm > (lasttm + tdel):
newtstring = "{:.0f}FPS tm:{:.1f}".format(fcount / (tm - lasttm), tm)
mystring.quick_change(newtstring)
lasttm = tm
fcount = 0
mystring.draw()
####################
CAMERA.reset()
CAMERA.rotate(tilt, rot, 0)
CAMERA.position((xm, ym, zm))
Expand All @@ -150,6 +139,17 @@
mytrees2.draw()
mytrees1.draw()
# myecube.draw()
####################
#this block added for fast text changing
tm = time.time()
fcount += 1
if tm > (lasttm + tdel):
newtstring = "{:.0f}FPS tm:{:.1f}".format(fcount / (tm - lasttm), tm)
mystring.quick_change(newtstring)
lasttm = tm
fcount = 0
mystring.draw()
####################

mx, my = mymouse.position()

Expand Down
2 changes: 1 addition & 1 deletion Gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def rotm(self, *args):
DISPLAY.set_background(0.8,0.8,0.8,1.0) # r,g,b,alpha

shader = pi3d.Shader("uv_reflect")
font = pi3d.Font("fonts/FreeSans.ttf", color=(0,0,0,255), font_size=20)
font = pi3d.Font("fonts/NotoSans-Regular.ttf", color=(0,0,0,255), font_size=20)
gui = pi3d.Gui(font)
ww, hh = DISPLAY.width / 2.0, DISPLAY.height / 2.0

Expand Down
2 changes: 1 addition & 1 deletion Pong.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
camera.position((xm, 2 + ym, -maphalf - 2.5))

#scores
arialFont = pi3d.Font("fonts/FreeMonoBoldOblique.ttf", (221,0,170,255))
arialFont = pi3d.Font("fonts/NotoSerif-Regular.ttf", (221,0,170,255))
arialFont.blend = True
score = [0,0]
score0 = pi3d.String(font=arialFont, string=str(score[0]), y=12, sx=0.05, sy=0.05)
Expand Down
2 changes: 1 addition & 1 deletion Scenery.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def hall_pulse(channel):
####################
#this block added for fast text changing
CAMERA2D = pi3d.Camera(is_3d=False)
myfont = pi3d.Font('fonts/FreeMonoBoldOblique.ttf', color = (255, 230, 128, 255),
myfont = pi3d.Font('fonts/NotoSerif-Regular.ttf', color = (255, 230, 128, 255),
codepoints='0123456789. -goldoz:mskph')
myfont.blend = True
tstring = "gold {:05d}oz {:02d}m{:02d}s -{:4.1f}km {:3.1f}kph ".format(score, 0, 0, 0.0, 0.0)
Expand Down
2 changes: 1 addition & 1 deletion Shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
x=4, y=-1, z=10)
myPlane = pi3d.Plane(w=4, h=4, name="plane", z=12)
# Load ttf font and set the font colour to 'raspberry'
arialFont = pi3d.Font("fonts/FreeMonoBoldOblique.ttf", (221,0,170,255))
arialFont = pi3d.Font("fonts/NotoSerif-Regular.ttf", (221,0,170,255))
mystring = pi3d.String(font=arialFont, string="Now the Raspberry Pi really does rock", z=4)
mystring.set_shader(flatsh)

Expand Down
2 changes: 1 addition & 1 deletion Starfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import stars # tucked away in another file for tidyness!
s = stars.Stars()

font = pi3d.Font('fonts/FreeSans.ttf')
font = pi3d.Font('fonts/NotoSans-Regular.ttf')
name_loc = s.v[list(s.names)] # this will be a view of the full array, only for named stars
label = pi3d.String(font=font, string='Sol', y=-250, is_3d=False, camera=CAM2D)
label.set_shader(flatsh)
Expand Down
2 changes: 1 addition & 1 deletion StringMulti.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class EgClass(object):
text_pos = QWIDTH

working_directory = os.path.dirname(os.path.realpath(__file__))
font_path = os.path.abspath(os.path.join(working_directory, 'fonts', 'FreeSans.ttf'))
font_path = os.path.abspath(os.path.join(working_directory, 'fonts', 'NotoSans-Regular.ttf'))

# Create pointFont and the text manager to use it
pointFont = pi3d.Font(font_path, font_colour, codepoints=list(range(32,128)))
Expand Down
92 changes: 92 additions & 0 deletions fonts/LICENSE_OFL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
This Font Software is licensed under the SIL Open Font License,
Version 1.1.

This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL

-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font
creation efforts of academic and linguistic communities, and to
provide a free and open framework in which fonts may be shared and
improved in partnership with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply to
any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software
components as distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to,
deleting, or substituting -- in part or in whole -- any of the
components of the Original Version, by changing formats or by porting
the Font Software to a new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed,
modify, redistribute, and sell modified and unmodified copies of the
Font Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components, in
Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the
corresponding Copyright Holder. This restriction only applies to the
primary font name as presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created using
the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file added fonts/NotoSans-Regular.ttf
Binary file not shown.
Binary file added fonts/NotoSerif-Regular.ttf
Binary file not shown.
Binary file added fonts/Str437.ttf
Binary file not shown.

0 comments on commit 783eafd

Please sign in to comment.