Start a new topic
Solved

Problem with fonts


t0 = "instruments"
How can I write "instruments" with equal distance between letters?
It is a problem with fonts.
Can someone help me?

Thanks in advance,
Teo


ZI Font support is limited to specific font sizes in a fix width format.

The main restrictions are height is a multiple of 8 and width is limited to half of height.

This leaves: 4x8,8x16,12x24,16x32,20x40 ...upto and including 80x160.


Converting fixed width Fonts such as Terminal, Lucida Console, Consolas works

Expecting good results from variable width fonts does not


ASCII includes characters 32 to 126 for a quantity of 95 characters

ISO-8859-XX support includes characters 32 to 255 for 224 characters.


The Nextion Editor work fine in systems, and very poorly in other setting.

As such there have been several .zi font file editors contributed by the users.

With the use of one of these Editors acceptable fonts can be had.


This topic will be closed as solved while remembered as an ongoing issue.

Thanks! I have seen it. Looks nice. Great work

@Andreas L.


*.chr Table Editing and Preview now available in the latest version -0.09  in this thread.

The pre release has been uploaded into (this thread)

The pre release version -0.11 (yeah, its negative) of the ZI Font Editor will be uploaded (here) tomorrow.




1 person likes this

Hello Patrick,
It would be great if you can upload a version.
All the best !

Hello Patrick,
I'm interested in a version of choosing a Character Table for each font. I can live with some converting issues. The font created with the included nextion font generator looks badly.
A user defined grid would be fine for beta testing. So, it would be very nice, if you can upload a version.

Best greets!

 


1 person likes this

Hey Andreas L


I am fighting with three main issues in the Font Editor. Clean looking conversions (trying to reverse font smoothing). Dynamic cropping as Windows adjusts font start (0,0) differently for each font.  Font compression, getting wide characters like @ and W to still look good after they are compressed to fit in a fixed space - too much space allotted, and l, I and j look like starts of new words.  I didn't want to put a yet to be completed version up.


However, I have been considering the possibility of a utility that merely allows you to bit edit a user defined grid (16x24, 8x12, 8x16 etc) for the 224 characters in an ISO-8859 set.


I wont get both of them completed in short order, and if you don't mind playing with a alpha beta version,  tell me which one you prefer, and that one will be posted here for you on Monday.




1 person likes this
Hello Patrick,
is there a pre-release of your Zi font Editor available now? Can find anything.

Best greets!

 

Here is the pseudo


Prep work for vectors

For each in your character set, Create your list of vectors (start point, end point, weight).  Capture for every line needed to generate the character.  Do this for each Character.  Create an index char starts at.


When a character phrase needs to be generated to text.

Determine the factor needed to generate that size.

For each character in the phrase,

  for each line in character

    multiply your start, end and weights by this factor.

    Set line width by new width determined by weight x your factor

        for w of each integer in new line width

            line startx+w,starty+w,endx+w,endy+w,color

The benefit of vector is that you only need one storage for your list and any size can be created, but the downside is the calculations that need to be done each and every time a new character is created will slow your display down.  You may also have to do extra calculations with another algorithm if you want font smoothing.


Or you could render each character as a picture and include in your picture resources

and as they are needed use the nextion instruction where your pic to your letter is described by chr#

    pic leftx,topy,chr#


Or you could render a bitmap raster of your phrase and send each pixel out in a line command

  line x1,y1,x1,y1,color


Or you could capture every phrase that will be used in your display as a picture, if the picture is in a static location (not adjustable at runtime)

and just set p2.pic=Phrase# as needed


Or you can put it in a background picture using photoshop so there is no rendering needed


If you have electronics skills and a soldering iron, you can upgrade your flash chip, or include extra flash on your mcu side


Or you could use an already produced raster font and programmatically truncate the offending space from your characters and put that in a new picture and push that to your display


There are probably a hundred ways to have it accomplished.


Did you even bother to try the program (in the other thread) that does the phrase thing?


Anyrate, that is how you "modify" the standard expected behaviour of a monospaced fixed with raster font rendering so that it will now behave as a vectored variable width font rendering.  Pick one and go ahead. 


Best wishes, I outta here.

Hi Teo,


Yeah, I get that.  WIWIAN looks closer W I W I AN.  Okay, so, that is actually the normal default and behaviour expected rendering for a monospaced raster font. I am not a fool, I am good at what I do.


Have you ever been to a dentist Teo?  You still leave me without proper details.  Stop making this so difficult like pulling teeth, and help by providing some details.  So I am going to try psychic mind reading here, just let me get my Crystal Ball.  I have a better one on order, but I am still waiting for FedEx to arrive. 


So let me guess, don't tell me.  You are looking to circumvent the programmed default behaviour of monospaced fixed width raster rendering to have it display in a behaviour that would be similar to variable with vector rendering?  And this is where the crystal ball starts getting a bit fuzzy.


WHAT have you tried, what tools do you have at hand to help you.  Are you expecting this to be completely rendered in the Nextion Display, or do you have an Arduino, RaspberryPi, Intel Edison, or other bare bones MCU that will be connected to it.  What graphic libraries do you have at your disposal?  What programming language will you be using?  What compiler are you using for your programmed source code? Do you have a soldering iron?  Do you have electronic skills?  Are you the programmer? or are you going to hire a programmer?  Is this a hobby, or is this your Job?  Are you serious about getting this done and willing to put the effort in or posting on boards is just a hobby? 


Nextion Documentation in the FAQ section states that ITEAD provides level 2 support.  They make sure that the hardware is actually functioning.  They will diagnose/exchange manufacturing defects.  They even have a service where they can make custom PCB for what your project wants to do.  What you want to accomplish with your hardware is not part of what they do.  They have provided somethings, including basic tutorials, demos and an Editor, but ultimately what you want to make with your hardware is up to you. 


I can already accomplish it, but I have an Intel Edison and a Kylix 3 Enterprise Edition compiler, so I can generate my desired words into a bitmap in real time and push it out to the display when I need.  But to be honest Teo, My crystal ball act is just an illusion, it doesn't really work.  So I have no bloody idea what you have on your end to try to make it work.


Now do you have it?


Patrick


PS.  For next time, if you don't want to provide any better details, just say you don't want the help, and I can be off doing so many other things than wasting my time trying to help you with your problem.

Hi Patrick

The problem is that using fixed-width characters, not variable width.
The letter "W" is not the same width as the letter "I"
Is written correctly "WIWIAN" but the TFT write "W I W I AN"
Now you got it?
All the best,
Teo

@Teo


The Demo HMI can be accessed in the following steps.

Open your Nextion Editor

Under the Help Menu, Select and Click the Help menu item

This will launch your web browser and open Nextion HMI Solution wepage

In the Content Section click on #6  6 Useful links

This will take you to the Section of Demo HMIs,

Select the Appropriate Demo for the Nextion Display Model you have

Clicking on the Link will download the zipped demo

Once downloaded, extract the HMI file

Open the extracted HMI file in the Nextion Editor



@Teo


First of all

t0 = "instruments" 


Will not output anything.  If t0 is a Text Component, the instruction format if in an event section of code is t0.txt="instruments".  In the Editor place your Text Component at the location on the Page where you want it being displayed. In the txt attribute section type instruments.  Fonts are mono spaced by default, and by default there is equal distance between the character rasters of 0.  To increase this amount you refer to the Nextion Instruction Set for the instructions spax and spay.  Where in your PostInitialize Event of your Page put the instructions spax=2 and spay=2, or whatever value you find appealing.  There is a WHOLE LOT of information that I have provided in this thread alone.


To make an HMI for you??  You did not even mention which model this supposed HMI was to be made for, screens do not adjust well from one size to another.  Different fonts look different, you have not stated what font you are having issue with: Your title was "Problem with Fonts".  What font were you using.


How about you SHOW me, what you are speaking of.  POST screen shots of the results you have been having, POST your HMI that is giving you those results.  DESCRIBE what you have attempted so far to date, and then DESCRIBE what in your screenshot is bothering you and perhaps if you have a visual example of what your desired goaled result should look like POST that as well.  On average I am half a world away from you I am NOT a psychic or mind reader.  I can not see what your eyes are seeing if you do not SHOW and DESCRIBE.


You omit all VITAL clues someone would need to arrive at any solution. Did you download the demo HMI?  Have you read the information in this thread?  Other threads?  How did the other program work out for you?  So you have to understand Teo, your post without the details is as if all the other solutions have not successfully worked for you.



The letters in blue are output from Text Components, they are spaced evenly apart.


Hi Patrick,
Thanks for the reply.
The problem is:
t0 = "instruments"
How can I write "instruments" with equal distance Between letters?
Give me an HMI example .
Thanks in advance,
Teo