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 fonts #146

Closed
nawazawanswl opened this issue Jan 2, 2021 · 28 comments
Closed

Add fonts #146

nawazawanswl opened this issue Jan 2, 2021 · 28 comments
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@nawazawanswl
Copy link

is it possible to add fonts to " C:\Program Files (x86)\GUIsliceBuilder\fonts\gfx "
if so how...............?????

@Pconti31
Copy link
Collaborator

Pconti31 commented Jan 2, 2021

@nawazawanswl Read the User Guide.
If you have specific questions after that you can post them here for me to answer.

@Pconti31
Copy link
Collaborator

Pconti31 commented Jan 2, 2021

@nawazawanswl User Guide section 5.7.
Paul--

@nawazawanswl
Copy link
Author

i have gone through the documentation and i am..
unable to find any way add my own fonts to " C:\Program Files (x86)\GUIsliceBuilder\fonts\gfx "
i want to add my own fonts in the directory while design time.
i do not want to add them while in runtime..........
hope you understand.

@nawazawanswl
Copy link
Author

ok,
i read the section and will try it out.
thanks

@Pconti31
Copy link
Collaborator

Pconti31 commented Jan 3, 2021

@nawazawanswl One thing I just noticed that I failed to document is that when you add new font family you need to have at least one font size 10 or less in each style. You don't need all styles but say you only have PLAIN (shows as Regular in Builder) inside this folder you need one font size 10 or less.
After that you can have as many sizes as you want,
Paul--

@nawazawanswl
Copy link
Author

oh, that is good know. this can solve but also led to issues.

@nawazawanswl
Copy link
Author

anyway its very useful info and will save time while adding fonts.

@Pconti31 Pconti31 added the documentation Improvements or additions to documentation label Jan 7, 2021
@nawazawanswl
Copy link
Author

thanks,
i successfully added fonts to to builder directory and they work as expected.
1: generate font with ttf2gfx utility online or or provided by @Pconti31
2: make a new folder and past them there.
3: open guisllice and start using.

@Pconti31
Copy link
Collaborator

@nawazawanswl Thank you for your feedback. I hope to move this issue to discussions once I can get it created.
Paul--

@Pconti31 Pconti31 added the question Further information is requested label Jan 11, 2021
@darkbull
Copy link

@Pconti31 Is there any examples demonstrate how to add category "FONT_SIM"? I read document many times, but with no luck. My target-platform is tft-espi, I want to use smooth font, here is my config:

Xnip2021-01-15_21-07-14

error log is:
Xnip2021-01-15_21-12-01

@Pconti31
Copy link
Collaborator

Pconti31 commented Jan 15, 2021

@darkbull I can do you one better. I have new builder that will support smoothfonts. Instead of using FONT_SIM we will have FONT_VLW. I This version is setup for google's Noto BOLD. If you want anyother font you will still need to edit the builder_fonts.json but it should be simple to see how to modify it for your new font. Also, you will need to add at least one size 18 or less.
The confusing thing here is that adafruit uses a font dpi of 141 and the smooth fonts use 72 to they are half the size of adafruits gfx fonts. So if you want size something the size of adafruits 12 font you need smoothfont size 23 or 24.

Also note that only *.vlw fonts stored in spiffs is supported by GUIslice API. The flash version will crash and burn. I have patch for that but in the meantime stay way from smoothfonts stored in flash.

If you are wiling to beta test this new version let me know and I'll post a download link.
Paul--

@darkbull
Copy link

@Pconti31 Thanks for your prompt reply. By reading the source code, I can add FONT_SIM now. This is my config:
Xnip2021-01-15_22-21-39
Builder can show Chinese now:
Xnip2021-01-15_22-22-52

But there's some problems.

  1. Re-open project, Builder crash
  2. Upload firmware to esp32, endless loop restart

@darkbull
Copy link

The confusing thing here is that adafruit uses a font dpi of 141 and the smooth fonts use 72 to they are half the size of adafruits gfx fonts. So if you want size something the size of adafruits 12 font you need smoothfont size 23 or 24.

happy to try

@Pconti31
Copy link
Collaborator

@darkbull
First, you are trying to use a smoothfont stored in a header (flash). As I told you above this crashes your esp32. GUIslice API doesn't currently support flash based smooth fonts (it sets it up as Adafruit GFX font causing the crash). If you can use vlw font stored in spiffs I can make a builder download available. You will need to edit the json file for your chinese font but can most likely use the NotoBold as a guide.

The Builder problem you have is that it needs to simulate (not use) your desired font. You need to pick one of the Java built-in fonts which limits you to:

  • "logicalName": "Monospaced"
  • "logicalName": "SansSerif"
  • "logicalName": "Serif"

If you use my beta 0.16.b6 Builder you copy your truetype font to a sub folder in GUIsliceBuilder/fonts/vlw. Note its a truetype font (the one you used to create your *.vlw files) since the Builder doesn't read or understand vlw format. Once you edit the json file the Builder will use your TrueType font and not use the Java builtin fonts and the generated code will work with GUIslice API. Of course, you will need to create a sub folder called data in your project and load the vlw fonts into spiffs.

