Commits

Bart van Strien committed c750969

newFont and setFont now have a default size argument once again

Comments (0)

Files changed (2)

src/scripts/graphics.lua

 ]]
 
 	love.graphics.newFont = function(font, size)
-		if type(font) == "number" then
+		if type(font) == "number" or not font then
 			size = font
 			font = love.filesystem.newFileData(vera_ttf_b64, "Vera.ttf", "base64")
 		end
-		return love.graphics.newFont1(font, size)
+		return love.graphics.newFont1(font, size or 12)
 	end
 
 	love.graphics.setFont = function(font, size)
-		if type(font) == "number" then
+		if type(font) == "number" or not font then
 			size = font
 			font = love.filesystem.newFileData(vera_ttf_b64, "Vera.ttf", "base64")
 		end
-		return love.graphics.setFont1(font, size)
+		return love.graphics.setFont1(font, size or 12)
 	end
 
 	love.graphics.print = function (...)
-		if not love.graphics.getFont() then 
+		if not love.graphics.getFont() then
 			love.graphics.setFont(12)
 		end
 		love.graphics.print1(...)
 	end
 
 	love.graphics.printf = function (...)
-		if not love.graphics.getFont() then 
+		if not love.graphics.getFont() then
 			love.graphics.setFont(12)
 		end
 		love.graphics.printf1(...)

src/scripts/graphics.lua.h

 	0x65,0x77,0x46,0x6F,0x6E,0x74,0x20,0x3D,0x20,0x66,0x75,0x6E,0x63,0x74,0x69,
 	0x6F,0x6E,0x28,0x66,0x6F,0x6E,0x74,0x2C,0x20,0x73,0x69,0x7A,0x65,0x29,0x0D,
 	0x0A,0x09,0x09,0x69,0x66,0x20,0x74,0x79,0x70,0x65,0x28,0x66,0x6F,0x6E,0x74,
-	0x29,0x20,0x3D,0x3D,0x20,0x22,0x6E,0x75,0x6D,0x62,0x65,0x72,0x22,0x20,0x74,
-	0x68,0x65,0x6E,0x0D,0x0A,0x09,0x09,0x09,0x73,0x69,0x7A,0x65,0x20,0x3D,0x20,
-	0x66,0x6F,0x6E,0x74,0x0D,0x0A,0x09,0x09,0x09,0x66,0x6F,0x6E,0x74,0x20,0x3D,
-	0x20,0x6C,0x6F,0x76,0x65,0x2E,0x66,0x69,0x6C,0x65,0x73,0x79,0x73,0x74,0x65,
-	0x6D,0x2E,0x6E,0x65,0x77,0x46,0x69,0x6C,0x65,0x44,0x61,0x74,0x61,0x28,0x76,
-	0x65,0x72,0x61,0x5F,0x74,0x74,0x66,0x5F,0x62,0x36,0x34,0x2C,0x20,0x22,0x56,
-	0x65,0x72,0x61,0x2E,0x74,0x74,0x66,0x22,0x2C,0x20,0x22,0x62,0x61,0x73,0x65,
-	0x36,0x34,0x22,0x29,0x0D,0x0A,0x09,0x09,0x65,0x6E,0x64,0x0D,0x0A,0x09,0x09,
-	0x72,0x65,0x74,0x75,0x72,0x6E,0x20,0x6C,0x6F,0x76,0x65,0x2E,0x67,0x72,0x61,
-	0x70,0x68,0x69,0x63,0x73,0x2E,0x6E,0x65,0x77,0x46,0x6F,0x6E,0x74,0x31,0x28,
-	0x66,0x6F,0x6E,0x74,0x2C,0x20,0x73,0x69,0x7A,0x65,0x29,0x0D,0x0A,0x09,0x65,
-	0x6E,0x64,0x0D,0x0A,0x0D,0x0A,0x09,0x6C,0x6F,0x76,0x65,0x2E,0x67,0x72,0x61,
-	0x70,0x68,0x69,0x63,0x73,0x2E,0x73,0x65,0x74,0x46,0x6F,0x6E,0x74,0x20,0x3D,
-	0x20,0x66,0x75,0x6E,0x63,0x74,0x69,0x6F,0x6E,0x28,0x66,0x6F,0x6E,0x74,0x2C,
-	0x20,0x73,0x69,0x7A,0x65,0x29,0x0D,0x0A,0x09,0x09,0x69,0x66,0x20,0x74,0x79,
-	0x70,0x65,0x28,0x66,0x6F,0x6E,0x74,0x29,0x20,0x3D,0x3D,0x20,0x22,0x6E,0x75,
-	0x6D,0x62,0x65,0x72,0x22,0x20,0x74,0x68,0x65,0x6E,0x0D,0x0A,0x09,0x09,0x09,
+	0x29,0x20,0x3D,0x3D,0x20,0x22,0x6E,0x75,0x6D,0x62,0x65,0x72,0x22,0x20,0x6F,
+	0x72,0x20,0x6E,0x6F,0x74,0x20,0x66,0x6F,0x6E,0x74,0x20,0x74,0x68,0x65,0x6E,
+	0x0D,0x0A,0x09,0x09,0x09,0x73,0x69,0x7A,0x65,0x20,0x3D,0x20,0x66,0x6F,0x6E,
+	0x74,0x0D,0x0A,0x09,0x09,0x09,0x66,0x6F,0x6E,0x74,0x20,0x3D,0x20,0x6C,0x6F,
+	0x76,0x65,0x2E,0x66,0x69,0x6C,0x65,0x73,0x79,0x73,0x74,0x65,0x6D,0x2E,0x6E,
+	0x65,0x77,0x46,0x69,0x6C,0x65,0x44,0x61,0x74,0x61,0x28,0x76,0x65,0x72,0x61,
+	0x5F,0x74,0x74,0x66,0x5F,0x62,0x36,0x34,0x2C,0x20,0x22,0x56,0x65,0x72,0x61,
+	0x2E,0x74,0x74,0x66,0x22,0x2C,0x20,0x22,0x62,0x61,0x73,0x65,0x36,0x34,0x22,
+	0x29,0x0D,0x0A,0x09,0x09,0x65,0x6E,0x64,0x0D,0x0A,0x09,0x09,0x72,0x65,0x74,
+	0x75,0x72,0x6E,0x20,0x6C,0x6F,0x76,0x65,0x2E,0x67,0x72,0x61,0x70,0x68,0x69,
+	0x63,0x73,0x2E,0x6E,0x65,0x77,0x46,0x6F,0x6E,0x74,0x31,0x28,0x66,0x6F,0x6E,
+	0x74,0x2C,0x20,0x73,0x69,0x7A,0x65,0x20,0x6F,0x72,0x20,0x31,0x32,0x29,0x0D,
+	0x0A,0x09,0x65,0x6E,0x64,0x0D,0x0A,0x0D,0x0A,0x09,0x6C,0x6F,0x76,0x65,0x2E,
+	0x67,0x72,0x61,0x70,0x68,0x69,0x63,0x73,0x2E,0x73,0x65,0x74,0x46,0x6F,0x6E,
+	0x74,0x20,0x3D,0x20,0x66,0x75,0x6E,0x63,0x74,0x69,0x6F,0x6E,0x28,0x66,0x6F,
+	0x6E,0x74,0x2C,0x20,0x73,0x69,0x7A,0x65,0x29,0x0D,0x0A,0x09,0x09,0x69,0x66,
+	0x20,0x74,0x79,0x70,0x65,0x28,0x66,0x6F,0x6E,0x74,0x29,0x20,0x3D,0x3D,0x20,
+	0x22,0x6E,0x75,0x6D,0x62,0x65,0x72,0x22,0x20,0x6F,0x72,0x20,0x6E,0x6F,0x74,
+	0x20,0x66,0x6F,0x6E,0x74,0x20,0x74,0x68,0x65,0x6E,0x0D,0x0A,0x09,0x09,0x09,
 	0x73,0x69,0x7A,0x65,0x20,0x3D,0x20,0x66,0x6F,0x6E,0x74,0x0D,0x0A,0x09,0x09,
 	0x09,0x66,0x6F,0x6E,0x74,0x20,0x3D,0x20,0x6C,0x6F,0x76,0x65,0x2E,0x66,0x69,
 	0x6C,0x65,0x73,0x79,0x73,0x74,0x65,0x6D,0x2E,0x6E,0x65,0x77,0x46,0x69,0x6C,
 	0x65,0x6E,0x64,0x0D,0x0A,0x09,0x09,0x72,0x65,0x74,0x75,0x72,0x6E,0x20,0x6C,
 	0x6F,0x76,0x65,0x2E,0x67,0x72,0x61,0x70,0x68,0x69,0x63,0x73,0x2E,0x73,0x65,
 	0x74,0x46,0x6F,0x6E,0x74,0x31,0x28,0x66,0x6F,0x6E,0x74,0x2C,0x20,0x73,0x69,
-	0x7A,0x65,0x29,0x0D,0x0A,0x09,0x65,0x6E,0x64,0x0D,0x0A,0x0D,0x0A,0x09,0x6C,
-	0x6F,0x76,0x65,0x2E,0x67,0x72,0x61,0x70,0x68,0x69,0x63,0x73,0x2E,0x70,0x72,
-	0x69,0x6E,0x74,0x20,0x3D,0x20,0x66,0x75,0x6E,0x63,0x74,0x69,0x6F,0x6E,0x20,
-	0x28,0x2E,0x2E,0x2E,0x29,0x0D,0x0A,0x09,0x09,0x69,0x66,0x20,0x6E,0x6F,0x74,
-	0x20,0x6C,0x6F,0x76,0x65,0x2E,0x67,0x72,0x61,0x70,0x68,0x69,0x63,0x73,0x2E,
-	0x67,0x65,0x74,0x46,0x6F,0x6E,0x74,0x28,0x29,0x20,0x74,0x68,0x65,0x6E,0x20,
-	0x0D,0x0A,0x09,0x09,0x09,0x6C,0x6F,0x76,0x65,0x2E,0x67,0x72,0x61,0x70,0x68,
-	0x69,0x63,0x73,0x2E,0x73,0x65,0x74,0x46,0x6F,0x6E,0x74,0x28,0x31,0x32,0x29,
-	0x0D,0x0A,0x09,0x09,0x65,0x6E,0x64,0x0D,0x0A,0x09,0x09,0x6C,0x6F,0x76,0x65,
-	0x2E,0x67,0x72,0x61,0x70,0x68,0x69,0x63,0x73,0x2E,0x70,0x72,0x69,0x6E,0x74,
-	0x31,0x28,0x2E,0x2E,0x2E,0x29,0x0D,0x0A,0x09,0x09,0x6C,0x6F,0x76,0x65,0x2E,
-	0x67,0x72,0x61,0x70,0x68,0x69,0x63,0x73,0x2E,0x70,0x72,0x69,0x6E,0x74,0x20,
-	0x3D,0x20,0x6C,0x6F,0x76,0x65,0x2E,0x67,0x72,0x61,0x70,0x68,0x69,0x63,0x73,
-	0x2E,0x70,0x72,0x69,0x6E,0x74,0x31,0x0D,0x0A,0x09,0x65,0x6E,0x64,0x0D,0x0A,
-	0x0D,0x0A,0x09,0x6C,0x6F,0x76,0x65,0x2E,0x67,0x72,0x61,0x70,0x68,0x69,0x63,
-	0x73,0x2E,0x70,0x72,0x69,0x6E,0x74,0x66,0x20,0x3D,0x20,0x66,0x75,0x6E,0x63,
-	0x74,0x69,0x6F,0x6E,0x20,0x28,0x2E,0x2E,0x2E,0x29,0x0D,0x0A,0x09,0x09,0x69,
-	0x66,0x20,0x6E,0x6F,0x74,0x20,0x6C,0x6F,0x76,0x65,0x2E,0x67,0x72,0x61,0x70,
-	0x68,0x69,0x63,0x73,0x2E,0x67,0x65,0x74,0x46,0x6F,0x6E,0x74,0x28,0x29,0x20,
-	0x74,0x68,0x65,0x6E,0x20,0x0D,0x0A,0x09,0x09,0x09,0x6C,0x6F,0x76,0x65,0x2E,
+	0x7A,0x65,0x20,0x6F,0x72,0x20,0x31,0x32,0x29,0x0D,0x0A,0x09,0x65,0x6E,0x64,
+	0x0D,0x0A,0x0D,0x0A,0x09,0x6C,0x6F,0x76,0x65,0x2E,0x67,0x72,0x61,0x70,0x68,
+	0x69,0x63,0x73,0x2E,0x70,0x72,0x69,0x6E,0x74,0x20,0x3D,0x20,0x66,0x75,0x6E,
+	0x63,0x74,0x69,0x6F,0x6E,0x20,0x28,0x2E,0x2E,0x2E,0x29,0x0D,0x0A,0x09,0x09,
+	0x69,0x66,0x20,0x6E,0x6F,0x74,0x20,0x6C,0x6F,0x76,0x65,0x2E,0x67,0x72,0x61,
+	0x70,0x68,0x69,0x63,0x73,0x2E,0x67,0x65,0x74,0x46,0x6F,0x6E,0x74,0x28,0x29,
+	0x20,0x74,0x68,0x65,0x6E,0x0D,0x0A,0x09,0x09,0x09,0x6C,0x6F,0x76,0x65,0x2E,
 	0x67,0x72,0x61,0x70,0x68,0x69,0x63,0x73,0x2E,0x73,0x65,0x74,0x46,0x6F,0x6E,
 	0x74,0x28,0x31,0x32,0x29,0x0D,0x0A,0x09,0x09,0x65,0x6E,0x64,0x0D,0x0A,0x09,
 	0x09,0x6C,0x6F,0x76,0x65,0x2E,0x67,0x72,0x61,0x70,0x68,0x69,0x63,0x73,0x2E,
