Anuncios Google

PrintLib (Hm7) (Biblioteca para Lua)

Hola a todos.

Hoy os presento PrintLib, que es una biblioteca creada por OoNEKERAFAoO para Lua que nos proporciona imprimir caracteres que Lua no los puede imprimir en pantalla. Estos son las vocales con tíldes, dieresis, eñes y otros caracteres raros. Por ahora esta en fase beta y tiene algunos errores, pero pronto se corregirán y el autor esta pasandolo para el Lua de PSP. Tabien tengo que decir que aún no la he probado, asi que si alguien puede, que me diga sus resultados

--[[
	PrintLib: Library to print all characters in non-English keyboards by the substitution of ASCII characters.
	Created by NEKERAFA on Sunday, 27 February 2011 at 20:17:16
	For Lua HM 7 version.
	This library is under license Creative Commons Reconocimiento-NoComercial-CompartirIgual 3.0 España. For more information: http://creativecommons.org/licenses/by-nc-sa/3.0/es/legalcod...
]]--
 
-- Begin of the library
 
-- Normal print
function PrintText(image, x, y, text, color)
local image, x, y, text, color
 
	-- Verification of variables
	if image == nil or type(image) == "number" then
		image = screen
	end
	if x == nil then
		error("No x value")
	end
	if y == nil then
		error("No y value")
	end
	if text == nil then
		error("No string to print")
	elseif string.len(text) == 0 then
		error("The string should be longer")
	end
	if color == nil then
		color = Color.new(255, 255, 255)
	end
 
	-- Printing of grave accents
	text = string.gsub(text, "á", "\160")
	text = string.gsub(text, "é", "\130")
	text = string.gsub(text, "í", "\161")
	text = string.gsub(text, "ó", "\162")
	text = string.gsub(text, "ú", "\163")
	text = string.gsub(text, "Á", "\193")
	text = string.gsub(text, "É", "\144")
	text = string.gsub(text, "Í", "\214")
	text = string.gsub(text, "Ó", "\224")
	text = string.gsub(text, "Ú", "\233")
 
	-- Printing of acute accents
	text = string.gsub(text, "à", "\133")
	text = string.gsub(text, "è", "\138")
	text = string.gsub(text, "ì", "\141")
	text = string.gsub(text, "ò", "\149")
	text = string.gsub(text, "ù", "\151")
	text = string.gsub(text, "À", "\183")
	text = string.gsub(text, "È", "\212")
	text = string.gsub(text, "Ì", "\222")
	text = string.gsub(text, "Ò", "\227")
	text = string.gsub(text, "Ù", "\235")
 
	-- Printing of circumflex accents
	text = string.gsub(text, "â", "\131")
	text = string.gsub(text, "ê", "\136")
	text = string.gsub(text, "î", "\140")
	text = string.gsub(text, "ô", "\147")
	text = string.gsub(text, "û", "\150")
	text = string.gsub(text, "Â", "\182")
	text = string.gsub(text, "Ê", "\210")
	text = string.gsub(text, "Î", "\215")
	text = string.gsub(text, "Ô", "\226")
	text = string.gsub(text, "Û", "\234")
 
	-- Printing of diaresis
	text = string.gsub(text, "ä", "\132")
	text = string.gsub(text, "ë", "\137")
	text = string.gsub(text, "ï", "\139")
	text = string.gsub(text, "ö", "\148")
	text = string.gsub(text, "ü", "\129")
	text = string.gsub(text, "Ä", "\142")
	text = string.gsub(text, "Ë", "\211")
	text = string.gsub(text, "Ï", "\216")
	text = string.gsub(text, "Ö", "\153")
	text = string.gsub(text, "Ü", "\154")
 
	-- Words from different languages
	text = string.gsub(text, "ç", "\135")
	text = string.gsub(text, "Ç", "\128")
	text = string.gsub(text, "ñ", "\164")
	text = string.gsub(text, "Ñ", "\165")
	text = string.gsub(text, "Ð", "\209")
	text = string.gsub(text, "ð", "\208")
	text = string.gsub(text, "þ", "\231")
	text = string.gsub(text, "Þ", "\232")
	text = string.gsub(text, "µ", "\230")
	text = string.gsub(text, "ß", "\225")
 
	-- Other symbols
	text = string.gsub(text, "¿", "\168")
	text = string.gsub(text, "¡", "\173")
	text = string.gsub(text, "|", "\124")
	text = string.gsub(text, "@", "\64")
	text = string.gsub(text, "~", "\126")
	text = string.gsub(text, "¬", "\170")
	text = string.gsub(text, "£", "\156")
	text = string.gsub(text, "©", "\184")
	text = string.gsub(text, "®", "\169")
 
	-- Now print the message with the symbols for lua and finished function
	image:print( x, y, text, color)
 
