Cleaning up
Although it appears we still have issues with text_options being different on different cards. Very strange.dev
parent
c6cb0ca288
commit
77e5fcce06
|
|
@ -121,21 +121,6 @@ module Squib
|
||||||
end
|
end
|
||||||
x = Pango.pixels(rect.x + (letter_width / 2))
|
x = Pango.pixels(rect.x + (letter_width / 2))
|
||||||
y = Pango.pixels(rect.y)
|
y = Pango.pixels(rect.y)
|
||||||
circle(x, y + 2, 2, :red, :red, 0)
|
|
||||||
puts <<-EOS
|
|
||||||
Embedding #{key}
|
|
||||||
at index: #{index}
|
|
||||||
iter index #{iter.index}
|
|
||||||
layout width: #{layout.width}
|
|
||||||
line width: #{iter.line_extents[0].width} or #{Pango.pixels iter.line_extents[0].width}px
|
|
||||||
pango's x at start of paragraph is #{Pango.pixels para_x}px
|
|
||||||
pango's index_to_ps xy #{rect.x},#{rect.y} or #{Pango.pixels rect.x},#{Pango.pixels rect.y} (px)
|
|
||||||
xy #{x},#{y}
|
|
||||||
spacing at #{spacing} or #{Pango.pixels spacing}px
|
|
||||||
space character width #{letter_width} or #{letter_width / Pango::SCALE}px
|
|
||||||
and string is:
|
|
||||||
#{str}
|
|
||||||
EOS
|
|
||||||
svg(rule[:file], rule[:id], x, y, rule[:width], rule[:height],
|
svg(rule[:file], rule[:id], x, y, rule[:width], rule[:height],
|
||||||
rule[:alpha], rule[:blend], rule[:angle], SYSTEM_DEFAULTS[:mask])
|
rule[:alpha], rule[:blend], rule[:angle], SYSTEM_DEFAULTS[:mask])
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,7 @@ Squib::Deck.new do
|
||||||
rect x: 0, y: 0, width: 825, height: 1125
|
rect x: 0, y: 0, width: 825, height: 1125
|
||||||
rect x: 0, y: 0, width: 180, height: 180, stroke_color: :red
|
rect x: 0, y: 0, width: 180, height: 180, stroke_color: :red
|
||||||
|
|
||||||
# embed_text = 'Take 1:tool:and gain 2 :health:. Take 2 :tool: if level 2'
|
embed_text = 'Take 1 :tool:and gain 2 :health:. Take 2 :tool: if level 2'
|
||||||
embed_text = ' 1:tool: 2 :health:'
|
|
||||||
text(str: embed_text, font: 'Sans 18',
|
text(str: embed_text, font: 'Sans 18',
|
||||||
x: 0, y: 0, width: 180,
|
x: 0, y: 0, width: 180,
|
||||||
align: :right, ellipsize: false, justify: false) do |embed|
|
align: :right, ellipsize: false, justify: false) do |embed|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ data = {'name' => ['Thief', 'Grifter', 'Mastermind'],
|
||||||
'level' => [1,2,3]}
|
'level' => [1,2,3]}
|
||||||
longtext = "This is left-justified text, with newlines.\nWhat do you know about tweetle beetles? well... When tweetle beetles fight, it's called a tweetle beetle battle. And when they battle in a puddle, it's a tweetle beetle puddle battle. AND when tweetle beetles battle with paddles in a puddle, they call it a tweetle beetle puddle paddle battle. AND... When beetles battle beetles in a puddle paddle battle and the beetle battle puddle is a puddle in a bottle... ..they call this a tweetle beetle bottle puddle paddle battle muddle."
|
longtext = "This is left-justified text, with newlines.\nWhat do you know about tweetle beetles? well... When tweetle beetles fight, it's called a tweetle beetle battle. And when they battle in a puddle, it's a tweetle beetle puddle battle. AND when tweetle beetles battle with paddles in a puddle, they call it a tweetle beetle puddle paddle battle. AND... When beetles battle beetles in a puddle paddle battle and the beetle battle puddle is a puddle in a bottle... ..they call this a tweetle beetle bottle puddle paddle battle muddle."
|
||||||
|
|
||||||
Squib::Deck.new(width: 825, height: 1125, cards: 1) do
|
Squib::Deck.new(width: 825, height: 1125, cards: 3) do
|
||||||
background color: :white
|
background color: :white
|
||||||
rect x: 15, y: 15, width: 795, height: 1095, x_radius: 50, y_radius: 50
|
rect x: 15, y: 15, width: 795, height: 1095, x_radius: 50, y_radius: 50
|
||||||
rect x: 30, y: 30, width: 128, height: 128, x_radius: 25, y_radius: 25
|
rect x: 30, y: 30, width: 128, height: 128, x_radius: 25, y_radius: 25
|
||||||
|
|
@ -41,12 +41,14 @@ Squib::Deck.new(width: 825, height: 1125, cards: 1) do
|
||||||
width: ws, height: hs,
|
width: ws, height: hs,
|
||||||
radius: 10, stroke_color: :black
|
radius: 10, stroke_color: :black
|
||||||
|
|
||||||
|
# If width & height are defined and the text will overflow the box, we can ellipsize.
|
||||||
text str: "Ellipsization!\nThe ultimate question of life, the universe, and everything to life and everything is 42",
|
text str: "Ellipsization!\nThe ultimate question of life, the universe, and everything to life and everything is 42",
|
||||||
hint: :green, font: 'Arial 22',
|
hint: :green, font: 'Arial 22',
|
||||||
x: 450, y: 400,
|
x: 450, y: 400,
|
||||||
width: 280, height: 180,
|
width: 280, height: 180,
|
||||||
ellipsize: true
|
ellipsize: true
|
||||||
|
|
||||||
|
# Text hints are guides for showing you how your text boxes are laid out exactly
|
||||||
hint text: :cyan
|
hint text: :cyan
|
||||||
text str: 'Text hints are also globally togglable!',
|
text str: 'Text hints are also globally togglable!',
|
||||||
x: 65, y: 625,
|
x: 65, y: 625,
|
||||||
|
|
@ -60,14 +62,15 @@ Squib::Deck.new(width: 825, height: 1125, cards: 1) do
|
||||||
x: 565, y: 675, angle: 0.2,
|
x: 565, y: 675, angle: 0.2,
|
||||||
font: 'Arial 18', hint: :red
|
font: 'Arial 18', hint: :red
|
||||||
|
|
||||||
|
# Text can be justified, and have newlines
|
||||||
text str: longtext, font: 'Arial 16',
|
text str: longtext, font: 'Arial 16',
|
||||||
x: 65, y: 700,
|
x: 65, y: 700,
|
||||||
width: '1.5in', height: inches(1),
|
width: '1.5in', height: inches(1),
|
||||||
justify: true
|
justify: true
|
||||||
|
|
||||||
# Here's how you embed images into text.
|
# Here's how you embed images into text.
|
||||||
embed_text = 'Embedded icons! Take one 1 :tool: and gain 2 :health:. If Level 2, take 2 :tool:'
|
# Pass a block to the
|
||||||
# embed_text = '1 :tool: 2 :health: 2 :tool:'
|
embed_text = 'Embedded icons! Take 1 :tool: and gain 2:health:. If Level 2, take 2 :tool:'
|
||||||
text(str: embed_text, font: 'Sans 18',
|
text(str: embed_text, font: 'Sans 18',
|
||||||
x: '1.8in', y: '2.5in', width: '0.85in',
|
x: '1.8in', y: '2.5in', width: '0.85in',
|
||||||
align: :center, ellipsize: false) do |embed|
|
align: :center, ellipsize: false) do |embed|
|
||||||
|
|
@ -83,5 +86,5 @@ Squib::Deck.new(width: 825, height: 1125, cards: 1) do
|
||||||
font: 'Arial 32', hint: :cyan
|
font: 'Arial 32', hint: :cyan
|
||||||
|
|
||||||
|
|
||||||
save range: 0, prefix: 'text_', format: :png
|
save prefix: 'text_', format: :png
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue