Add text rotation
This commit is contained in:
committed by
Andy Meneely
parent
cdc994b77a
commit
91e7adafd5
@@ -39,13 +39,13 @@ module Squib
|
||||
# @api public
|
||||
def text(opts = {})
|
||||
opts = needs(opts, [:range, :str, :font, :font_size, :x, :y, :width, :height, :color, :wrap,
|
||||
:align, :justify, :spacing, :valign, :markup, :ellipsize, :hint, :layout])
|
||||
:align, :justify, :spacing, :valign, :markup, :ellipsize, :hint, :layout, :rotation])
|
||||
opts[:range].each do |i|
|
||||
@cards[i].text(opts[:str][i], opts[:font][i], opts[:font_size][i], opts[:color][i],
|
||||
opts[:x][i], opts[:y][i], opts[:width][i], opts[:height][i],
|
||||
opts[:markup][i], opts[:justify][i], opts[:wrap][i],
|
||||
opts[:ellipsize][i], opts[:spacing][i], opts[:align][i],
|
||||
opts[:valign][i], opts[:hint][i])
|
||||
opts[:valign][i], opts[:hint][i], opts[:rotation][i])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ module Squib
|
||||
:progress_bar => false,
|
||||
:range => :all,
|
||||
:rotate => false,
|
||||
:rotation => 0,
|
||||
:sheet => 0,
|
||||
:spacing => 0,
|
||||
:str => '',
|
||||
@@ -85,6 +86,7 @@ module Squib
|
||||
:layout => :layout,
|
||||
:markup => :markup,
|
||||
:rect_radius => :radius,
|
||||
:rotation => :rotation,
|
||||
:spacing => :spacing,
|
||||
:str => :str,
|
||||
:stroke_color => :stroke_color,
|
||||
|
||||
@@ -88,11 +88,12 @@ module Squib
|
||||
def text(str, font, font_size, color,
|
||||
x, y, width, height,
|
||||
markup, justify, wrap, ellipsize,
|
||||
spacing, align, valign, hint)
|
||||
spacing, align, valign, hint, rotation)
|
||||
Squib.logger.debug {"Placing '#{str}'' with font '#{font}' @ #{x}, #{y}, color: #{color}, etc."}
|
||||
use_cairo do |cc|
|
||||
cc.set_source_color(color)
|
||||
cc.move_to(x,y)
|
||||
cc.rotate(rotation)
|
||||
layout = cc.create_pango_layout
|
||||
font_desc = Pango::FontDescription.new(font)
|
||||
font_desc.size = font_size * Pango::SCALE unless font_size.nil?
|
||||
|
||||
Reference in New Issue
Block a user