end
 
-- Font print
function FontPrintText(image, x, y, text, color, font)
local image, x, y, text, color, font
 
	-- Verification of variables
	if image == nil or type(image) == "number" then
		image = screen
	end
	if x == nil then
		error("No x value")
	end
	if y == nil then
		error("No y value")
	end
	if text == nil then
		error("No string to print")
	elseif string.len(text) == 0 then
		error("The string should be longer")
	end
	if color == nil or type(color) == "string" then
		color = Color.new(255, 255, 255)
	end
	if font == nil then
		error("No font detected")
	end
 
	text = string.gsub(text, "á", "\160")
	text = string.gsub(text, "é", "\130")
	text = string.gsub(text, "í", "\161")
	text = string.gsub(text, "ó", "\162")
	text = string.gsub(text, "ú", "\163")
	text = string.gsub(text, "Á", "\193")
	text = string.gsub(text, "É", "\144")
	text = string.gsub(text, "Í", "\214")
	text = string.gsub(text, "Ó", "\224")
	text = string.gsub(text, "Ú", "\233")
 
	-- Printing of acute accents
	text = string.gsub(text, "à", "\133")
	text = string.gsub(text, "è", "\138")
	text = string.gsub(text, "ì", "\141")
	text = string.gsub(text, "ò", "\149")
	text = string.gsub(text, "ù", "\151")
	text = string.gsub(text, "À", "\183")
	text = string.gsub(text, "È", "\212")
	text = string.gsub(text, "Ì", "\222")
	text = string.gsub(text, "Ò", "\227")
	text = string.gsub(text, "Ù", "\235")
 
	-- Printing of circumflex accents
	text = string.gsub(text, "â", "\131")
	text = string.gsub(text, "ê", "\136")
	text = string.gsub(text, "î", "\140")
	text = string.gsub(text, "ô", "\147")
	text = string.gsub(text, "û", "\150")
	text = string.gsub(text, "Â", "\182")
	text = string.gsub(text, "Ê", "\210")
	text = string.gsub(text, "Î", "\215")
	text = string.gsub(text, "Ô", "\226")
	text = string.gsub(text, "Û", "\234")
 
	-- Printing of diaresis
	text = string.gsub(text, "ä", "\132")
	text = string.gsub(text, "ë", "\137")
	text = string.gsub(text, "ï", "\139")
	text = string.gsub(text, "ö", "\148")
	text = string.gsub(text, "ü", "\129")
	text = string.gsub(text, "Ä", "\142")
	text = string.gsub(text, "Ë", "\211")
	text = string.gsub(text, "Ï", "\216")
	text = string.gsub(text, "Ö", "\153")
	text = string.gsub(text, "Ü", "\154")
 
	-- Words from different languages
	text = string.gsub(text, "ç", "\135")
	text = string.gsub(text, "Ç", "\128")
	text = string.gsub(text, "ñ", "\164")
	text = string.gsub(text, "Ñ", "\165")
	text = string.gsub(text, "Ð", "\209")
	text = string.gsub(text, "ð", "\208")
	text = string.gsub(text, "þ", "\231")
	text = string.gsub(text, "Þ", "\232")
	text = string.gsub(text, "µ", "\230")
	text = string.gsub(text, "ß", "\225")
 
	-- Other symbols
	text = string.gsub(text, "¿", "\168")
	text = string.gsub(text, "¡", "\173")
	text = string.gsub(text, "|", "\124")
	text = string.gsub(text, "@", "\64")
	text = string.gsub(text, "~", "\126")
	text = string.gsub(text, "¬", "\170")
	text = string.gsub(text, "£", "\156")
	text = string.gsub(text, "©", "\184")
	text = string.gsub(text, "®", "\169")
 
	-- Now print the message with the symbols for lua and finished function
	image:fontPrint(font, x, y, text, color)
 
end

Para poner el texto sin fuente se utiliza la función PrintText(imagen, x, y, texto, color), mientras para utilizar una fuente es FontPrintText(imagen, x, y, texto, color, fuente de texto)

Descarga con ejemplo (Beta 0.1(PSP): http://www.mediafire.com/file/nuwyb0d382a4q09/PrintLib%28PSP%29.zip)


NekeOS, el nuevo shell para PSP

PS4 500GB OFW, PS3 320GB OFW, PS3 500GB OFW, PSP 6.39 PRO-C Fix4.

Sony Xperia Z1 Compact con Android 5.1.1

Portatil Lenovo z50-70 Intel® Core™ i7-4510U y NVIDIA GeForce 840M con Elementary OS 0.3.2 Freya (64 bits) y Windows 10 (64 bits).


Anuncios Google