Skip to content

Commit c8b32b4

Browse files
authored
Use fontconvert.c to create new fonts in windows
A brief guide of how to set your pc with Windows OS so you can create your oen fonts with fontconvert.c
1 parent 2fced4b commit c8b32b4

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed

fontconvert/fontconvert_win.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
### A short guide to use fontconvert.c to create your own fonts using MinGW.
2+
3+
#### STEP 1: INSTALL MinGW
4+
5+
Install MinGW (Minimalist GNU for Windows) from [MinGW.org](http://www.mingw.org/).
6+
Please read carefully the instructions found on [Getting started page](http://www.mingw.org/wiki/Getting_Started).
7+
I suggest installing with the "Graphical User Interface Installer".
8+
To complete your initial installation you should further install some "packages".
9+
For our purpose you should only install the "Basic Setup" packages.
10+
To do that:
11+
1. Open the MinGW Installation Manager
12+
2. From the left panel click "Basic Setup".
13+
3. On the right panel choose "mingw32-base", "mingw-gcc-g++", "mingw-gcc-objc" and "msys-base"
14+
and click "Mark for installation"
15+
4. From the Menu click "Installation" and then "Apply changes". In the pop-up window select "Apply".
16+
17+
18+
#### STEP 2: INSTALL Freetype Library
19+
20+
To read about the freetype project visit [freetype.org](https://www.freetype.org/).
21+
To Download the latest version of freetype go to [download page](http://download.savannah.gnu.org/releases/freetype/)
22+
and choose "freetype-2.7.tar.gz" file (or a newer version if available).
23+
To avoid long cd commands later in the command prompt, I suggest you unzip the file in the C:\ directory.
24+
(I also renamed the folder to "ft27")
25+
Before you build the library it's good to read these articles:
26+
* [Using MSYS with MinGW](http://www.mingw.org/wiki/MSYS)
27+
* [Installation and Use of Supplementary Libraries with MinGW](http://www.mingw.org/wiki/LibraryPathHOWTO)
28+
* [Include Path](http://www.mingw.org/wiki/IncludePathHOWTO)
29+
30+
Inside the unzipped folder there is another folder named "docs". Open it and read the INSTALL.UNIX (using notepad).
31+
Pay attention to paragraph 3 (Build and Install the Library). So, let's begin the installation.
32+
To give the appropriate commands we will use the MSYS command prompt (not cmd.exe of windows) which is UNIX like.
33+
Follow the path C:\MinGW\msys\1.0 and double click "msys.bat". The command prompt environment appears.
34+
Enter "ft27" directory using the cd commands:
35+
```
36+
cd /c
37+
cd ft27
38+
```
39+
40+
and then type one by one the commands:
41+
```
42+
./configure --prefix=/mingw
43+
make
44+
make install
45+
```
46+
Once you're finished, go inside "C:\MinGW\include" and there should be a new folder named "freetype2".
47+
That propably means that you have installed the library correctly !!
48+
49+
#### STEP 3: Build fontconvert.c
50+
51+
Before proceeding I suggest you make a copy of Adafruit_GFX_library folder in C:\ directory.
52+
Then, inside "fontconvert" folder open the "makefile" with an editor ( I used notepad++).
53+
Change the commands so in the end the program looks like :
54+
```
55+
all: fontconvert
56+
57+
CC = gcc
58+
CFLAGS = -Wall -I c:/mingw/include/freetype2
59+
LIBS = -lfreetype
60+
61+
fontconvert: fontconvert.c
62+
$(CC) $(CFLAGS) $< $(LIBS) -o $@
63+
64+
clean:
65+
rm -f fontconvert
66+
```
67+
Go back in the command prompt and with a cd command enter the fontconvert directory.
68+
```
69+
cd /c/adafruit_gfx_library\fontconvert
70+
```
71+
Give the command:
72+
```
73+
make
74+
```
75+
This command will, eventually, create a "fontconvert.exe" file inside fontconvert directory.
76+
77+
#### STEP 4: Create your own font header files
78+
79+
Now that you have an executable file, you can use it to create your own fonts to work with Adafruit GFX lib.
80+
So, if we suppose that you already have a .ttf file with your favorite fonts, jump to the command prompt and type:
81+
```
82+
./fontconvert yourfonts.ttf 9 > yourfonts9pt7b.h
83+
```
84+
You can read more details at: [learn.adafruit](https://learn.adafruit.com/adafruit-gfx-graphics-library/using-fonts)
85+
Taraaaaaammm !! you've just created your new font header file. Put it inside the "Fonts" folder, grab a cup of coffee
86+
and start playing with your Arduino (or whatever else ....)+ display module project.

0 commit comments

Comments
 (0)