-	0x70,0x72,0x69,0x6E,0x74,0x66,0x31,0x28,0x2E,0x2E,0x2E,0x29,0x0D,0x0A,0x09,
-	0x09,0x6C,0x6F,0x76,0x65,0x2E,0x67,0x72,0x61,0x70,0x68,0x69,0x63,0x73,0x2E,
-	0x70,0x72,0x69,0x6E,0x74,0x66,0x20,0x3D,0x20,0x6C,0x6F,0x76,0x65,0x2E,0x67,
-	0x72,0x61,0x70,0x68,0x69,0x63,0x73,0x2E,0x70,0x72,0x69,0x6E,0x74,0x66,0x31,
-	0x0D,0x0A,0x09,0x65,0x6E,0x64,0x0D,0x0A,0x0D,0x0A,0x65,0x6E,0x64,0x0D,0x0A,
-	
+	0x70,0x72,0x69,0x6E,0x74,0x31,0x28,0x2E,0x2E,0x2E,0x29,0x0D,0x0A,0x09,0x09,
+	0x6C,0x6F,0x76,0x65,0x2E,0x67,0x72,0x61,0x70,0x68,0x69,0x63,0x73,0x2E,0x70,
+	0x72,0x69,0x6E,0x74,0x20,0x3D,0x20,0x6C,0x6F,0x76,0x65,0x2E,0x67,0x72,0x61,
+	0x70,0x68,0x69,0x63,0x73,0x2E,0x70,0x72,0x69,0x6E,0x74,0x31,0x0D,0x0A,0x09,
+	0x65,0x6E,0x64,0x0D,0x0A,0x0D,0x0A,0x09,0x6C,0x6F,0x76,0x65,0x2E,0x67,0x72,
+	0x61,0x70,0x68,0x69,0x63,0x73,0x2E,0x70,0x72,0x69,0x6E,0x74,0x66,0x20,0x3D,
+	0x20,0x66,0x75,0x6E,0x63,0x74,0x69,0x6F,0x6E,0x20,0x28,0x2E,0x2E,0x2E,0x29,
+	0x0D,0x0A,0x09,0x09,0x69,0x66,0x20,0x6E,0x6F,0x74,0x20,0x6C,0x6F,0x76,0x65,
+	0x2E,0x67,0x72,0x61,0x70,0x68,0x69,0x63,0x73,0x2E,0x67,0x65,0x74,0x46,0x6F,
+	0x6E,0x74,0x28,0x29,0x20,0x74,0x68,0x65,0x6E,0x0D,0x0A,0x09,0x09,0x09,0x6C,
+	0x6F,0x76,0x65,0x2E,0x67,0x72,0x61,0x70,0x68,0x69,0x63,0x73,0x2E,0x73,0x65,
+	0x74,0x46,0x6F,0x6E,0x74,0x28,0x31,0x32,0x29,0x0D,0x0A,0x09,0x09,0x65,0x6E,
+	0x64,0x0D,0x0A,0x09,0x09,0x6C,0x6F,0x76,0x65,0x2E,0x67,0x72,0x61,0x70,0x68,
+	0x69,0x63,0x73,0x2E,0x70,0x72,0x69,0x6E,0x74,0x66,0x31,0x28,0x2E,0x2E,0x2E,
+	0x29,0x0D,0x0A,0x09,0x09,0x6C,0x6F,0x76,0x65,0x2E,0x67,0x72,0x61,0x70,0x68,
+	0x69,0x63,0x73,0x2E,0x70,0x72,0x69,0x6E,0x74,0x66,0x20,0x3D,0x20,0x6C,0x6F,
+	0x76,0x65,0x2E,0x67,0x72,0x61,0x70,0x68,0x69,0x63,0x73,0x2E,0x70,0x72,0x69,
+	0x6E,0x74,0x66,0x31,0x0D,0x0A,0x09,0x65,0x6E,0x64,0x0D,0x0A,0x0D,0x0A,0x65,
+	0x6E,0x64,0x0D,0x0A,
 };
 // [/graphics.lua]