Respect DPI settings in text, add pt unit
This has the compatibility impact that all font sizes should be divided by 3 to maintain their same sizes. Based on PR #225. Thanks @felixleong!! Conflicts: bin/squib lib/squib/graphics/text.rb
This commit is contained in:
committed by
Andy Meneely
parent
06970b77a6
commit
f800c131ff
@@ -26,7 +26,7 @@ Squib::Deck.new(width: 3000, height: 1500) do
|
||||
x, y, w, h = 0, 0, 300, 50
|
||||
colors.each_with_index do |color, i|
|
||||
rect x: x, y: y, width: w, height: h, fill_color: color
|
||||
text str: color.to_s, x: x + 5, y: y + 13, font: 'Sans Bold 16',
|
||||
text str: color.to_s, x: x + 5, y: y + 13, font: 'Sans Bold 5',
|
||||
color: (Cairo::Color.parse(color).to_hsv.v > 0.9) ? '#000' : '#fff'
|
||||
y += h
|
||||
if y > @height
|
||||
|
||||
@@ -27,7 +27,7 @@ Squib::Deck.new do
|
||||
radius: 15, stroke_color: '#0000'
|
||||
|
||||
# Alpha transparency can be used too
|
||||
text str: 'Hello, world!', x: 75, y: 700, font: 'Sans Bold 72',
|
||||
text str: 'Hello, world!', x: 75, y: 700, font: 'Sans Bold 24',
|
||||
color: '(0,0)(825,0) #000f@0.0 #0000@1.0'
|
||||
|
||||
save_png prefix: 'gradient_'
|
||||
|
||||
Reference in New Issue
Block a user