utf-8 font support for animated titles (i.e. Blender)

Bug #670960 reported by Saša Janiška
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenShot Video Editor
Fix Released
High
Unassigned

Bug Description

Hello!

I've tried animated titles created with the help of the Blender, but none of the available fonts do not support e.g. Croatian native characters (šŠ đĐ čČ ćĆ žŽ).

Not being familiar with the Blender, I wonder waht would be required so that one can create animated titles using non-ASCII characters?

Sincerely,
Gour

Tags: wishlist
Revision history for this message
Saša Janiška (gour) wrote :

Any stanza on this one?

Revision history for this message
Jonathan Thomas (jonoomph) wrote :

I did some research on this bug today, and it looks like Blender does not yet support unicode fonts. This surprises me, but I did some tests, and spoke to a few Blender folks in IRC and they confirmed what I was seeing... no unicode support. =(

So... Not much I can do, unless someone can figure out how to get unicode fonts working in Blender first. I am marking this bug as 'invalid', since there is nothing in OpenShot which can fix this. Thanks!

Changed in openshot:
importance: Undecided → High
status: New → Invalid
Revision history for this message
IRIE Shinsuke (irie) wrote :

> it looks like Blender does not yet support unicode fonts.

Umm... that's strange. In Blender UI, I can select unicode font and actually can use CJK characters for text objects.

Revision history for this message
Jonathan Thomas (jonoomph) wrote : Re: [Openshot.developers] [Bug 670960] Re: utf-8 font support for animate titles

Can you give me a step by step on how you do this in Blender? I feel like I
can make it work, if I can see it work in Blender.

On Thu, Jan 27, 2011 at 10:57 AM, IRIE Shinsuke
<email address hidden>wrote:

> > it looks like Blender does not yet support unicode fonts.
>
> Umm... that's strange. In Blender UI, I can select unicode font and
> actually can use CJK characters for text objects.
>
> --
> You received this bug notification because you are a member of OpenShot
> Developers, which is subscribed to OpenShot Video Editor.
> https://bugs.launchpad.net/bugs/670960
>
> Title:
> utf-8 font support for animate titles
>
> Status in OpenShot Video Editor:
> Invalid
>
> Bug description:
> Hello!
>
> I've tried animated titles created with the help of the Blender, but
> none of the available fonts do not support e.g. Croatian native
> characters (šŠ đĐ čČ ćĆ žŽ).
>
> Not being familiar with the Blender, I wonder waht would be required
> so that one can create animated titles using non-ASCII characters?
>
>
> Sincerely,
> Gour
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openshot.developers
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~openshot.developers
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Jonathan Thomas (jonoomph) wrote :

Also, here is a great write-up of the problem, and a few solutions we might
be able to use:
http://blenderartists.org/forum/showthread.php?t=204602&page=1

On Thu, Jan 27, 2011 at 11:29 AM, Jonathan Thomas
<email address hidden>wrote:

> Can you give me a step by step on how you do this in Blender? I feel like
> I can make it work, if I can see it work in Blender.
>
>
> On Thu, Jan 27, 2011 at 10:57 AM, IRIE Shinsuke <<email address hidden>
> > wrote:
>
>> > it looks like Blender does not yet support unicode fonts.
>>
>> Umm... that's strange. In Blender UI, I can select unicode font and
>> actually can use CJK characters for text objects.
>>
>> --
>> You received this bug notification because you are a member of OpenShot
>> Developers, which is subscribed to OpenShot Video Editor.
>> https://bugs.launchpad.net/bugs/670960
>>
>> Title:
>> utf-8 font support for animate titles
>>
>> Status in OpenShot Video Editor:
>> Invalid
>>
>> Bug description:
>> Hello!
>>
>> I've tried animated titles created with the help of the Blender, but
>> none of the available fonts do not support e.g. Croatian native
>> characters (šŠ đĐ čČ ćĆ žŽ).
>>
>> Not being familiar with the Blender, I wonder waht would be required
>> so that one can create animated titles using non-ASCII characters?
>>
>>
>> Sincerely,
>> Gour
>>
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~openshot.developers
>> Post to : <email address hidden>
>> Unsubscribe : https://launchpad.net/~openshot.developers
>> More help : https://help.launchpad.net/ListHelp
>>
>
>

Revision history for this message
Olivier Girard (eolinwen) wrote : Re: utf-8 font support for animate titles

Only the part who is new in the development version, i suppose. So, we can imagine that will come after in the RC or in the final.
Thanks for all.

Revision history for this message
Jonathan Thomas (jonoomph) wrote :

Using some advice I found on the previous forum thread, I was able to figure it out. I had to add a new font to each Blender animation (which supports unicode), and make a few tweaks to the XML and .py scripts. The default font 'Bfont' does not support unicode, but now there is a new font (in the font dropdown) that is called UnDotum (Unicode), which fully supports unicode. This seems like a good first step. I tested with Japanese, and it worked fine on all animations. This is committed to the trunk, so let me know how it works for you.

Changed in openshot:
milestone: none → 1.3.0
status: Invalid → Fix Committed
summary: - utf-8 font support for animate titles
+ utf-8 font support for animated titles (i.e. Blender)
Revision history for this message
IRIE Shinsuke (irie) wrote :

I tested r439.

In my system, selecting UnDotum font in the dropdown menu seems ineffectual, unfortunately. Even if it's chosen, the characters have the same shapes as Bfont, so CJK characters still cannot be shown at all.

In Blender, to use CJK characters for 3D text, I have to load unicode enabled .ttf file at font selector in property panel. Therefore, it may be necessary to add font file dialog to the animated title editor.

Revision history for this message
Saša Janiška (gour) wrote :

Same here...pulled latest revision (revno: 439), tried with the title containing Croatian characters (šŠ đĐ čČ ćĆ žŽ) and selected UnDotum font, but none of the Croatian charactes are displayed.

You can try for yourself by copying the above character subset from above...

Thank you, anyway, for working on it.

Revision history for this message
Jonathan Thomas (jonoomph) wrote :

Okay, I think I understand. The UnDotum font supported some of the asian characters, but not the Croation characters. I tried out LiberationSans, and it works great with Croation and English, but not with the asian characters... hmmm.. Is there 1 font which can support all of these unicode characters?

Revision history for this message
Saša Janiška (gour) wrote :

Gentium, maybe?

Revision history for this message
Jonathan Thomas (jonoomph) wrote :

Okay, let's try this again. I've replaced the 'UnDotum' font with 'WenQuanYiMicroHei (Unicode)' font, which seems to
support both Asian and European character sets. It is committed to the trunk, so give it a whirl. =)

Revision history for this message
Jonathan Thomas (jonoomph) wrote :

Here is an example of English, Croatian, and Japanese on the OpenShot Animated Titles screen.

Revision history for this message
IRIE Shinsuke (irie) wrote :

Umm... I still cannot use Japanese fonts.

I directly gave the tmp file to Blender (r34534), and received errors as follows:

$ blender2.5 -b '/usr/lib/pymodules/python2.6/openshot/blender/blend/glare.blend' -P glare.py
Traceback (most recent call last):
  File "/usr/share/blender/2.56/scripts/modules/bpy/utils.py", line 414, in addon_enable
    mod.register()
  File "/usr/share/blender/2.56/scripts/addons/space_view3d_spacebar_menu.py", line 1502, in register
    km = bpy.context.window_manager.keyconfigs.default.keymaps['3D View']
AttributeError: 'NoneType' object has no attribute 'keymaps'
read blend: /usr/lib/pymodules/python2.6/openshot/blender/blend/glare.blend
Unable to pack file, source path not found: "/usr/usr/share/fonts/truetype/wqy/wqy-microhei.ttc"
Unable to pack file, source path not found: "/usr/usr/share/fonts/truetype/wqy/wqy-microhei.ttc"
Font file doesn't exist: //../../../../../../usr/share/fonts/truetype/wqy/wqy-microhei.ttc
...

Blender seems to attempt to find the font file in an unexistent directory...
I also tested it with the official release of Blender 2.56a, and got the same result:

$ blender-2.56a-beta-linux-glibc27-x86_64/blender -b '/usr/lib/pymodules/python2.6/openshot/blender/blend/glare.blend' -P glare.py
found bundled python: /home/irie/Desktop/blender-2.56a-beta-linux-glibc27-x86_64/2.56/python
read blend: /usr/lib/pymodules/python2.6/openshot/blender/blend/glare.blend
Unable to pack file, source path not found: "/usr/usr/share/fonts/truetype/wqy/wqy-microhei.ttc"
Unable to pack file, source path not found: "/usr/usr/share/fonts/truetype/wqy/wqy-microhei.ttc"
Font file doesn't exist: //../../../../../../usr/share/fonts/truetype/wqy/wqy-microhei.ttc
...

Revision history for this message
Saša Janiška (gour) wrote :