Or you can just wait until I finish testing 0.16.b006 which should take another week or two before release. One thing I think could still be broken is the character code translations in the generated code so that's what is holding up release.
Paul--

@Pconti31
Copy link
Collaborator

@darkbull If you want to help testing I do need to know what version to build,
Windows, Linux or apple osx.
Paul--

@darkbull
Copy link

Paul, OSX . good job

@Pconti31
Copy link
Collaborator

@darkbull Ok, here you go. Let me know of any issues or questions.
Builder OSX Beta 0.16.b6

@darkbull
Copy link

@darkbull Ok, here you go. Let me know of any issues or questions.
Builder OSX Beta 0.16.b6

Got it. OK, I'll reply feedback in some days.

@darkbull
Copy link

@Pconti31 Paul, builder crash when re-open project, active any Widgets which hold Chinese font, eg: "你好"
Xnip2021-01-18_11-01-56
Xnip2021-01-18_11-02-18
My SMOOTH-FONT config:
Xnip2021-01-18_11-03-55
My ttf:
ttf.zip

@Pconti31
Copy link
Collaborator

@darkbull Ugh! Anyway that's why we do testing!
You font is helpful but I still need a couple of items from you to debug this.
Please zip up your project folder and zip up your edited builder_fonts.json file and zip up
GUIsliceBuilder/logs. do not delete any files.
The snapshot you posted looks fine but maybe something else is wrong since it seems the builder thinks you are using a Adafruit classic "builtin" font instead of your vlw font.

I'll debug as far as I can with what you have already zipped. Maybe we will get luckly.
Paul--

@Pconti31
Copy link
Collaborator

@darkbull Sorry, but I used your font and created a single text element in a project I called test-chinese pasting your chinese text string.
Saved the project, did a code generation, loaded your font into spiffs, complied and ran the program and it
showed the chinese text. Hooray! I was worried that would not work.
Then I reopened the saved project without any crash. So I really need your files to determine what is happening.
The crash is almost like you tried to open the project with a non beta GUIsliceBuilder that didn't know about vlw fonts.
attached is my test project and my json file.

builder_fonts.zip
test-chinese.zip
Paul--

@Pconti31
Copy link
Collaborator

@darkbull Some good news, in manner of speaking. I reproduced the crash using the builder posted.
Seems when I run the builder inside Eclipse IDE it works fine but crashes with the release version.
I won't need your files to debug. I'll post a new link once I figure out why this is happening.
Paul--

@nawazawanswl
Copy link
Author

@Pconti31
sorry to bother,
i have had same issue with a previous version.
whenever i changed some object in a guislice project i faced a crash.
but when i did it with save as it never crashed , but i always saved in a different folder and copied it back from there to the original project folder.
later i removed the installation and reinstalled and it was ok.
the problem was overwriting .ino file.
may be this can help a bit.
anyway can you @Pconti31 provide a test version for windows.
i also want to test it ??

@Pconti31
Copy link
Collaborator

@darkbull
@nawazawanswl
Ok, I found the problem. (I hope!)
I have attached beta 0.16.b6-1018 for OSX and Windows.
Note: The Chinese font is already included. You will of course need to add your font to REAL 0.16.b6 release when that is made available. This is because I'm not sure of the copyrights on the Chinese font so I can't really add it to the project.

builder-osx-0.16.b006-SNAPSHOT-0118.zip
builder-win-0.16.b006-SNAPSHOT-0118

Hopefully, this will work a little better.
Any crashes require the actual project folder zipped and GUIsliceBuilder/logs zipped for me to debug.
Paul--

Paul--

@Pconti31
Copy link
Collaborator

For any bug reports on fonts handling; If you are using a custom font (not the Chinese one already provided) please also zip that along with the edited builder_fonts.json file.
Paul--

@darkbull
Copy link

@Pconti31 Thanks for your grate job and realtime update! I use latest builder(builder-osx-0.16.b006-SNAPSHOT-0118.zip), now working perfectly.
I will keep giving feedback. Thanks~~

@Pconti31
Copy link
Collaborator

@nawazawanswl I just noticed you are doing backups by moving your files around.
You shouldn't need to do that. I designed the builder to do backups for you.
When you do a save it renames your *.prj file to *.prj.bak. Before doing that it looks to see if a *.prj.bak already exists if so it renames the *.prj.bak to *.prj.##N where goes from 1 to however max number it needs to be to make the file unique. It then moves the file to a sub folder called gui_backup. You can always get back to an earlier
version by simply renaming the file back to *.prj. You just need to check date and times. The same goes for your *.ino file. Whenever you do a code generation the same algorithm is used but is with *.ino instead of *.prj.
Just though you might want to know.

Paul--

@Pconti31
Copy link
Collaborator

With the Release 0f 0.16.b006 I'm closing this topic.
Any future problem will require a new issue topic to be created.
Paul--

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants