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

There is an error "characters outside the range" when I add my own font #472

Open
tankist-git-2 opened this issue Sep 1, 2022 · 11 comments

Comments

@tankist-git-2
Copy link

tankist-git-2 commented Sep 1, 2022

I try to add my own VLW font into a GUIslice Builder project but is was unsuccessful.

Device hardware:
ESP32 + tft_espi

I follow the instruction on the user_guide to add my own font. There are steps that I've done:

  1. Run Processing -> Create font utility

font_001

  1. Choose font (Aharoni-Bold) and size

font_002

As you can see, I select ALL fonts inside the file including non-Latin ones.
3) I put ahronbd.ttf (original) file into c:\Program Files (x86)\GUIsliceBuilder\fonts\vlw\ folder
4) I put AharoniBold18.vlw (result) file into /data folder of my GUIslice Builder project
5) I edit /templates/builder_fonts.json file to add my font:
"categoryName": "FONT_VLW", "fonts": [ { "familyName": "AharoniBold18.vlw", "displayName": "AharoniBold18", "defineFile": "AharoniBold18", "eFontRefType": "GSLC_FONTREF_FNAME", "pvFontRef": "AHARONI_BOLD_18_VLW", "nFontSz": "18", "logicalName": "ahronbd.ttf", "logicalSize": "18", "logicalStyle": "Bold", "fontRefMode": "GSLC_FONTREF_MODE_1" },

  1. I put TEXT control to the page in "Simulated TFT panel" area of GUIslice Builder
  2. There are settings of this TEXT control:

font_003

  1. I try to see a character map of my new font but it looks ridiculous: it shows 220 chars only

font_004

  1. If I try to set non-latin string into "Text" property of my TEXT control I've gpt an error:

font_005

What is wrong?

@Pconti31
Copy link
Contributor

Pconti31 commented Sep 1, 2022

@tankist-git-2 You need to help me out to help you. Post a zip file containing ahronbd.ttf, and your builder_fonts.json.
By the way, in the future please post Builder issues inside my Repository since this one is Calvin's GUIslice API. It would just make tracking Builder bug fixes easier for me.
Paul--

@Pconti31
Copy link
Contributor

Pconti31 commented Sep 1, 2022

@tankist-git-2 I found the problem. The character was stopping scanning of your font at SHORT.MAX_VALUE which is 32767. Your font ends at 65535. I have fixed this in release 17.b12. You will need to use this builder_font.json file which has you font added when using this new release.
builder_fonts.zip
Paul--

@tankist-git-2
Copy link
Author

tankist-git-2 commented Sep 2, 2022

I installed a new version of GUIslice Builder and repeat steps to install new font:

  1. Replaced builder_fonts.json by yours
  2. Put ahronbd.ttf into GUIsliceBuilder\fonts\vlw\ directory
  3. Put AharoniBold18.vlw into GUIsliceBuilder\fonts\vlw\data\ directory

Unfortunatelly, new font does'n appear in a font selection combobox.
Also I see in new version you added GUIsliceBuilder\fonts\vlw\flash\ directory which contains header files. I have no header file for my new font, could it be a problem?

font_007

@Pconti31
Copy link
Contributor

Pconti31 commented Sep 2, 2022

@tankist-git-2 No, it's not the data folder that's just so people don't have to go through and create the vlw files for the fonts I ship.

Of course, I tested this version with your font and json file before releasing so it works fine, at least for me :)

In looking over your your posted images the fonts being listed are for Adafruit_GFX library not TFT_eSPI so I would guess that's your problem.

As the README file says I did a code refactoring to better describe our options for IDE and graphics libraries. Where before you picked either arduino, m5stack, tft_espi, or linux and I assumed IDE of Arduino IDE you now must pick your IDE then your Graphics lib. so in your case your Project Options tab should look something like this:

project-opt

Hopefully, this will address your issue. If not, I'll build a special version that logs everything so we can see why its not working for you. Just let me know your development platform, windows, etc...

Paul--

@tankist-git-2
Copy link
Author

O, sorry, that was really my fault.
But actually even when I choose the right platform the problem still remains for me...

font_008

I see 260 symbols only and still can't input non-latin letters

@Pconti31
Copy link
Contributor

Pconti31 commented Sep 5, 2022

@tankist-git-2 Well, before in your first post the last character was TM now it goes up to U+FB4F Hebrew Ligature Alef Lamed which exactly matches what I see when running Microsoft's Character Map utility against the Aharoni truetype font installed on my system.

microsoft_charmap

and all of this matches the download site I found to test this font
aharoni.tty

Why do you think there are more characters beyond what the two programs and web site show?
Answer, There are two different aharoni.tty fonts available and you and I loaded the non-russian one.

When I downloaded the russian one the Builder shows this:
russian-ahronbd

Which I suspect is what I think you are looking for.
This is a zip file of the russian version:

ahronbd.zip

Post and close this issue if it all works out for you.

If not, please explain what exact chacaters you think are missing and how you know they are in your font. Also, zip your font and post it so I can examine it further.

Paul--

@tankist-git-2
Copy link
Author

I tried your file but result is the same. I'm a bit confused. Both files (I will refer to them as "old" - what included in release and "new" - what you sent to me in the previous post) shows cyrillic fonts if I use Windows standard utility. But I tried to use https://fontdrop.info/ website and I can't see any other font besides latin although they report about 36 languages support. Just in case I attach both files. Maybe you will find out what the problem is or even offer another font for your program with built-in cyrillic font.

ahronbd_new.zip

ahronbd_old.zip

font_009

@Pconti31
Copy link
Contributor

Pconti31 commented Sep 6, 2022

@tankist-git-2 Sorry, I have no idea what windows utility you re using but windows character map doesn't show any of these characters. As for Cyrillic font support I already ship with Google's notosansbold support built-in for vlw. Noto Sans is an unmodulated (“sans serif”) design for texts in the Latin, Cyrillic and Greek scripts.
Paul--

@Pconti31
Copy link
Contributor

Pconti31 commented Sep 7, 2022

@tankist-git-2 I posted a question about this on the Microsoft forum:
Russian fonts display confusion
Paul--

@Pconti31
Copy link
Contributor

Pconti31 commented Sep 7, 2022

@tankist-git-2 So I got the answer from the Microsoft forum as why you are seeing the Cyrillic characters when you font doesn't contain them.
Answer
See the following in particular Font Fallback.
Font technology

Again you can use the already installed NotoSanBold.vlw font shipped with the builder or maybe take a look at one of these:
The 30+ Best Cyrillic Supported Fonts for Graphic Design & Branding

Paul--

@tankist-git-2
Copy link
Author

Thank you very much for the investigation. Well, I will use existing font and maybe find another one with cyrillic and try to convert it again.

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

No branches or pull requests

2 participants