I was working on a Chinese to English vocab program, and pinyin (The English alphabet for Chinese) uses diacritics all the time
maybe not a thing that can be used in the code, but in text variables. Having a function in the text variable like "dia" (like flr) or something. If you're having issues imaging what the would look like, here
Print("Hello W' .. dia("o") .. "rld") |
Hello Wòrld |



Here's a function that I think will do what you want (you use it by putting the diacritic in front of the letter: ^ is upside-down but the function draws it right-side-up using pset).
function printd(s,x,y,c) local f="" for i=1,#s do local ss=sub(s,i,i) local xs=4*#f if ss=="'" then print(ss,x+xs+1,y-3,c) elseif ss=="`" then print(ss,x+xs-1,y-3,c) elseif ss=="-" then print(ss,x+xs,y-4,c) elseif ss=="^" then pset(x+xs,y-3,c) pset(x+xs+1,y-2,c) pset(x+xs+2,y-3,c) else f=f..ss end end print(f,x,y,c) end -- here's an example of how to use it function _draw() cls() printd("m-a m'a m^a m`a ma",32,64,7) end |
[Please log in to post a comment]