User Tools

Site Tools


arduino:custom_fonts_for_ucglib

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
arduino:custom_fonts_for_ucglib [2018/11/15 16:59] – created mithatarduino:custom_fonts_for_ucglib [2018/11/15 20:28] – [Add new code to Ucglib] mithat
Line 5: Line 5:
 ===== Requirements ===== ===== Requirements =====
 Ucglib uses [[https://en.wikipedia.org/wiki/Glyph_Bitmap_Distribution_Format | BDF]] fonts as a source. You will need: Ucglib uses [[https://en.wikipedia.org/wiki/Glyph_Bitmap_Distribution_Format | BDF]] fonts as a source. You will need:
-  * OTF (or TTF?) files of the fonts you want to convert. //Check licenses!//+  * OTF and TTF files of the fonts you want to convert. //Check licenses!//
   * A way to convert these to BDF format: ''[[ http://sofia.nmsu.edu/~mleisher/Software/otf2bdf/ | otf2bdf ]]'', ''[[http://sofia.nmsu.edu/~mleisher/Software/gbdfed/ | gbdfed]]'', or possibly ''[[https://fontforge.github.io/en-US/ | fontforge]]''   * A way to convert these to BDF format: ''[[ http://sofia.nmsu.edu/~mleisher/Software/otf2bdf/ | otf2bdf ]]'', ''[[http://sofia.nmsu.edu/~mleisher/Software/gbdfed/ | gbdfed]]'', or possibly ''[[https://fontforge.github.io/en-US/ | fontforge]]''
   * A way to convert BDF files to the C structures used in Ucglib: ''bdfconv'', which you will build below.   * A way to convert BDF files to the C structures used in Ucglib: ''bdfconv'', which you will build below.
Line 11: Line 11:
 ==== Building bdfconv ==== ==== Building bdfconv ====
  
-Download the [[https://github.com/olikraus/ucglib|Ucglib repository]], head into ''%%tools/font/bdfconv%%'' and+Download the [[https://github.com/olikraus/ucglib|Ucglib repository]], move into ''%%tools/font/bdfconv%%'' and
  
 <code shell> <code shell>
Line 17: Line 17:
 </code> </code>
  
-This will build a ''%%bdfconv%%'' executable.+This will build a ''%%bdfconv%%'' executable. Put that executable or a symbolic link to it into your ''bin'' directory
  
 ===== The process ===== ===== The process =====
  
-==== Convert OTF (and TTF?) to BDF ====+==== Convert OTF or TTF to BDF ====
  
 Using ''otf2bdf'': Using ''otf2bdf'':
Line 29: Line 29:
 </code> </code>
  
-''%%gbdfed%%'' also can import and convert fonts, but the monospace/proportional setting seems to be wonky. ''%%fontforge%%'' appears to be another option.+''%%gbdfed%%'' also can import and convert fonts, but the monospace/proportional setting seems to be wonky. ''%%fontforge%%'' may be another option.
  
-View the result using ''%%gbdfed%%''.+View the result using ''%%gbdfed%%'' or ''%%fontforge%%''.
  
 ==== Convert the BDF file to C using bdfconv ==== ==== Convert the BDF file to C using bdfconv ====
  
 <code> <code>
-/path/to/bdfconv -v -b 2 -f 0 -n fontname -d image.tga -o filename.c filename.bdf +$ bdfconv -v -b 2 -f 0 -n fontname -d image.tga -o filename.c filename.bdf 
 </code> </code>
  
Line 44: Line 44:
 ==== Add new code to Ucglib ==== ==== Add new code to Ucglib ====
  
-Paste the content of the new file to ''%%src/clib/ucg_pixel_font_data.c%%''+Paste the content of the new file to ''%%src/clib/ucg_pixel_font_data.c%%'' -- making sure to remove the redundant
  
-Add an ''%%extern%%'' entry for the above to ''%%src/clib/ucg.h%%''+<code c> 
 +#include "ucg.h" 
 +</code> 
 + 
 +Add an ''%%extern%%'' entry for the above variable to ''%%src/clib/ucg.h%%''
  
  
  
arduino/custom_fonts_for_ucglib.txt · Last modified: 2021/02/04 02:08 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki