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

space not working for some fonts #225

Closed
sadrasabouri opened this issue Apr 2, 2023 · 4 comments · Fixed by #261
Closed

space not working for some fonts #225

sadrasabouri opened this issue Apr 2, 2023 · 4 comments · Fixed by #261
Assignees
Labels
Milestone

Comments

@sadrasabouri
Copy link
Collaborator

Description

It seems that newly added feature, sapce, is not working with some specific fonts.

Steps/Code to Reproduce

>>> Art = text2art("test", "block", space=2)
>>> print(Art)

Expected Behavior


 .----------------.    .----------------.    .----------------.    .----------------. 
| .--------------. |  | .--------------. |  | .--------------. |  | .--------------. |
| |  _________   | |  | |  _________   | |  | |    _______   | |  | |  _________   | |
| | |  _   _  |  | |  | | |_   ___  |  | |  | |   /  ___  |  | |  | | |  _   _  |  | |
| | |_/ | | \_|  | |  | |   | |_  \_|  | |  | |  |  (__ \_|  | |  | | |_/ | | \_|  | |
| |     | |      | |  | |   |  _|  _   | |  | |   '.___`-.   | |  | |     | |      | |
| |    _| |_     | |  | |  _| |___/ |  | |  | |  |`\____) |  | |  | |    _| |_     | |
| |   |_____|    | |  | | |_________|  | |  | |  |_______.'  | |  | |   |_____|    | |
| |              | |  | |              | |  | |              | |  | |              | |
| '--------------' |  | '--------------' |  | '--------------' |  | '--------------' |
 '----------------'    '----------------'    '----------------'    '----------------' 
 

Actual Behavior


 .----------------.  .----------------.  .----------------.  .----------------. 
| .--------------. || .--------------. || .--------------. || .--------------. |
| |  _________   | || |  _________   | || |    _______   | || |  _________   | |
| | |  _   _  |  | || | |_   ___  |  | || |   /  ___  |  | || | |  _   _  |  | |
| | |_/ | | \_|  | || |   | |_  \_|  | || |  |  (__ \_|  | || | |_/ | | \_|  | |
| |     | |      | || |   |  _|  _   | || |   '.___`-.   | || |     | |      | |
| |    _| |_     | || |  _| |___/ |  | || |  |`\____) |  | || |    _| |_     | |
| |   |_____|    | || | |_________|  | || |  |_______.'  | || |   |_____|    | |
| |              | || |              | || |              | || |              | |
| '--------------' || '--------------' || '--------------' || '--------------' |
 '----------------'  '----------------'  '----------------'  '----------------' 
 

@sepandhaghighi sepandhaghighi added this to the art 6.1 milestone Jun 14, 2023
@sepandhaghighi
Copy link
Owner

@sadrasabouri You can start to work on this issue.
The first step is to find the fonts with this problem and list them.

@sadrasabouri
Copy link
Collaborator Author

First I write the below scripts to find out fonts which have problems with space parameter:

>>> from art import *
>>> for font_name in FONT_NAMES:
...     if text2art("test", font_name, space=2) == text2art("test", font_name):
...             print(font_name)
... 
block
danc4
nvscript

Then I checked them in text_dic*.py files to find out the problem. It turned out that (' ' - spce) is mapped to ('' - empty string), as it can be seen in from the below script's results:

>>> from art.art_param import FONT_MAP
>>> for font_name, font in FONT_MAP.items():
...     if font[0][' '] == '':
...             print(font_name)
... 
block
danc4
nvscript

So for solving this issue we can fill up the space character's mapping for these fonts {block, danc4, nvscript}.

@sepandhaghighi
Copy link
Owner

So for solving this issue we can fill up the space character's mapping for these fonts {block, danc4, nvscript}.

@sadrasabouri Nice approach 🔥

sepandhaghighi pushed a commit that referenced this issue Jul 2, 2023
* fix : `danc4` font space problem. (#225)

* fix : `nvscript` font space problem. (#225)

* [:skull:] fix : `block` font space problem. (#225)

* log : changes logged.

* update : `CHANGELOG.md` updated.
@aamir0002
Copy link

سلام. چطور میتونم به شما پی ام بدم سوالی درباره یکی از کد هاتون داشتم

@sepandhaghighi sepandhaghighi linked a pull request Sep 16, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants