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

Add font support for Arabic font 'Tajawal' #683

Open
YDA93 opened this issue Apr 15, 2023 · 4 comments
Open

Add font support for Arabic font 'Tajawal' #683

YDA93 opened this issue Apr 15, 2023 · 4 comments
Labels
feature request New feature or request fonts Issues with rendering fonts

Comments

@YDA93
Copy link

YDA93 commented Apr 15, 2023

Describe the Bug

'Tajawal' is a Google font which unfortunately cannot be rendered perfectly.

Minimal Example to Reproduce

<style>
    @import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800;900&display=swap');

    * {
        font-family: 'Tajawal', sans-serif;
    }
</style>

Expected Behavior

Should render any character normally just like Google font 'Amiri'

Actual Behavior

Some characters does not work:

Screenshot 2023-04-15 at 2 21 46 PM

System Information

OS version: macOS 13.3.1 (22E261)
Python version: 3.10.11
XHTML2PDF version: 0.2.9

@YDA93 YDA93 added the bug Something isn't working label Apr 15, 2023
@timobrembeck timobrembeck added the fonts Issues with rendering fonts label Apr 15, 2023
@timobrembeck
Copy link
Collaborator

@YDA93 Thanks for the report. Unfortunately, there is no active community maintaining this project, so if you would like to have this font supported, you would likely have to to provide a contribution yourself.

In the meantime, I'd suggest you try out "MarkaziText", which is mentioned in the docs, or "DejaVu", which has proven to be working in one of my projects...

@YDA93
Copy link
Author

YDA93 commented Apr 15, 2023

@timoludwig I would surely love to contribute and fix this, I only need some guidance on how this can be done?

@timobrembeck
Copy link
Collaborator

Sadly, I'm not quite familiar with all the internals, maybe @luisza can give a hint in the right direction?

@timobrembeck timobrembeck changed the title Does not render Arabic font 'Tajawal' Add font support for Arabic font 'Tajawal' Apr 15, 2023
@timobrembeck timobrembeck added feature request New feature or request and removed bug Something isn't working labels Apr 15, 2023
@luisza
Copy link
Collaborator

luisza commented Apr 19, 2023

Hello,

I think using "body dir="rtl"" could have a positive effect. In case you want to develop it, I'm attaching the lines where the change of letter direction is made. I don't use rtl as such, so clear examples of what should happen using fonts supported by reportlab could help give an idea of how an html code with rtl should turn out.

def reverse_sentence(sentence):

def reverse_sentence(sentence):

frag_words = _getFragWords(frags, reverse=self.dir == 'rtl')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request fonts Issues with rendering fonts
Projects
None yet
Development

No branches or pull requests

3 participants