parent
211e7c13b3
commit
beb46a9e1c
|
|
@ -119,7 +119,8 @@ module Squib
|
||||||
while (key = next_embed(embed.rules.keys, clean_str)) != nil
|
while (key = next_embed(embed.rules.keys, clean_str)) != nil
|
||||||
rule = embed.rules[key]
|
rule = embed.rules[key]
|
||||||
spacing = rule[:width] * Pango::SCALE
|
spacing = rule[:width] * Pango::SCALE
|
||||||
index = clean_str.index(key)
|
index = clean_str.index(key)
|
||||||
|
index = clean_str[0..index].bytesize #convert to byte index (bug #57)
|
||||||
str = str.sub(key, "<span size=\"#{ZERO_WIDTH_CHAR_SIZE}\">a<span letter_spacing=\"#{spacing.to_i}\">a</span>a</span>")
|
str = str.sub(key, "<span size=\"#{ZERO_WIDTH_CHAR_SIZE}\">a<span letter_spacing=\"#{spacing.to_i}\">a</span>a</span>")
|
||||||
layout.markup = str
|
layout.markup = str
|
||||||
clean_str = layout.text
|
clean_str = layout.text
|
||||||
|
|
|
||||||
|
|
@ -66,8 +66,8 @@ Squib::Deck.new do
|
||||||
embed.png key: ':purse:', width: 28, height: 28, file: 'shiny-purse.png'
|
embed.png key: ':purse:', width: 28, height: 28, file: 'shiny-purse.png'
|
||||||
end
|
end
|
||||||
|
|
||||||
embed_text = 'Markup and typography replacements with ":tool:" icons <i>won\'t</i> fail'
|
embed_text = 'Markup --- and typography replacements --- with ":tool:" icons <i>won\'t</i> fail'
|
||||||
text(str: embed_text, font: 'Serif 21', markup: true,
|
text(str: embed_text, font: 'Serif 18', markup: true,
|
||||||
x: 600, y: 320, width: 180, height: 300,
|
x: 600, y: 320, width: 180, height: 300,
|
||||||
align: :center, hint: :magenta) do |embed|
|
align: :center, hint: :magenta) do |embed|
|
||||||
embed.svg key: ':tool:', width: 28, height: 28, file: 'spanner.svg'
|
embed.svg key: ':tool:', width: 28, height: 28, file: 'spanner.svg'
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,7 @@ cairo: translate([600, 320])
|
||||||
cairo: rotate([0])
|
cairo: rotate([0])
|
||||||
cairo: move_to([0, 0])
|
cairo: move_to([0, 0])
|
||||||
pango: font_description=([MockDouble])
|
pango: font_description=([MockDouble])
|
||||||
pango: text=(["Markup and typography replacements with \":tool:\" icons <i>won't</i> fail"])
|
pango: text=(["Markup --- and typography replacements --- with \":tool:\" icons <i>won't</i> fail"])
|
||||||
pango: markup=(["foo"])
|
pango: markup=(["foo"])
|
||||||
pango: width=([184320])
|
pango: width=([184320])
|
||||||
pango: height=([307200])
|
pango: height=([307200])
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue