Pango scaling of "spacing" in text is done once

Spacing also defaults to nil, not zero, as before

Fixes #98
This commit is contained in:
Andy Meneely
2015-07-26 22:26:42 -04:00
parent bfe2c8c4a5
commit 9d475995e8
19 changed files with 8 additions and 149 deletions
+3 -3
View File
@@ -17,7 +17,7 @@ module Squib
justify: false,
wrap: true,
ellipsize: :end,
spacing: 0,
spacing: nil,
valign: :top,
hint: :off
}
@@ -98,7 +98,7 @@ module Squib
def validate_spacing(arg, _i)
return nil if arg.nil?
raise ArgumentError, 'spacing must be a number or nil' unless arg.respond_to? :to_f
Pango::SCALE * arg.to_f
arg.to_f * Pango::SCALE
end
def validate_valign(arg, _i)
@@ -112,4 +112,4 @@ module Squib
end
end
end
end
+1 -1
View File
@@ -143,7 +143,7 @@ module Squib
layout.alignment = para.align
layout.justify = para.justify unless para.justify.nil?
layout.spacing = para.spacing * Pango::SCALE unless para.spacing.nil?
layout.spacing = para.spacing unless para.spacing.nil?
cc.update_pango_layout(layout)
embed_draws = process_embeds(embed, para.str, layout)