Adafruit_mfGFX custom font need help

@peekay123, I am using hardware SPI. For the touch, I used Utouch library with four pins. I tied the LED to 3V, I can free up RST if I need a control pin, right now its tied to A0.

Strange, I just used dot factory to convert the " !"#$%&’()*+,-./0123456789", modified the start and end char as 0x20, 0x39, tft.print(“1. 31 1”); show up as 1.311 but no space.

Great, thanks for all the help! :smile:

@sheng, the “A” is not in order so it won’t print correctly. The way you have things, the “A” is where the “:” should be. So either you keep what you have and print “:” for an A to appear or include all the characters between the “9” and the “A”, meaning “:;<=>?@”.

@peekay123, I think I am missing something. I just need “space,0123456789”. In dot factory, just to test I include " !"#$%&’()*+,-./0123456789:;<=>?@A" font. Space before !. I did a print out on all the char every char print except Space. I am using 0x20, 0x41 as the start and end char. What am I doing wrong?

@peekay123, I think i found a solution to dim the lcd screen. Is there any way to use one of the pin to output various voltage from the P1?

@sheng, the space is only two pixels wide I believe so it won’t show well. I still think your best bet is the rectangle fill.

As for the P1 driving the LED for the backlight, it cannot provide enough current. You would need to drive a transistor which in turn drives the backlight LEDs.

@peekay123, that make sense, I thought I was doing something wrong. No wonder the space does not show up. Rectangle fill it is then.

I was afraid that you would said that regarding to the LED. Is that mean I need to modify Adafruit_ILI9341.cpp since “Adafruit_ILI9341::Adafruit_ILI9341(uint8_t cs, uint8_t dc, uint8_t rst)” take three pins? I am trying to use the RST pin to drive the transistor. Is there an easy way around this or just comment out the rst code would do? Thanks

Can you not assign a wider bit pattern for a space then?

@ScruffR, you are correct! The width can be set to be full char width. :smiley:

What command or mod do you need to do to set it to full char width?

@peekay123, is there any updated doc or example on how to config PWM duty cycle as you mention above? By controlling a transistor, I will be able only to turn on or off the LED. I am thinking to test out with a PWM duty cycle to see if I can control the voltage of an output pin that might do the trick.

@sheng, controlling the on/off duty cycle of a LED through a transistor WILL control its brightness. LEDs are current devices and using PWM changes the average current to the LED, thus controlling its brightness. Driving the LEDs of the display can’t be done directly from a GPIO pin since it can only supply a max of 20ma. Using a transistor will allow for more current (50-100ma) to drive the backlight LEDs.

The mod you need to make for the space char width is the first entry of the descriptor table for that character (space).

15 posts were split to a new topic: What display type to use (LCD, TFT, OLED, eInk, …)

@peekay123 and @ScruffR, thank you for the information. @peekay123, sorry about going off the topic. If I have more question I will create a new topic. Thanks again.

2 Likes

@peekay123, by any chance, do you have a seven segment font or instruction on how to generate it? I been looking at the dot factory but I was not able to find it there. I am trying to generate size for 18, 26, 72. I am trying to test out which font looks better on tft screen. Any advice will be grateful.

@RWB may have something to contribute (?) The trick is to find a True Type font that you can convert.

@peekay123, I was reading adafruit gfx font guild on adding new fonts. It suggest a tool call fontconvert on the Adding New Fonts section that could convert true type vector fonts to a .h font file that work with Adafruit_GFX. But I was thinking, what modification do I need to make it work on Adafruit_mfGFX?

@sheng, Adafruit’s tool only runs on Linux, is poorly documented and is not compatible with mfGFX font data structures. If it worked on Windows, I would have ported the new GFX library a long time ago!

1 Like

I found all my fonts on these websites and used Dot Factory to convert to .H data files.

https://www.myfonts.com

http://www.dafont.com

You can try to download the Dot factory from this link http://www.eran.io/the-dot-factory-an-lcd-font-and-image-generator/

It downloaded and installed just fine for me.

If your using color TFT LCD Screens considering using the 4D systems displays because their PC programming software makes it a breeze to add custom fonts, images, and touch screen interfaces.

1 Like

@RWB, How did you import the fonts into Dot Factory? I am using Dot Factory v.0.1.4 but I don’t see an option to import new font. On the Input section, I only see Text and Image but the Text option does not allow me to pick the location of new font.

@peekay123, Thank you for the info, you save me from bang my head trying to figure the Adafruit’s tool and porting.

1 Like

@RWB, LOL I solve my question. I didnt know I can install ttf. After installing the new font, I can see it in Dot Factory. :slight_smile:

@peekay123 and @RWB Thanks for the help

2 Likes