Log In  

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

Cart [#prac-0#] | Code | 2019-05-22 | License: CC4-BY-NC-SA | Embed
2

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)


[Please log in to post a comment]

About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2019-10-19 23:05 | 0.013s | 2097k | Q:20