Skip to content

Commit 6be0b5d

Browse files
committed
fix fonts available
1 parent 21c24b4 commit 6be0b5d

16 files changed

+32
-12
lines changed

external_library/gems/ruby_wordcram/callbacks_in_sketch.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class Callbacks < Processing::App
55
include Observer # include java interface as a module to enable callbacks
6-
attr_reader :words_drawn, :words_skipped
6+
attr_reader :words_drawn, :words_skipped
77

88
def settings
99
size 1000, 500
@@ -15,8 +15,9 @@ def setup
1515
@words_drawn = 0
1616
@words_skipped = 0
1717
WordCram.new(self)
18-
.from_text_file(data_path('kari-the-elephant.txt'))
19-
.draw_all
18+
.from_text_file(data_path('kari-the-elephant.txt'))
19+
.with_font('DejaVu Sans')
20+
.draw_all
2021
end
2122

2223
# keep snake case for java reflection

external_library/gems/ruby_wordcram/clickable_words.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,15 @@ def setup
2121
sketch_title 'Clickable Words'
2222
background(255)
2323
# Make the wordcram
24-
@wc = WordCram.new(self).from_web_page('http://wikipedia.org')
25-
wc.draw_all
24+
@wc = WordCram.new(self).tap do |wordcram|
25+
wordcram.from_web_page('http://wikipedia.org')
26+
wordcram.with_font('DejaVu Sans')
27+
wordcram.draw_all
28+
end
2629
# Save the image of the wordcram
2730
@cached_image = get
2831
# Set up styles for when we draw stuff to the screen (later)
29-
text_font(create_font('sans', 150))
32+
text_font(create_font('DejaVu Sans', 150))
3033
text_align(CENTER, CENTER)
3134
@last_clicked_word = nil
3235
end
Binary file not shown.

external_library/gems/ruby_wordcram/fruits.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,17 @@ def settings
1616
def setup
1717
sketch_title 'Fruity Colors'
1818
background(255)
19-
colors = FRUITS.zip(from_web_array(PALETTE)).to_h
19+
colors = FRUITS.zip(web_to_color_array(PALETTE.to_java(:string))).to_h
2020
longest = FRUITS.max { |a, b| a.length <=> b.length }
2121
shortest = FRUITS.min { |a, b| a.length <=> b.length }
2222
words = FRUITS.map do |fruit|
2323
weight = norm_strict(fruit.length, longest.length, shortest.length)
2424
word = Word.new(fruit, weight)
25-
word.set_font(create_font(data_path('MINYN___.TTF'), 1))
25+
word.set_font(create_font(data_path('MINYN___.TTF'),1))
2626
word.set_color(colors[fruit])
2727
end
2828
WordCram.new(self)
29+
.with_font('DejaVu Sans') # avoids missing 'sans font' warning
2930
.from_words(words.to_java(Word))
3031
.sized_by_weight(20, 80)
3132
.draw_all

external_library/gems/ruby_wordcram/get_words_while_running.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ def setup
88
sketch_title 'Get Words While Running'
99
background(20, 20, 30)
1010
@wc = WordCram.new(self)
11+
.with_font('DejaVu Sans') # Avoid missing fon warning
1112
.from_text_file(data_path('usconst.txt'))
1213
.with_color(color('#ededed'))
1314
.sized_by_weight(8, 70)

external_library/gems/ruby_wordcram/hello_world.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def setup
1616
word_array = [Word.new('Hello', 100), Word.new('WordCram', 60)].to_java(Word)
1717
# Pass in the sketch (the variable 'self'), so WordCram can draw to it.
1818
wordcram = WordCram.new(self)
19+
.with_font('DejaVu Sans')
1920
.from_words(word_array) # Pass in the words to draw.
2021
.draw_all # Now we've created our WordCram, we can draw it
2122
end

external_library/gems/ruby_wordcram/letter_stair_case.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def setup
1212
background 255
1313
fill 0
1414
WordCram.new(self)
15+
.with_font('DejaVu Sans') # avoids missing 'sans font' warning
1516
.from_words(load_letters.to_java(Word))
1617
.angled_at(0)
1718
.min_shape_size(0) # Make sure "I" always shows up.

external_library/gems/ruby_wordcram/placing_words.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2+
#!/usr/bin/env jruby
3+
14
require 'picrate'
25
require 'ruby_wordcram'
36

@@ -22,8 +25,10 @@ def setup
2225
# there. Also, most placers take the screen width &
2326
# height into account, so those can affect the
2427
# outcome.
28+
# font = create_font('DejaVu Sans', 1)
2529
WordCram.new(self)
2630
.from_text_file(data_path('kari-the-elephant.txt'))
31+
.with_font('DejaVu Sans')
2732
.draw_all
2833
# Alternative Placers to try out before draw_all
2934
# .with_placer(Placers.center_clump)
@@ -38,4 +43,4 @@ def setup
3843
end
3944
end
4045

41-
PlacingWords .new
46+
PlacingWords.new

external_library/gems/ruby_wordcram/placing_words_by_image_mask.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def setup
1313
image_shape = ImageShaper.new.shape(image, color('#000000'))
1414
placer = ShapeBasedPlacer.new(image_shape)
1515
WordCram.new(self)
16+
.with_font('DejaVu Sans') # avoids missing 'sans font' warning
1617
.from_text_file(data_path('kari-the-elephant.txt'))
1718
.with_placer(placer)
1819
.with_nudger(placer)
@@ -22,6 +23,7 @@ def setup
2223
image_shape = ImageShaper.new.shape(image, color('#ffffff'))
2324
placer = ShapeBasedPlacer.new(image_shape)
2425
WordCram.new(self)
26+
.with_font('DejaVu Sans')
2527
.from_text_file(data_path('kari-the-elephant.txt'))
2628
.with_placer(placer)
2729
.with_nudger(placer)

external_library/gems/ruby_wordcram/render_to_buffer.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def setup
1212
buffer.background(255)
1313
# red, black, and blue colors
1414
@wc = WordCram.new(self)
15+
.with_font('DejaVu Sans')
1516
.from_text_file(data_path('usconst.txt'))
1617
.to_canvas(buffer)
1718
.with_colors(color(255, 0, 0), color(0), color(0, 0, 255))

0 commit comments

Comments
 (0)