Last active
December 8, 2023 09:47
-
-
Save admannon/07eb77c1d59a1a3df6264d192b0f1dc6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#============================================================================== | |
# ** Message Thai Vovel and Outline Fix | |
#------------------------------------------------------------------------------ | |
# By : Admannon | |
#------------------------------------------------------------------------------ | |
# This code is licensed under the terms of the MIT license | |
#============================================================================== | |
#============================================================================== | |
# ** Window Message | |
#============================================================================== | |
class Window_Base < Window | |
@@THAI_MARKS = "\u0E31\u0E34\u0E35\u0E36\u0E37\u0E48\u0E49\u0E4A\u0E4B\u0E47\u0E4C\u0E38\u0E39\u0E4D\u0E3A" | |
@@TEXT_SLICE = /.[#{@@THAI_MARKS}]*/m | |
#-------------------------------------------------------------------------- | |
# * Preconvert Control Characters | |
#-------------------------------------------------------------------------- | |
alias thai_fix_convert_escape_characters convert_escape_characters unless $@ | |
def convert_escape_characters(text) | |
result = thai_fix_convert_escape_characters(text).clone | |
result.gsub!(/([#{@@THAI_MARKS}]+)\u0E33/, "\u0E4D\\1\u0E32") | |
result.gsub!(/\u0E33([#{@@THAI_MARKS}]+)/, "\u0E4D\\1\u0E32") | |
result.gsub!(/\u0E33/ , "\u0E4D\u0E32" ) | |
return result | |
end | |
#-------------------------------------------------------------------------- | |
# * Process Normal Character | |
#-------------------------------------------------------------------------- | |
def process_normal_character(c, pos) | |
c = " #{c}" | |
space_width = text_size(" ").width | |
text_width = text_size( c ).width | |
draw_text(pos[:x] - space_width, pos[:y], text_width << 1, pos[:height], c) | |
pos[:x] += text_width - space_width | |
end | |
#-------------------------------------------------------------------------- | |
# * Draw Text in Normal Window | |
#-------------------------------------------------------------------------- | |
def draw_text_ex(x, y, text) | |
reset_font_settings | |
text = convert_escape_characters(text) | |
pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)} | |
process_character(text.slice!(@@TEXT_SLICE), text, pos) until text.empty? | |
end | |
end | |
#============================================================================== | |
# ** Window Message | |
#============================================================================== | |
class Window_Message < Window_Base | |
#-------------------------------------------------------------------------- | |
# * Draw Text in Message Window | |
#-------------------------------------------------------------------------- | |
def process_all_text | |
open_and_wait | |
text = convert_escape_characters($game_message.all_text) | |
pos = {} | |
new_page(text, pos) | |
process_character(text.slice!(@@TEXT_SLICE), text, pos) until text.empty? | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
เดี๋ยวผมจะให้ลองใส่สระ ทั้งหมด 32 ตัว
ข้อความนี้
อะ อา อิ อี อึ อื อุ อู
เอะ เอ เเอะ เเอ เอียะ เอีย เอือะ เอือ
อัวะ อัว โอะ โอ เอาะ ออ เออะ เออ
อำ ใอ ไอ เอา ฤ ฤๅ ฦ ฦๅ
บางสระ ยังสร้างปัญหาอยู่ผมทดสอบเมื่อกี้นี้
ผมว่างจากโครงการ Windows ผมพอดี