Convert a .ttf file

Hey guys,

I would like to convert .ttf file to app.h to program my vidor. I tried to convert it to .bin and after that to .h. I used online web convertors, but I was't successful. Do you have some recommendations? Or do you know another way to convert it?



Did you use example repository as baseline?

If yes then there is build script that will create app.h.
You need also install go compiler for flash swap converter.

Actually converting a .ttf file to app.h file doesn't take more than renaming it. However, in the case of the Arduino this is not enough, as Quartus generates the bitstream bit-reversed, at least what we need it for. Because of that, you have to run it through a tool which reverses all bytes and then you can rename the output file to app.h.

You can find a tutorial on how to convert it here, in case you want to read through all of it:

Here's a direct download link for the converter tool:

Unzip the archive, store the .class and .java files somewhere it won't be removed (like the user folder in "C:\Users\YourName"). Now, when opening a command prompt in this directory you can type the command:

Java ReverseByte "YourTTF" "YourAPPH"

For making this easier, i wrote a simple batch script which you can use:

@echo off

set sourcePath=F:\Documents\CNC\RealTimeController_V2\projects\RealTimeController\output_files\MKRVIDOR4000.ttf
set targetPath=F:\Documents\Sketchbook\libraries\FPGA_Controller\FPGA_Bitstream.h

cd /D F:\Documents\CNC\ReverseByte

if exist tempStream.ttf (
del tempStream.ttf

echo e[92mConverting FPGA Bitstream...e[0m
java ReverseByte %sourcePath% tempStream.ttf

if not exist tempStream.ttf (
echo e[91mError while converting!e[0m

if exist %targetPath% (
del %targetPath%

copy tempStream.ttf %targetPath%

if not exist %targetPath% (
echo e[91mError: Failed to replace bitstream!e[0m

echo e[92mSuccessfully replaced bitstream!e[0m

timeout 1

The special characters are for coloring the console to make text green, and red if the script fails. The detection if ReverseByte fails is also the reason the script is so complex.

This script converts the file and replaces the target file, while it will also tell you if this process fails.

To use this script, just copy the content into a file named VidorUpload.bat or something similar. Save it somewhere it won't get removed and edit the three paths like the source file, target file and the cd command, which is the path to where you saved your ReverseByte.class files previously.

When those three paths are set up and java is installed (it is when you have the Arduino IDE installed) it is time to run the script.
And finally, you can create a Windows shortcut to this batch file, which you can drag anywhere and even change the icon to a microchip symbol or anything you like. When you edit the Windows shortcut from something like "F:/Desktop/Vidorupload.bat" to "explorer.exe F:/Desktop/Vidorupload.bat" you can even attach it to your taskbar.

Great, now you just need to click on your taskbar to copy the bitstream from a Quartus project directly to your Arduino sketch!

And lastly, I don't know if you already have a way to actually upload the sketch, but in case you don't, you can take a look at my Github repo:

This repo contains modules for uploading the bitstream and also for exchanging data with the FPGA at runtime. In case you're interested just read the ReadMe of the repository.

Hope this was helpful, have a nice day!