Configurable font and embedable sizes
This commit is contained in:
@@ -170,8 +170,6 @@ effect_text:
|
|||||||
y: {EFFECT_TEXT_Y}c
|
y: {EFFECT_TEXT_Y}c
|
||||||
width: {EFFECT_TEXT_WIDTH}c
|
width: {EFFECT_TEXT_WIDTH}c
|
||||||
height: {EFFECT_TEXT_HEIGHT}c
|
height: {EFFECT_TEXT_HEIGHT}c
|
||||||
font_size: 9
|
|
||||||
spacing: 5
|
|
||||||
align: center
|
align: center
|
||||||
valign: middle
|
valign: middle
|
||||||
markup: true
|
markup: true
|
||||||
|
|||||||
23
src/deck.rb
23
src/deck.rb
@@ -1,5 +1,17 @@
|
|||||||
require 'squib'
|
require 'squib'
|
||||||
|
|
||||||
|
|
||||||
|
DPI = 300
|
||||||
|
CELL_PX = DPI / 8.0
|
||||||
|
BLEED = 0.125 # In inches
|
||||||
|
WIDTH = (2.5 + 2*BLEED) * DPI
|
||||||
|
HEIGHT = (3.5 + 2*BLEED) * DPI
|
||||||
|
EFFECT_FONT_SIZE = 8
|
||||||
|
EFFECT_FONT_SPACING = 5
|
||||||
|
EMBED_SIZE = EFFECT_FONT_SIZE / 9.0 # In cells
|
||||||
|
EMBED_DY = - (0.7 * EMBED_SIZE + 0.2) * DPI / 300 # In cells
|
||||||
|
|
||||||
|
|
||||||
data = Squib.xlsx file: 'data/cards.xlsx', explode: 'quantite'
|
data = Squib.xlsx file: 'data/cards.xlsx', explode: 'quantite'
|
||||||
|
|
||||||
def icon_to_svg(icon)
|
def icon_to_svg(icon)
|
||||||
@@ -42,20 +54,13 @@ def get_art(data, idx)
|
|||||||
icon = data['icone'][idx]
|
icon = data['icone'][idx]
|
||||||
icon_alt = data['icone_alt'][idx]
|
icon_alt = data['icone_alt'][idx]
|
||||||
icon_alt = icon_alt.nil? ? '' : "_#{icon_alt}"
|
icon_alt = icon_alt.nil? ? '' : "_#{icon_alt}"
|
||||||
puts "default_art_#{icon}#{icon_alt}.svg"
|
|
||||||
return "default_art_#{icon}#{icon_alt}.svg"
|
return "default_art_#{icon}#{icon_alt}.svg"
|
||||||
end
|
end
|
||||||
|
|
||||||
def embed_custom(embed, id)
|
def embed_custom(embed, id)
|
||||||
embed.svg width: '0.8c', height: '0.8c', dx: '0c', dy: '-0.7c', key: ":#{id}:", file: "._graphics/#{id}.svg"
|
embed.svg width: "#{EMBED_SIZE}c", height: "#{EMBED_SIZE}c", dx: '0c', dy: "#{EMBED_DY}c", key: ":#{id}:", file: "._graphics/#{id}.svg"
|
||||||
end
|
end
|
||||||
|
|
||||||
DPI = 300
|
|
||||||
CELL_PX = DPI / 8.0
|
|
||||||
BLEED = 0.125 # In inches
|
|
||||||
WIDTH = (2.5 + 2*BLEED) * DPI
|
|
||||||
HEIGHT = (3.5 + 2*BLEED) * DPI
|
|
||||||
|
|
||||||
Squib.configure cell_px: CELL_PX
|
Squib.configure cell_px: CELL_PX
|
||||||
|
|
||||||
Squib::Deck.new(
|
Squib::Deck.new(
|
||||||
@@ -106,7 +111,7 @@ Squib::Deck.new(
|
|||||||
fill_color = data['effet'].map { |effet| effet.nil? ? '#0000': '#f7f7f7ff' }
|
fill_color = data['effet'].map { |effet| effet.nil? ? '#0000': '#f7f7f7ff' }
|
||||||
stroke_color = data['effet'].map { |effet| effet.nil? ? '#0000': '#cca9' }
|
stroke_color = data['effet'].map { |effet| effet.nil? ? '#0000': '#cca9' }
|
||||||
rect layout: 'effect_frame', fill_color: fill_color, stroke_color: stroke_color
|
rect layout: 'effect_frame', fill_color: fill_color, stroke_color: stroke_color
|
||||||
text(str: data['effet'], layout: 'effect_text') do |embed|
|
text(str: data['effet'], layout: 'effect_text', font_size: EFFECT_FONT_SIZE, spacing: EFFECT_FONT_SPACING) do |embed|
|
||||||
embed_custom(embed, 'effet')
|
embed_custom(embed, 'effet')
|
||||||
embed_custom(embed, 'magouille')
|
embed_custom(embed, 'magouille')
|
||||||
embed_custom(embed, 'pv')
|
embed_custom(embed, 'pv')
|
||||||
|
|||||||
Reference in New Issue
Block a user