添加barlow-condense字体作为首选英文字体(免费商用)
This commit is contained in:
@@ -388,6 +388,7 @@ function love.resize(w,h)
|
|||||||
if BG.resize then BG.resize(w,h)end
|
if BG.resize then BG.resize(w,h)end
|
||||||
if SCN.resize then SCN.resize(w,h)end
|
if SCN.resize then SCN.resize(w,h)end
|
||||||
WIDGET.resize(w,h)
|
WIDGET.resize(w,h)
|
||||||
|
resetFont()
|
||||||
|
|
||||||
SHADER.warning:send('w',w*SCR.dpi)
|
SHADER.warning:send('w',w*SCR.dpi)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,12 +2,17 @@ local gc=love.graphics
|
|||||||
local newFont=gc.setNewFont
|
local newFont=gc.setNewFont
|
||||||
local setNewFont=gc.setFont
|
local setNewFont=gc.setFont
|
||||||
local fontCache,currentFontSize={}
|
local fontCache,currentFontSize={}
|
||||||
if love.filesystem.getInfo('font.ttf')then
|
if
|
||||||
local fontData=love.filesystem.newFile('font.ttf')
|
love.filesystem.getInfo('barlowCond.ttf')and
|
||||||
|
love.filesystem.getInfo('puhui.ttf')
|
||||||
|
then
|
||||||
|
local fontData=love.filesystem.newFile('barlowCond.ttf')
|
||||||
|
local fallback=love.filesystem.newFile('puhui.ttf')
|
||||||
function setFont(s)
|
function setFont(s)
|
||||||
if s~=currentFontSize then
|
if s~=currentFontSize then
|
||||||
if not fontCache[s]then
|
if not fontCache[s]then
|
||||||
fontCache[s]=newFont(fontData,s)
|
fontCache[s]=newFont(fontData,s,'light',gc.getDPIScale()*SCR.k*2)
|
||||||
|
fontCache[s]:setFallbacks(newFont(fallback,s,'light',gc.getDPIScale()*SCR.k*2))
|
||||||
end
|
end
|
||||||
setNewFont(fontCache[s])
|
setNewFont(fontCache[s])
|
||||||
currentFontSize=s
|
currentFontSize=s
|
||||||
@@ -15,15 +20,22 @@ if love.filesystem.getInfo('font.ttf')then
|
|||||||
end
|
end
|
||||||
function getFont(s)
|
function getFont(s)
|
||||||
if not fontCache[s]then
|
if not fontCache[s]then
|
||||||
fontCache[s]=newFont(fontData,s)
|
fontCache[s]=newFont(fontData,s,'light',gc.getDPIScale()*SCR.k*2)
|
||||||
|
fontCache[s]:setFallbacks(newFont(fallback,s,'light',gc.getDPIScale()*SCR.k*2))
|
||||||
end
|
end
|
||||||
return fontCache[s]
|
return fontCache[s]
|
||||||
end
|
end
|
||||||
|
function resetFont()
|
||||||
|
for s in next,fontCache do
|
||||||
|
fontCache[s]=newFont(fontData,s,'light',gc.getDPIScale()*SCR.k*2)
|
||||||
|
fontCache[s]:setFallbacks(newFont(fallback,s,'light',gc.getDPIScale()*SCR.k*2))
|
||||||
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
function setFont(s)
|
function setFont(s)
|
||||||
if s~=currentFontSize then
|
if s~=currentFontSize then
|
||||||
if not fontCache[s]then
|
if not fontCache[s]then
|
||||||
fontCache[s]=newFont(s)
|
fontCache[s]=newFont(s,'light',gc.getDPIScale()*SCR.k*2)
|
||||||
end
|
end
|
||||||
setNewFont(fontCache[s])
|
setNewFont(fontCache[s])
|
||||||
currentFontSize=s
|
currentFontSize=s
|
||||||
@@ -31,8 +43,13 @@ else
|
|||||||
end
|
end
|
||||||
function getFont(s)
|
function getFont(s)
|
||||||
if not fontCache[s]then
|
if not fontCache[s]then
|
||||||
fontCache[s]=newFont(s)
|
fontCache[s]=newFont(s,'light',gc.getDPIScale()*SCR.k*2)
|
||||||
end
|
end
|
||||||
return fontCache[s]
|
return fontCache[s]
|
||||||
end
|
end
|
||||||
|
function resetFont()
|
||||||
|
for s in next,fontCache do
|
||||||
|
fontCache[s]=newFont(s,'light',gc.getDPIScale()*SCR.k*2)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
BIN
barlowCond.ttf
Normal file
BIN
barlowCond.ttf
Normal file
Binary file not shown.
Reference in New Issue
Block a user