Skip to content

Commit cfe6c40

Browse files
committed
dymo type example
1 parent b0b967d commit cfe6c40

File tree

3 files changed

+109
-0
lines changed

3 files changed

+109
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Impact Label is (c) 2011 Tension Type
2+
3+
By downloading and/or installing a Tension Type Free Font you agree to this licence:
4+
5+
This Tension Type Free Font is free to use in any and all of your personal and commercial work.
6+
7+
A donation is much appreciated, but not necessary (donations may be done through PayPal to: [email protected]). No donation is too small.
8+
9+
You may install and use an unlimited number of copies of a Tension Type Free Font.
10+
11+
Reproduction and Distribution. You may reproduce and distribute an unlimited number of copies of a Tension Type Free Font; provided that each copy shall be a true and complete copy, including all copyright and trademark notices (if applicable), and shall be accompanied by a copy of this text file. Copies of the Font may not be distributed for profit either on a standalone basis or included as part of your own product unless by prior permission of Tension Type.
12+
13+
You may not rename, edit or create any derivative works from a Tension Type Free Font, other than subsetting when embedding them in documents unless you have permission from Tension Type.
14+
15+
Embedding a Tension Type Free Font in a PDF document and web pages is allowed.
16+
17+
Michael Tension and Tension Type are not responsible for any damage resulting from the use of this Tension Type Free Font.
18+
19+
Any questions, or if you wish to share your designs, please contact Michael Tension: [email protected]
20+
21+
Thanks a ton,
22+
Michael Tension
23+
Binary file not shown.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Louis Christodoulou (louis -at- louisc.co.uk)
2+
#
3+
# Very quickly thrown together code whilst learning how the
4+
# geomerative library ticks.
5+
#
6+
# Here we take out previous scripts drawing and placing points along an arc and
7+
# complete our initial idea of placing text along the arc.
8+
#
9+
# Full Writeup on the Blog here: http://louisc.co.uk/?p=2686
10+
require 'geomerative'
11+
12+
MESSAGE = 'hello bendy world >>>'.freeze
13+
SCALE = 3
14+
attr_reader :font, :points
15+
16+
def settings
17+
size(800, 450)
18+
end
19+
20+
def setup
21+
# Geomerative
22+
sketch_title 'Geomerative Text On A Path'
23+
# From the examples we must always initialise the library using this command
24+
RG.init(self)
25+
@points = []
26+
background(255)
27+
# We want a dymo labeller style look, replace this font with your choice
28+
# see data folder for licence
29+
@font = RFont.new(data_path('Impact Label Reversed.ttf'), 72, RIGHT)
30+
end
31+
32+
def draw
33+
# Blank Background each frame
34+
background(0)
35+
# Create a new RShape each frame
36+
wave = RShape.new
37+
# At the moment the wave object is empty, so lets add a curve:
38+
wave.add_move_to(0 * SCALE, 100 * SCALE)
39+
wave.add_bezier_to(
40+
0 * SCALE,
41+
100 * SCALE,
42+
50 * SCALE,
43+
25 * SCALE,
44+
100 * SCALE,
45+
100 * SCALE
46+
)
47+
wave.add_bezier_to(
48+
100 * SCALE,
49+
100 * SCALE,
50+
150 * SCALE,
51+
175 * SCALE,
52+
200 * SCALE,
53+
100 * SCALE
54+
)
55+
translate(100, -80)
56+
# draw our wave
57+
no_fill
58+
stroke(255, 0, 0)
59+
stroke_weight(60)
60+
stroke_cap(PROJECT)
61+
wave.draw
62+
stroke_cap(ROUND)
63+
# Collect some points along the curve
64+
RG.set_polygonizer(RCommand::UNIFORMLENGTH)
65+
RG.set_polygonizer_length(35)
66+
points = wave.get_points
67+
index = 0 # Letter index within the string message
68+
# loop through and place a letter at each point
69+
MESSAGE.each_char do |letter|
70+
center = RCommand.new(points[index], points[index + 1]).get_center
71+
fill(255)
72+
no_stroke
73+
push_matrix
74+
translate(center.x, center.y)
75+
rotate(get_angle(points[index], points[index + 1]))
76+
translate(5, 20)
77+
font.draw(letter)
78+
pop_matrix
79+
index += 1
80+
end
81+
end
82+
83+
# Simple function to calculate the angle between two points
84+
def get_angle(p1, p2)
85+
atan2(p2.y - p1.y, p2.x - p1.x)
86+
end

0 commit comments

Comments
 (0)