<tfoot id='ocqBr'></tfoot>

    1. <small id='ocqBr'></small><noframes id='ocqBr'>

        <bdo id='ocqBr'></bdo><ul id='ocqBr'></ul>
      <legend id='ocqBr'><style id='ocqBr'><dir id='ocqBr'><q id='ocqBr'></q></dir></style></legend>
      <i id='ocqBr'><tr id='ocqBr'><dt id='ocqBr'><q id='ocqBr'><span id='ocqBr'><b id='ocqBr'><form id='ocqBr'><ins id='ocqBr'></ins><ul id='ocqBr'></ul><sub id='ocqBr'></sub></form><legend id='ocqBr'></legend><bdo id='ocqBr'><pre id='ocqBr'><center id='ocqBr'></center></pre></bdo></b><th id='ocqBr'></th></span></q></dt></tr></i><div id='ocqBr'><tfoot id='ocqBr'></tfoot><dl id='ocqBr'><fieldset id='ocqBr'></fieldset></dl></div>

      Kivy 没有正确显示(孟加拉语)加入角色?

      时间:2023-10-10

      <small id='VbkJb'></small><noframes id='VbkJb'>

    2. <i id='VbkJb'><tr id='VbkJb'><dt id='VbkJb'><q id='VbkJb'><span id='VbkJb'><b id='VbkJb'><form id='VbkJb'><ins id='VbkJb'></ins><ul id='VbkJb'></ul><sub id='VbkJb'></sub></form><legend id='VbkJb'></legend><bdo id='VbkJb'><pre id='VbkJb'><center id='VbkJb'></center></pre></bdo></b><th id='VbkJb'></th></span></q></dt></tr></i><div id='VbkJb'><tfoot id='VbkJb'></tfoot><dl id='VbkJb'><fieldset id='VbkJb'></fieldset></dl></div>
          • <bdo id='VbkJb'></bdo><ul id='VbkJb'></ul>
            <tfoot id='VbkJb'></tfoot>
            <legend id='VbkJb'><style id='VbkJb'><dir id='VbkJb'><q id='VbkJb'></q></dir></style></legend>

                <tbody id='VbkJb'></tbody>

              • 本文介绍了Kivy 没有正确显示(孟加拉语)加入角色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                Kivy Python 不支持孟加拉语加入字符,有没有其他办法解决这个问题?

                Kivy Python does not support Bengali joining characters,Is there any other way to solve this problem?

                谁能描述一下是什么问题?我能做些什么来解决它?

                Can any one please describe what is the problem? What can i do to solve it?

                预期输出:

                程序输出:

                推荐答案

                需要适当的文本渲染器来正确处理孟加拉字体(以及其他具有复杂字形的字体).文本渲染器 pango 具有后备、复杂字形处理等许多其他功能.截至目前,Kivy 支持功能有限的 pango 文本渲染器.目前,这已在 MacOS 和 Linux 中进行了测试.下面是演示如何使用 Kivy 安装 pango 文本渲染器的过程以及一个显示正确渲染孟加拉语文本的示例应用程序.该过程假定 Kivy 已安装在 Linux (Ubuntu 18.04) 中.

                Appropriate text renderer is needed to handle bangla fonts (and other fonts with complex glyphs) properly. The text renderer pango has features like fallback, complex glyph processing among many other features. Kivy supports pango text renderer with limited features as of now. Currently this has been tested in MacOS and Linux. Below is the procedure to demonstrate installation of pango text renderer with Kivy and an example app showing correct rendering of bangla text. The procedure assumed that Kivy is already installed in Linux (Ubuntu 18.04).

                1. 如果 pango 已经安装,请使用以下命令检查正确:

                1. Check with the following command if pango is already installed correctly:

                pkg-config --libs pangoft2

                如果 pango 安装正确,那么它会产生如下输出:

                if pango is installed correctly, then it would produce following output:

                -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype

                否则,如果它没有产生输出,那么它就没有被安装正确.在这种情况下,请继续下一步.

                Otherwise, if it produces no output, then it is not installed correctly. In this case proceed to next step.

                发出以下命令并等待它完成执行:

                Issue the following command and wait for it to finish the execution:

                sudo apt-get update

                接下来发出以下命令安装pango:

                Next issue the following command to install pango:

                sudo apt install libfreetype6-dev libpango1.0-dev libpangoft2-1.0-0

                如果安装正确,请再次检查步骤 1 中的命令.

                Again check with command in step 1 if installation is done properly.

                pango安装后,需要重新编译Kivy.对于第一个问题,以下命令:

                After pango installation, Kivy needs to be re-compiled. For this first issue the following command:

                sudo apt-get install -y 
                    python-pip 
                    build-essential 
                    git 
                    python 
                    python3-dev 
                    ffmpeg 
                    libsdl2-dev 
                    libsdl2-image-dev 
                    libsdl2-mixer-dev 
                    libsdl2-ttf-dev 
                    libportmidi-dev 
                    libswscale-dev 
                    libavformat-dev 
                    libavcodec-dev 
                    zlib1g-dev
                

              • 然后依次发出以下三个命令:

              • Then issue the following three commands sequentially:

                sudo pip3 install cython
                export USE_PANGOFT2=1
                export KIVY_TEXT=pango
                

                Cython 安装可能会收到 Requirement already compatible 消息,没关系.

                You may receive Requirement already satisfied message for Cython installation, which is ok.

                现在使用以下命令卸载 Kivy:

                Now uninstall Kivy with following command:

                sudo python3 -m pip uninstall kivy

                并使用以下命令安装 Kivy:

                And install Kivy with following command:

                sudo pip3 install kivy

                成功重新安装 Kivy 后,您可以运行以下示例:

                Once Kivy is re-installed successfully, you can run the following example:

                import os
                os.environ['KIVY_TEXT'] = 'pango'
                from kivy.app import App
                from kivy.lang import Builder
                
                
                APP_KV = """
                BoxLayout:
                    Label:
                        text: "সকালে"
                        font_size: '48sp'
                        font_name: 'font/kalpurush.ttf'
                """
                
                class MainApp(App):
                    def build(self):
                        return Builder.load_string(APP_KV)
                
                if __name__ == '__main__':
                    MainApp().run()
                

                KIVY_TEXT 环境设置可能不需要,因为之前已经导出.但这是为了展示如何选择文本渲染器.您需要在名为 font 的子目录下拥有字体文件 kalpurush.ttf(或任何其他孟加拉 unicode 字体文件).

                The KIVY_TEXT environment setting may not be needed as already exported earlier. But this is to show how you can select the text renderer. You need to have the font file kalpurush.ttf (or any other bangla unicode font file) under sub directory named font.

                运行程序时的Kivy日志如下:

                The Kivy log when you run the program is as follows:

                [INFO   ] [Logger      ] Record log in /home/kivy/.kivy/logs/kivy_20-08-31_9.txt
                [INFO   ] [Kivy        ] v1.11.1
                [INFO   ] [Kivy        ] Installed at "/usr/local/lib/python3.6/dist-packages/kivy/__init__.py"
                [INFO   ] [Python      ] v3.6.8 (default, Oct  7 2019, 12:59:55) 
                [GCC 8.3.0]
                [INFO   ] [Python      ] Interpreter at "/usr/bin/python3"
                [INFO   ] [Factory     ] 184 symbols loaded
                [INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
                [INFO   ] [Window      ] Provider: sdl2(['window_egl_rpi'] ignored)
                [INFO   ] [GL          ] Using the "OpenGL" graphics system
                [INFO   ] [GL          ] Backend used <sdl2>
                [INFO   ] [GL          ] OpenGL version <b'3.1 Mesa 19.0.8'>
                [INFO   ] [GL          ] OpenGL vendor <b'VMware, Inc.'>
                [INFO   ] [GL          ] OpenGL renderer <b'llvmpipe (LLVM 8.0, 256 bits)'>
                [INFO   ] [GL          ] OpenGL parsed version: 3, 1
                [INFO   ] [GL          ] Shading version <b'1.40'>
                [INFO   ] [GL          ] Texture max size <8192>
                [INFO   ] [GL          ] Texture max units <32>
                [INFO   ] [Window      ] auto add sdl2 input provider
                [INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
                [INFO   ] [Text        ] Provider: pango
                [INFO   ] [Base        ] Start application main loop
                [INFO   ] [GL          ] NPOT texture support is available
                [INFO   ] [WindowSDL   ] exiting mainloop and closing.
                [INFO   ] [Base        ] Leaving application in progress...
                

                请注意,文本提供程序是 pango.

                Please note that the Text provider is pango.

                程序的输出:

                因此,文本正确呈现.您可以使用任何其他复合孟加拉字母进行测试,它会正确呈现.

                So, the text is rendered correctly. You can test with any other compound bangla letters, it will render correctly.

                对于 Windows 等其他平台,挑战在于正确安装 pango.这样做可能并不简单,因为到目前为止我还没有找到简单的方法.可能是 pango 需要从源代码编译它的依赖项.

                For other platforms like Windows, the challenge is to correctly install pango. It may not be trivial to do so as there is no simple way I have found so far. May be pango needs to be compiled from source with it's dependencies.

                这篇关于Kivy 没有正确显示(孟加拉语)加入角色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

              • 上一篇:Kivy FileChooser 双击 下一篇:如何从 Kivy 中的另一个小部件访问某些小部件属

                相关文章

                最新文章

                    <bdo id='p8SkY'></bdo><ul id='p8SkY'></ul>

                1. <tfoot id='p8SkY'></tfoot>
                  <i id='p8SkY'><tr id='p8SkY'><dt id='p8SkY'><q id='p8SkY'><span id='p8SkY'><b id='p8SkY'><form id='p8SkY'><ins id='p8SkY'></ins><ul id='p8SkY'></ul><sub id='p8SkY'></sub></form><legend id='p8SkY'></legend><bdo id='p8SkY'><pre id='p8SkY'><center id='p8SkY'></center></pre></bdo></b><th id='p8SkY'></th></span></q></dt></tr></i><div id='p8SkY'><tfoot id='p8SkY'></tfoot><dl id='p8SkY'><fieldset id='p8SkY'></fieldset></dl></div>
                2. <small id='p8SkY'></small><noframes id='p8SkY'>

                  <legend id='p8SkY'><style id='p8SkY'><dir id='p8SkY'><q id='p8SkY'></q></dir></style></legend>