Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indic Script labels not rendered correctly #8765

Closed
aquiire opened this issue Jun 15, 2017 · 6 comments
Closed

Indic Script labels not rendered correctly #8765

aquiire opened this issue Jun 15, 2017 · 6 comments

Comments

@aquiire
Copy link

aquiire commented Jun 15, 2017

Bug report

Bug summary

Title sums it up all I guess.
Related:

Here I used sinhala as Indic Script instance.
I think the font family has to do something with this issue since output to different font families are different. I'm not an expert in these stuff. Help appreciated to to get this work even with a different font family.
An example is given below for which I've tried with 3 different font families.
Code for reproduction

from matplotlib import rc
families = ['WARNA','LKLUG','Arial']
for familyname in families:
    rc('font', family=familyname)
    from matplotlib import pyplot as plt
    import numpy as np
    r = np.linspace(0.1,5,100)
    A = 3*2/(r*2)+np.pi*r**2
    fig = plt.figure()
    axes = fig.add_axes([.1,.1,.8,.8]) 
    axes.plot(r,A)
    axes.set_ylabel(u'වර්ගඵලය')
    axes.set_xlabel(u'අරය')
    axes.set_title(familyname)

Actual outcome

Result 1
Result 2
Result 3

Expected outcome

Result 1 looks fine but it has 2 problems:

  • Accents not been placed in the correct location. ("්" in "වර්ගඵලය" is placed after "ර" not before)
  • Letter "A" is not renderd in the title "WARNA"

Issues in result 2:

  • Same previous accent issue
  • Axis values or title not shown at all

Issues in result 3:

  • No Sinhala script shown.

Versions

Software Version
Python 2.7.13 64bit [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]
IPython 5.1.0
OS Linux 4.4.0 78 generic x86_64 with debian jessie sid
matplotlib 1.5.1

(Matplotlib from anaconda bundle)

Wed Jun 14 22:54:11 2017 +0530

@dstansby dstansby added this to the 2.1 (next point release) milestone Jun 15, 2017
@anntzer anntzer added the MEP: MEP14 text handling label Jun 23, 2017
@anntzer
Copy link
Contributor

anntzer commented Jun 23, 2017

The misplaced accent is due to lack of support for combining characters at the freetype level (e.g. https://stackoverflow.com/questions/9985340/how-to-render-combined-unicode-characters-in-freetype). Using a real text layout engine (MEP14) is probably not going to happen any time soon :-/

Not sure what's happening with the missing A (well I guess the glyph is missing? unlikely though) and the missing title of case 2.

Case 3 is just that Arial does not provide Indic characters (in all likelihood) so you're out of luck.

@tacaswell tacaswell modified the milestones: 2.2 (next next feature release), 2.1 (next point release) Jun 25, 2017
@anntzer
Copy link
Contributor

anntzer commented Nov 4, 2017

/self-promotion/ mplcairo now supports complex text layout using libraqm, this was suprisingly easy to add...
figure_1

@baabsa
Copy link

baabsa commented Feb 24, 2018

can you please illustrate steps for adding and use (libraqm),

I am new in python and I didn't find an easy explanation how it is used.

Thanks in advance.

@anntzer
Copy link
Contributor

anntzer commented Feb 24, 2018

It is a fairly technical project and will probably not be implemented any time soon.
But most solutions that fixes indic script will likewise fix arabic script (*well technically you can have a shaper without RTL support but let's not get there).

@baabsa
Copy link

baabsa commented Feb 24, 2018

this issue doesn't appear in printing an Arabic word from DataFrame, it is only appear when I have Arabic words in plot as x axes, y axes, or title!

@anntzer
Copy link
Contributor

anntzer commented Jul 5, 2019

Actually this issue is basically already tracked at #5941, so I'll close this one as a duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants