Remove love.graphics.setFont([<file>,] <size>) shorthand, idiom is now love.graphics.newFont([<file>,] <size>):set()

This makes sure that setFont doesn't create any fonts.
This commit is contained in:
Bart van Strien
2011-12-13 18:51:24 +01:00
parent d5d2e7b5ae
commit 9682ebecf9
6 changed files with 23 additions and 81 deletions
+2 -10
View File
@@ -1252,17 +1252,9 @@ do
return love.graphics.newFont1(font, size or 12)
end
love.graphics.setFont = function(font, size)
if type(font) == "number" or not font then
size = font
font = vera_ttf
end
return love.graphics.setFont1(font, size or 12)
end
love.graphics.print = function (...)
if not love.graphics.getFont() then
love.graphics.setFont(12)
love.graphics.newFont(12):set()
end
love.graphics.print1(...)
love.graphics.print = love.graphics.print1
@@ -1270,7 +1262,7 @@ do
love.graphics.printf = function (...)
if not love.graphics.getFont() then
love.graphics.setFont(12)
love.graphics.newFont(12):set()
end
love.graphics.printf1(...)
love.graphics.printf = love.graphics.printf1
+4 -17
View File
@@ -6203,27 +6203,14 @@ const unsigned char graphics_lua[] =
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, 0x0a,
0x09, 0x65, 0x6e, 0x64, 0x0a,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, 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, 0x0a,
0x09, 0x09, 0x09, 0x73, 0x69, 0x7a, 0x65, 0x20, 0x3d, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x0a,
0x09, 0x09, 0x09, 0x66, 0x6f, 0x6e, 0x74, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x72, 0x61, 0x5f, 0x74, 0x74, 0x66, 0x0a,
0x09, 0x09, 0x65, 0x6e, 0x64, 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, 0x20, 0x6f, 0x72, 0x20, 0x31, 0x32, 0x29, 0x0a,
0x09, 0x65, 0x6e, 0x64, 0x0a,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, 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, 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, 0x0a,
0x09, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x6e,
0x65, 0x77, 0x46, 0x6f, 0x6e, 0x74, 0x28, 0x31, 0x32, 0x29, 0x3a, 0x73, 0x65, 0x74, 0x28, 0x29, 0x0a,
0x09, 0x09, 0x65, 0x6e, 0x64, 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, 0x0a,
@@ -6237,8 +6224,8 @@ const unsigned char graphics_lua[] =
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, 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, 0x0a,
0x09, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x6e,
0x65, 0x77, 0x46, 0x6f, 0x6e, 0x74, 0x28, 0x31, 0x32, 0x29, 0x3a, 0x73, 0x65, 0x74, 0x28, 0x29, 0x0a,
0x09, 0x09, 0x65, 0x6e, 0x64, 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, 0x0a,