Strike through via unicode

Hi,

I want to create some characters with a strikethrough via unicode.

On the Mac, the styled text area doesn’t support this (from Language Reference):

Strikethrough

Note : The “strikethrough” style is not supported under Mac OS,

However on wikipedia it says:

The “combining long stroke overlay” (U+0336) results in an unbroken stroke across the text:
A̶B̶C̶D̶ ̶e̶f̶g̶h̶i̶
while the “combining short stroke overlay” (U+0335) results in individually struck out characters:
A̵B̵C̵D̵ ̵e̵f̵g̵h̵i̵

I tried something like this:

<code 4D>
For ($Char_i;1;Length($Code_t))
$CharCode_i:=Character code($Code_t[$Char_i])
$CharCode_i:=$CharCode_i+0x0335
$Code_t[$Char_i]:=char($CharCode_i)
End for
</code 4D>

But that didn’t work :frowning:

I’m sure it’s just a simple logic problem, maybe someone can point it out?

​Thanks,

Wayne

Hi Wayne,
it seems to work by adding the “strike char” after the char itself:
<code 4D>
$in_t:=“Strikethrough”
$out_t:=""
$strike_l:=0x0335
For ($i_l;1;Longueur($in_t))
$charCode_l:=Character code($in_t[$i_l])
$striked:=Char($charCode_l)+ Char($strike_l)
$out_t:=$out_t+$striked
End for
</code 4D>
found http://adamvarga.com/strike/here>
very interesting BTW…

Later…
<code 4D>
$strike_l:=0x0335
//“combining short stroke overlay” (U+0335) individually struck out characters * A̵B̵C̵D̵ ̵e̵f̵g̵h̵i̵
$strike_l:=0x0336
//“combining long stroke overlay” (U+0336) unbroken stroke across the text * A̶B̶C̶D̶ ̶e̶f̶g̶h̶i̶
$strike_l:=0x0337
//“combining short solidus overlay” (U+0337) diagonally struck out letters * A̷B̷C̷D̷ ̷e̷f̷g̷h̷i̷
$strike_l:=0x0338
// “combining long solidus overlay” (U+0338) longer diagonal strokes * A̸B̸C̸D̸ ̸e̸f̸g̸h̸i̸
$in_t:=“Strikethrough éèçà”
$out_t:=""
For ($strike_l;0x0335;0x0338)
$out_t:=$out_t+" * “+String($strike_l;”&x")+" = "
For ($i_l;1;Length($in_t))
$charCode_l:=Character code($in_t[$i_l])
$striked_t:=Char($charCode_l)+Char($strike_l)
$out_t:=$out_t+$striked_t
End for
End for
</code 4D>
… I get this display:
[]27651682;“Your comment here…”[/]
The “unbroken stroke across the text” (0x0336) does not give what I expected (“unbroken”?). Is it due to the debugger font?

trying to be generic + fast…
<code 4D>
//Str_strike (txt_t {;strikeChar_l) -> txt
//$0 = texte $1 barré
//$2 optionnel parmi
// U+0335 “combining short stroke overlay” individually struck out characters * A̵B̵C̵D̵ ̵e̵f̵g̵h̵i̵
// U+0336 “combining long stroke overlay” unbroken stroke across the text * A̶B̶C̶D̶ ̶e̶f̶g̶h̶i̶
// U+0337 “combining short solidus overlay” diagonally struck out letters * A̷B̷C̷D̷ ̷e̷f̷g̷h̷i̷
// U+0338 “combining long solidus overlay” longer diagonal strokes * A̸B̸C̸D̸ ̸e̸f̸g̸h̸i̸
C_TEXT($0)
C_TEXT($1)
C_LONGINT($2)
C_TEXT($in_t)
C_TEXT($out_t)
C_LONGINT($strike_l)
C_LONGINT($i_l)
//_
$in_t:=$1
$out_t:=""
$strike_l:=0x0335 //default
If (Count parameters>1)
If ($2>=0x0335) & ($2<=0x0338)
$strike_l:=$2
End if
End if
$strike_t:=Char($strike_l)
$test:=$3 //added for speed test
Case of
: ($test=1)
For ($i_l;1;Length($in_t))
$out_t:=$out_t+$in_t[$i_l]+$strike_t
End for
: ($test=2)
$out_t:=$in_t
For ($i_l;Length($out_t)+1;2;-1)
$out_t:=Insert string($out_t;$strike_t;$i_l)
End for
Else
ARRAY TEXT($char_at;0x0000)
For ($i_l;1;Length($in_t))
APPEND TO ARRAY($char_at;$in_t[$i_l]+$strike_t)
End for
$out_t:=Str_implode (->$char_at;"")
End case
$0:=$out_t
//_
</code 4D>
test 1 = 94
test 2 = 99
test 3 = 26
I realise I never used the ‘Insert string’ function before; it could be optimised, I think (although differences appears with strings having thousands of chars, maybe not realistic in this case).

Thanks! That’s very helpful