Open Ayan2357 opened 4 years ago
For instance, if I intend to animate বাংলা লেখা (look closely at the output), what I get is বাংলা লখো. Most of the times it spits out absolutely meaningless words.
script = '''এনেদৰে '''
class FirstScene(Scene):
def construct(self):
text=Text(script,font="Kalpurush" )
self.play(Write(text))
A sample code where the error occurs
this issue already exists #1012 please close the duplicate
see updated code below
@tshrpl where am i to paste it ?
# testing script
script = """বয়লারপ্লেট পাঠ্য বা সহজভাবে বয়লারপ্লেট হ'ল
এমন কোনও লিখিত পাঠ্য (অনুলিপি) যা মূল ক্ষেত্রে উল্লেখযোগ্য পরিবর্তন
ছাড়াই নতুন প্রসঙ্গে বা অ্যাপ্লিকেশনগুলিতে পুনরায় ব্যবহার করা
যেতে পারে। শব্দটি বিবৃতি, চুক্তি এবং কম্পিউটার কোডের
প্রসঙ্গে ব্যবহৃত হয় এবং মিডিয়াতে হ্যাকনিয়েড বা অনিয়মিত
লেখার জন্য ব্যবহৃত হয়।"""
class bangla_3(Scene):
def construct(self):
text1 = Assamese_Text(script).scale(0.5).set_color_by_gradient(BLUE, RED)
self.play(Write(text1))
self.wait()
# not heavily tested
class Assamese_Text(Text):
CONFIG = {
'font': 'Akaash' # put a bangla/assamese font which is installed
}
_bytes = { # replace multiple byte versions (left) with single byte ones (right)
'য়': 'য়',
'ড়': 'ড়'
}
_left_side_chars = ['ে', 'ি'] # bengali/assamese chars which are written on right but displayed on left
def __init__(self, text, **args):
text = self.format(text)
super(Assamese_Text, self).__init__(text, **args)
def format(self, s):
for i,j in self._bytes.items():
s = s.replace(i, j) # replace the two byte one with single byte version
s = list(s)
for i in range(1, len(s)):
if s[i] in self._left_side_chars:
s[i-1], s[i] = s[i], s[i-1]
return ''.join(s)
@tshrpl Check the very first word. It does not completely match with what it is meant to be
বয়লারপ্লেট, উল্লেখযোগ্য, অ্যাপ্লিকেশনগুলিতে.....these words are completely different than the input. Even without the code you inserted, they appear wrongly.
@Ayan2357 I asked my bangali friend to proofread he text presented here ........ she told me that the output is absolutely correct syntactically
প্লে roughly means e + P (half) + L
and the line bellow P means that it should be interpreted as half P, but this approach is considered outdated for some reason in bangla community ..... nonetheless this syntax in not invalid
but they appear wrong because they were written by google translator ...... also the code is very incomplete ......... i.e. you have to find the errors yourself and make changes in the code ..... I can't do that for you because I don't know bengali
@tshrpl I am a bit confused about what you meant. I tried out some words written by myself, not through google translator but i still got same errors. Just so that i get a little glimpse of what i need to work on can you just render প্লে in Manim so i get an idea of how to proceed.
@tshrpl Another observation of mine is that when i try to use tex works based on miktex, those words come out perfectly as desired but when rendered with manim it shows the wrong output.
\documentclass[preview]{standalone}
\usepackage{amsmath} \usepackage{amssymb} \usepackage{dsfont} \usepackage{setspace} \usepackage{tipa} \usepackage{relsize} \usepackage{textcomp} \usepackage{mathrsfs} \usepackage{calligra} \usepackage{wasysym} \usepackage{ragged2e} \usepackage{physics} \usepackage{xcolor} \usepackage{textcomp} \usepackage{microtype} %\DisableLigatures{encoding = , family = } \usepackage[UTF8]{ctex}
\usepackage{polyglossia} \setmainlanguage[numerals=Devanagari]{bengali} \setotherlanguage{english} \newfontfamily\englishfont[Scale=MatchLowercase]{Cambria} \newfontfamily\bengalifont[Script=Bengali]{Kalpurush}
\begin{document}
বয়লারপ্লেট
\end{document}
The reason Bengali and Assamese characters showing improperly is that Text
is using cairo as its text layout engine, which can't handle those languages correctly.
Currently I'm trying to switch cairo into pango, which can layout those languages properly.
But this takes time. Because in order to use pango, I need to wait a another python package called cairocffi to publish a new release. And other annoying staffs need to be adapted.
I estimate that I can finish this in the next year.
So until that, you probably need to use other softwares like Adobe Illustrator to generate the text svg and let SVGMobject to handle that.
Or using LaTeX
If this is a support request:
Please attempt to solve the problem on your own before opening an issue. Between old issues, StackOverflow, and Google, you should be able to find solutions to most of the common problems.
Include at least:
If this is a feature request:
Include the motivation for making this change.