Draw call locations now calculated after all string replacements. Does this fix the center and right align embed? Quick testing could not find any errors, but more thorough testing needed.
Squib.logger.warn"Center- or right-aligned text do not always embed properly. This is a known issue with a workaround. See https://github.com/andymeneely/squib/issues/46"
end
x=Pango.pixels(rect.x)+rule[:dx]
y=Pango.pixels(rect.y)+rule[:dy]
draw_calls<<{x:x,y:y,draw:rule[:draw]}# defer drawing until we've valigned
x=Pango.pixels(rect.x)+search[:rule][:dx]
y=Pango.pixels(rect.y)+search[:rule][:dy]
draw_calls<<{x:x,y:y,draw:search[:rule][:draw]}# defer drawing until we've valigned