@@ -25,6 +25,7 @@ module Squib
|
||||
@svgfile = "#{deck.dir}/#{deck.prefix}#{deck.count_format % index}.svg"
|
||||
@cairo_surface = make_surface(@svgfile, backend)
|
||||
@cairo_context = Squib::Graphics::CairoContextWrapper.new(Cairo::Context.new(@cairo_surface))
|
||||
@cairo_context.antialias = @deck.antialias
|
||||
end
|
||||
|
||||
def make_surface(svgfile, backend)
|
||||
|
||||
@@ -63,6 +63,7 @@ module Squib
|
||||
#
|
||||
# @api public
|
||||
CONFIG_DEFAULTS = {
|
||||
'antialias' => 'best',
|
||||
'backend' => 'memory',
|
||||
'count_format' => SYSTEM_DEFAULTS[:count_format],
|
||||
'custom_colors' => {},
|
||||
|
||||
+3
-1
@@ -30,7 +30,7 @@ module Squib
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
attr_reader :text_hint
|
||||
attr_reader :text_hint, :antialias
|
||||
|
||||
# :nodoc:
|
||||
# @api private
|
||||
@@ -58,6 +58,7 @@ module Squib
|
||||
# @param block [Block] the main body of the script.
|
||||
# @api public
|
||||
def initialize(width: 825, height: 1125, cards: 1, dpi: 300, config: 'config.yml', layout: nil, &block)
|
||||
@antialias = CONFIG_DEFAULTS['antialias']
|
||||
@dpi = dpi
|
||||
@font = SYSTEM_DEFAULTS[:default_font]
|
||||
@cards = []
|
||||
@@ -109,6 +110,7 @@ module Squib
|
||||
@dir = config['dir']
|
||||
@prefix = config['prefix']
|
||||
@count_format = config['count_format']
|
||||
@antialias = config['antialias']
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@ module Squib
|
||||
:translate, :rotate, :move_to, :update_pango_layout, :width, :height,
|
||||
:show_pango_layout, :rounded_rectangle, :set_line_width, :stroke, :fill,
|
||||
:set_source, :scale, :render_rsvg_handle, :circle, :triangle, :line_to,
|
||||
:operator=, :show_page, :clip, :transform, :mask, :create_pango_layout
|
||||
:operator=, :show_page, :clip, :transform, :mask, :create_pango_layout,
|
||||
:antialias=
|
||||
|
||||
def set_source_squibcolor(arg)
|
||||
if match = arg.match(LINEAR_GRADIENT)
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
# Default: 300
|
||||
#dpi: 72
|
||||
|
||||
#antialias: best #recommended. Only about 10% slower than fast
|
||||
#antialias: default # set the anti-aliasing algorithm. default defers to the underlying graphics device. See http://www.cairographics.org/manual/cairo-cairo-t.html#cairo-antialias-t
|
||||
|
||||
# Text hints are used to show the boundaries of text boxes.
|
||||
# Can be enabled/disabled at the command-level, or set globally with `set`
|
||||
#text_hint: '#F00'
|
||||
@@ -21,5 +24,4 @@
|
||||
|
||||
# Use a SVG cairo back end, instead of an in-memory buffer
|
||||
# backend: :memory # default
|
||||
# backend: :svg # slower, but can create scalable pdfs
|
||||
# tmp_dir: _tmp # for SVG backend, you MUST specify a tmp_dir
|
||||
# backend: :svg # can create scalable pdfs, but rendering done at the printer level is not as good as Cairo.
|
||||
|
||||
Reference in New Issue
Block a user