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:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user