detect zawgyi-unicode if string contain myanmar characters

This commit is contained in:
Thein Lin Kyaw
2023-08-31 11:19:47 +06:30
parent a97b6bff3f
commit 81eb30c03a

View File

@@ -4,6 +4,8 @@ Prawn::Text.module_eval do
def text(string, options = {})
return false if string.nil?
unless string.match(/[\u1000-\u109F]/).nil?
detector = MyanmarTools::ZawgyiDetector.new
score = detector.get_zawgyi_probability(string)
if score > 0 && score < 0.05
@@ -12,6 +14,7 @@ Prawn::Text.module_eval do
end
# we modify the options. don't change the user's hash
options = options.dup
end
p = options[:inline_format]
if p
@@ -25,4 +28,3 @@ Prawn::Text.module_eval do
formatted_text(array, options)
end
end