Log In  

A function for printing some accents above latin characters (138 tokens).

Cart #prac-0 | 2019-05-22 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
9

function prac(str, x,y)
 local dat={
  ["#"] = {",",  0, 2},
  ["^"] = {"^",  0,-3},
  ["`"] = {"`", -1,-3},
  ["|"] = {",",  1,-6},
  [":"] = {"\"", 0,-3},
  ["~"] = {"~",  0,-5},
  ["_"] = {"-",  0,-4},
  ["★"]={"★",  -2,-6}
 }
 local p=1
 while p <= #str do
  local c=sub(str,p,p)
  if (dat[c]) then
   print(dat[c][1],
    x+dat[c][2], y+dat[c][3]) 
    p+=1
   c=sub(str,p,p)
  end
  print(c,x,y)
  x+=4 p+=1
 end
end

Accents are inserted by including special markers in the text:

prac("cedille     #c",x,y) y+=h
prac("aigu        |e",x,y) y+=h
prac("circonflexe ^a ^e ^i ^o ^u",x,y) y+=h
prac("grave       `a `e `u",x,y) y+=h
prac("tr|ema       :e :i :u",x,y) y+=h

prac("ephasis     _e _i _u",x,y) y+=h
prac("wiggle      ~e ~i ~u",x,y) y+=h
prac("star        sp★ace",x,y);      
P#64678 2019-05-22 19:31 ( Edited 2019-05-22 21:01)

thank you! This will be very useful!

P#92533 2021-05-25 04:15

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-19 14:46:31 | 0.015s | Q:13