mirror of
https://github.com/pyrollo/display_modpack.git
synced 2024-11-27 16:43:45 +01:00
Bug fix on UTF-8 computation.
This commit is contained in:
parent
46d2ce085e
commit
8e2a2a158d
@ -1,12 +1,12 @@
|
||||
--[[
|
||||
|
||||
generated by ./make_font_mod.sh Sun Dec 17 21:23:59 CET 2017
|
||||
generated by tools/make_font_lua.sh Thu Dec 21 21:45:53 CET 2017
|
||||
|
||||
--]]
|
||||
|
||||
font_lib.register_font(
|
||||
'default',
|
||||
12,
|
||||
{ [0]=6, [32]=4, [33]=3, [34]=4, [35]=7, [36]=6, [37]=8, [38]=8, [39]=3, [40]=4, [41]=4, [42]=4, [43]=7, [44]=3, [45]=5, [46]=3, [47]=5, [48]=6, [49]=4, [50]=6, [51]=6, [52]=7, [53]=6, [54]=6, [55]=6, [56]=6, [57]=6, [58]=3, [59]=3, [60]=5, [61]=6, [62]=5, [63]=6, [64]=11, [65]=8, [66]=7, [67]=8, [68]=7, [69]=6, [70]=6, [71]=8, [72]=7, [73]=3, [74]=6, [75]=8, [76]=6, [77]=10, [78]=8, [79]=8, [80]=7, [81]=8, [82]=7, [83]=7, [84]=7, [85]=7, [86]=8, [87]=11, [88]=8, [89]=9, [90]=7, [91]=4, [92]=5, [93]=4, [94]=5, [95]=7, [96]=3, [97]=7, [98]=6, [99]=5, [100]=6, [101]=6, [102]=5, [103]=6, [104]=6, [105]=3, [106]=3, [107]=7, [108]=3, [109]=9, [110]=6, [111]=6, [112]=6, [113]=6, [114]=5, [115]=6, [116]=4, [117]=6, [118]=6, [119]=8, [120]=7, [121]=6, [122]=6, [123]=5, [124]=3, [125]=5, [126]=6, [138]=6, [141]=3, [161]=3, [177]=6, [191]=6, [193]=8, [194]=8, [195]=8, [196]=8, [197]=8, [198]=10, [199]=8, [200]=6, [201]=6, [202]=6, [203]=6, [204]=3, [205]=3, [206]=3, [207]=3, [208]=8, [209]=8, [210]=8, [211]=8, [212]=8, [213]=8, [214]=8, [215]=6, [216]=8, [217]=7, [218]=7, [219]=7, [220]=7, [221]=9, [224]=7, [225]=7, [226]=7, [227]=7, [228]=7, [229]=7, [230]=9, [231]=5, [232]=6, [233]=6, [234]=6, [235]=6, [236]=3, [237]=3, [238]=3, [239]=3, [242]=6, [244]=6, [245]=6, [246]=6, [247]=6, [249]=6, [250]=6, [251]=6, [252]=6, [253]=6, [255]=6 }
|
||||
{ [0]=6, [32]=4, [33]=3, [34]=4, [35]=7, [36]=6, [37]=8, [38]=8, [39]=3, [40]=4, [41]=4, [42]=4, [43]=7, [44]=3, [45]=5, [46]=3, [47]=5, [48]=6, [49]=4, [50]=6, [51]=6, [52]=7, [53]=6, [54]=6, [55]=6, [56]=6, [57]=6, [58]=3, [59]=3, [60]=5, [61]=6, [62]=5, [63]=6, [64]=11, [65]=8, [66]=7, [67]=8, [68]=7, [69]=6, [70]=6, [71]=8, [72]=7, [73]=3, [74]=6, [75]=8, [76]=6, [77]=10, [78]=8, [79]=8, [80]=7, [81]=8, [82]=7, [83]=7, [84]=7, [85]=7, [86]=8, [87]=11, [88]=8, [89]=9, [90]=7, [91]=4, [92]=5, [93]=4, [94]=5, [95]=7, [96]=3, [97]=7, [98]=6, [99]=5, [100]=6, [101]=6, [102]=5, [103]=6, [104]=6, [105]=3, [106]=3, [107]=7, [108]=3, [109]=9, [110]=6, [111]=6, [112]=6, [113]=6, [114]=5, [115]=6, [116]=4, [117]=6, [118]=6, [119]=8, [120]=7, [121]=6, [122]=6, [123]=5, [124]=3, [125]=5, [126]=6, [138]=6, [141]=3, [161]=3, [177]=6, [191]=6, [192]=8, [193]=8, [194]=8, [195]=8, [196]=8, [197]=8, [198]=10, [199]=8, [200]=6, [201]=6, [202]=6, [203]=6, [204]=3, [205]=3, [206]=3, [207]=3, [208]=8, [209]=8, [210]=8, [211]=8, [212]=8, [213]=8, [214]=8, [215]=6, [216]=8, [217]=7, [218]=7, [219]=7, [220]=7, [221]=9, [224]=7, [225]=7, [226]=7, [227]=7, [228]=7, [229]=7, [230]=9, [231]=5, [232]=6, [233]=6, [234]=6, [235]=6, [236]=3, [237]=3, [238]=3, [239]=3, [242]=6, [244]=6, [245]=6, [246]=6, [247]=6, [249]=6, [250]=6, [251]=6, [252]=6, [253]=6, [255]=6 }
|
||||
);
|
||||
|
||||
|
@ -47,6 +47,11 @@ local function get_next_char(text, pos)
|
||||
pos = pos + 1
|
||||
local char = text:sub(pos, pos):byte()
|
||||
|
||||
-- 1 byte char
|
||||
if char < 0x80 then
|
||||
return char, pos
|
||||
end
|
||||
|
||||
-- 4 bytes char not managed
|
||||
if char >= 0xF0 then
|
||||
pos = pos + 3
|
||||
@ -60,13 +65,14 @@ local function get_next_char(text, pos)
|
||||
end
|
||||
|
||||
-- 2 bytes char (little endian)
|
||||
if char >= 0x80 then
|
||||
if char >= 0xC2 then
|
||||
pos = pos + 1
|
||||
return char * 0x100 + text:sub(pos, pos):byte(), pos
|
||||
return (char - 0xC2) * 0x40 + text:sub(pos, pos):byte(), pos
|
||||
end
|
||||
|
||||
-- 1 byte char
|
||||
return char, pos
|
||||
|
||||
-- Not an UTF char
|
||||
return 0, pos
|
||||
|
||||
end
|
||||
|
||||
-- Returns font properties to be used according to font_name
|
||||
@ -151,6 +157,8 @@ function font_lib.make_line_texture(font_name, text, width, x, y)
|
||||
x, y, font.name, char)
|
||||
end
|
||||
x = x + font.widths[char]
|
||||
else
|
||||
print(string.format("Missing char %d (%04x)",char,char))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
BIN
font_lib/textures/font_default_00c0.png
Normal file
BIN
font_lib/textures/font_default_00c0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 160 B |
@ -35,7 +35,7 @@ done
|
||||
|
||||
echo "--[[
|
||||
|
||||
$luafile generated by $scriptname $(date)
|
||||
$luafile generated by $scriptname $(LANG=en_US date)
|
||||
|
||||
--]]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user