It's great to see you got it...but here we still do not see it. :-(

 When I select some type of the title and WenQuanYiMicroHe font with the e.g. 'TšŠđĐčČćĆžŽ' title text, I only get animation showing 'T'. :-(

I'm really curious what is missing...

Revision history for this message
Jonathan Thomas (jonoomph) wrote :

Irie,
It looks like the font path is completely messed up. It should be /usr/share/fonts/truetype/wqy/... and not /usr/usr/. I have a feeling I am not packing these fonts correctly. Ideally, it would not refer to a path at all, but rather just have the font packed into the .blend file. Any thoughts on how to do that?

Revision history for this message
Jonathan Thomas (jonoomph) wrote :

Okay, I have modified the "Fly Towards Camera" (i.e. fly_by_1.blend) to have all the fonts packed in. The file is much larger, but let's test this .blend file, before I make changes to the rest of them. Here is my test title:
Hello こんにちは世界 šŠ đĐ čČ ćĆ žŽ

Revision history for this message
IRIE Shinsuke (irie) wrote :

Ah, the embedded font correctly works. I can see both Japanese and Croatian characters.

I guess there is a bug in Blender, so we may need to report the problem in the Blender 2.5 bug tracker.

Revision history for this message
Jonathan Thomas (jonoomph) wrote :

I am working on a solution right now that will display the installed fonts on the user's computer, and dynamically load the font with Blender. This was the original design goal, but I gave up on it due to technical issues. I'm back at it though, and hope to have a solution soon. I'll keep you posted.

The big problem I'm having comes down to the Font Selector dialog in GTK, which does not provide the file location of the TTF file. Blender could care less about the friendly font name, and only wants the TTF. So, I'm trying to figure out this puzzle. =)

Revision history for this message
Jonathan Thomas (jonoomph) wrote :

I have just completely rewritten the font handling in all Animated titles. It now scans the user's computer for all TTF (true type font) files, and dynamically adds the Friendly font name to the dropdown. This uses the PIL library to look up the friendly name. Then, the TTL file is loaded dynamically by Blender, and then referenced to the text objects inside Blender. This should allow the user to choose any font on their computer, including unicode fonts for their language's character sets.

The only issue is there can be a ton of fonts lists in this dropdown, and there is not preview of the font. But, other than that, the functionality is much improved. Please test this feature and let me know how it works.

Revision history for this message
Saša Janiška (gour) wrote :

Attempt to run OpenShot gives:

[gour@atmarama bin] python2 ./openshot
Added /home/gour/repos/bzr/openshot/trunk/openshot to system path
--------------------------------
   OpenShot (version 1.3.0~alpha1)
--------------------------------
Process no longer exists: 19652. Creating new pid lock file.
-------------------------------------------------------
Error: OpenShot has not been installed in the Python path.
(Both the site-packages and /usr/share/openshot folders were checked)

Use the following command to install OpenShot:
  $ sudo python setup.py install

Revision history for this message
Jonathan Thomas (jonoomph) wrote :

Gour,
I bet this is failing to import a module, but you are getting the "generic" error message.

Try running the python interpreter, and running these commands:
$ python
>> import subprocess
>> import ImageFont

See if you have any trouble with those commands, since those are the only 2 new imports I added.

Revision history for this message
Saša Janiška (gour) wrote :

[gour@atmarama bin] python2
Python 2.7.1 (r271:86832, Jan 6 2011, 11:45:30)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> import ImageFont
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named ImageFont

Any hint?

Revision history for this message
Jonathan Thomas (jonoomph) wrote :

Yep, try this. Install the python-imaging package (i.e. the PIL library), and it should work. By the way, which Linux distribution are using?

Revision history for this message
IRIE Shinsuke (irie) wrote :

Wow, nice feature! It seems to work fine. Thanks.

However, a lot of fonts are not listed in the dropdown menu, so I modified BlenderGenerator.py:

--- BlenderGenerator.orig.py 2011-01-29 13:51:18.185888999 +0900
+++ BlenderGenerator.py 2011-01-29 13:53:47.655888999 +0900
@@ -78,7 +78,7 @@
   """ Get a list of font files on the computer as FAST as possible. """

   # melt -query
- command = ["locate", "*.ttf"]
+ command = ["locate", "*.tt[fc]"]
   output = ''

   ttf_raw={}
@@ -86,7 +86,7 @@
   try:
    process = subprocess.Popen(args=command,stdout=subprocess.PIPE,
    stdin=subprocess.PIPE,stderr=subprocess.STDOUT)
- output = str(process.stdout.read(20000))
+ output = str(process.stdout.read(200000))

    # wait for process to finish, and then close
    process.stdin.close()

Revision history for this message
IRIE Shinsuke (irie) wrote :

Jonathan, "Neon Curves" seems broken...

I also noticed that "World Map" has no font selector so I cannot use unicode fonts for it.

Revision history for this message
Jonathan Thomas (jonoomph) wrote :

Thanks IRIE! I applied your patch, fixed the Neon curves animation, and verified the "World Map" does have a font dropdown, it's just at the very bottom of the parameters, with all the other text-related parameters.

Revision history for this message
IRIE Shinsuke (irie) wrote :

> the "World Map" does have a font dropdown, it's just at the very bottom of the parameters,

Oops! Sorry, I made a hasty conclusion.

BTW, can you add "Preferred font for animated title" to preferences window? It's annoying that I have to change font every time I use the animated title editor.

Revision history for this message
Saša Janiška (gour) wrote :

@Jonathan: I use Archlinux, installed python Imaging and now there are plenty of fonts to choose from...and it works. ;)

It's a great add-on for OS.

Thank you very much.

moimael (moimael)
Changed in openshot:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.