From 43d44aa944a138e326c3c06f9936d6edb426781a Mon Sep 17 00:00:00 2001 From: Andy Meneely Date: Mon, 11 Apr 2016 20:42:48 -0400 Subject: [PATCH] samples: gists --> backend --- .gitmodules | 4 ++-- lib/squib/conf.rb | 1 + samples/autoscale_font.rb | 27 --------------------------- samples/backend | 1 + samples/backend-config.yml | 5 ----- samples/backend.rb | 33 --------------------------------- samples/gists | 1 - 7 files changed, 4 insertions(+), 68 deletions(-) delete mode 100644 samples/autoscale_font.rb create mode 160000 samples/backend delete mode 100644 samples/backend-config.yml delete mode 100644 samples/backend.rb delete mode 160000 samples/gists diff --git a/.gitmodules b/.gitmodules index c9e3e3e..d92a5da 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,6 +16,6 @@ path = samples/build_groups url = https://gist.github.com/andymeneely/bda48487e3b8c9d15edb -[submodule "samples/gists"] - path = samples/gists +[submodule "samples/backend"] + path = samples/backend url = https://gist.github.com/7b4a3acd0e758aedf87ba549e2025a11.git diff --git a/lib/squib/conf.rb b/lib/squib/conf.rb index cb38c09..ceeed58 100644 --- a/lib/squib/conf.rb +++ b/lib/squib/conf.rb @@ -15,6 +15,7 @@ module Squib 'hint' => :none, 'img_dir' => '.', 'progress_bars' => false, + 'prefix' => 'card_', 'ldquote' => "\u201C", # UTF8 chars 'rdquote' => "\u201D", 'lsquote' => "\u2018", diff --git a/samples/autoscale_font.rb b/samples/autoscale_font.rb deleted file mode 100644 index cc6c5b2..0000000 --- a/samples/autoscale_font.rb +++ /dev/null @@ -1,27 +0,0 @@ -require 'squib' - -# Here's an exmaple of being able to scale a font -# based on the length of individual string. -# Handy for making minor font scales to fill text boxes. -def autoscale(str_array) - str_array.inject([]) do | memo, str | - case str.length - when 0..10 - memo << 125 - when 11..20 - memo << 45 - else - memo << 36 - end - end -end - -Squib::Deck.new(cards: 3) do - background color: :white - - title = %w(ShortBig Medium_Length_Name Super_Duper_Long_Name) - text str: title, x: 65, y: 400, align: :center, width: 700, - font: 'Arial', font_size: autoscale(title), hint: :red - - save prefix: 'autoscale_', format: :png -end diff --git a/samples/backend b/samples/backend new file mode 160000 index 0000000..f1f939a --- /dev/null +++ b/samples/backend @@ -0,0 +1 @@ +Subproject commit f1f939a86662dc8a6dd6c86da752b0bb1a9a59e9 diff --git a/samples/backend-config.yml b/samples/backend-config.yml deleted file mode 100644 index 330b987..0000000 --- a/samples/backend-config.yml +++ /dev/null @@ -1,5 +0,0 @@ -# To configure for using SVG as our backend, we need to set this option -# This will create a series of SVG files that get updated with Squib command -backend: svg -# They are auto-saved with this background -prefix: backend_ diff --git a/samples/backend.rb b/samples/backend.rb deleted file mode 100644 index 730d682..0000000 --- a/samples/backend.rb +++ /dev/null @@ -1,33 +0,0 @@ -require 'squib' - -# Our SVGs are auto-saved after each step using the configuration parameters -Squib::Deck.new(cards: 2, config: 'backend-config.yml') do - - # These are all supported by the SVG backend - background color: :gray - text str: 'Hello, world!', y: 500, width: 825, font: 'Sans bold 72', align: :center - rect x: 38, y: 38, width: 750, height: 1050, x_radius: 38, y_radius: 38 - circle x: 100, y: 400, radius: 25 - triangle x1: 100, y1: 425, x2: 125, y2: 475, x3: 75, y3: 475 - line x1: 100, y1: 620, x2: 720, y2: 620, stroke_width: 15.0 - svg file: 'spanner.svg', x: 100, y: 75 - png file: 'shiny-purse.png', x: 250, y: 75 # raster can still be used too - png file: 'shiny-purse.png', x: 250, y: 250, mask: :red # still renders as raster - # We can still rasterize whenever we want - save_png prefix: 'backend_' - - # And our PDFs will be vectorized . - save_pdf file: 'backend_vectorized.pdf', gap: 5 - - # This one is a known issue. Masking an SVG onto an SVG backend is still buggy. - # svg file: 'glass-heart.svg', x: 100, y: 200, width: 100, height: 100, mask: :sangria - - # This one is, unfortunately, not possible with svg back ends - # Cairo lacks a perspective transform (currently), so we have to - # use a striping method, which assumes raster. Fortunately, Cairo - # has perspective transforms on its roadmap, - # so perhaps this can be done someday with all vectors. - # - # showcase file: 'showcase.png', fill_color: 'white' - -end diff --git a/samples/gists b/samples/gists deleted file mode 160000 index 8f534ad..0000000 --- a/samples/gists +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8f534ad53178253e8a35d179d299e1a0c574e2ff