Add spanish to language options

Make MapText not crash when trying to create negative-width bitmaps

Add special rules to mklang
This commit is contained in:
tdixon 2017-05-04 22:01:00 -03:00
parent cff99c2dd9
commit 96f1c43ac1
3 changed files with 18 additions and 8 deletions

View file

@ -15,6 +15,12 @@ po = GetPomo::PoFile.parse(File.read(src_file))
File.open(dst_file, 'wb') do |file|
file.write(Marshal.dump(po.map do |t|
[Zlib.crc32(t.msgid), t.msgstr]
id = t.msgid
msg = t.msgstr
id = id.gsub("\\\\","\\")
id = id.gsub("\\\"", "\"")
msg = msg.gsub("\\\\","\\")
msg = msg.gsub("\\\"", "\"")
[Zlib.crc32(id), msg]
end.to_h))
end

View file

@ -10,11 +10,11 @@ class Sprite_MapText < Sprite
self.zoom_x = 2
self.zoom_y = 2
self.bitmap = Bitmap.new(200, 24)
#calculate text width
spacewidth = self.bitmap.text_size(' ').width
width = 0
text.split(' ').each do |word|
# Get width of this word
@ -22,17 +22,21 @@ class Sprite_MapText < Sprite
width += spacewidth
end
width -= spacewidth
if width <= 0
width = 1
end
self.bitmap.dispose
self.bitmap = Bitmap.new(width, 24)
self.bitmap.font.color = Color.new(81, 33, 129, 255)
self.bitmap.draw_text(0,0, width, 24, text)
self.bitmap.draw_text(0,0, width, 24, text)
self.src_rect.set(0, 0, width, 24)
self.oy = 24
self.ox = width/2
update
end

View file

@ -9,7 +9,7 @@ class Language
FONT_WESTERN = 'Terminus (TTF)'
FONT_CJK = 'WenQuanYi Micro Hei'
LANG_WESTERN = [
'en', 'fr', 'pt_BR'
'en', 'fr', 'pt_BR', 'es'
]
LANG_CJK = [
'ja', 'ko', 'zh_CN'