Advice sought on trying to make font for u8G2 use

Hi all

I have for the last couple of days tried to make a custom 54 pixel height font for use with u8g2. The font is to emulate the 14 Segment LCD displays.

I have tried to follow the instructions given by OliKraus but am struggling to get to the end. I have managed to use Fony to produce the .bdf file, and even managed to use bdfconv to produce a .c file.

However where OliKraus' instructions end are the details on how to incorporate the bdf / c files into the sketch.

I have this sketch that I would like to use as an example into which to insert the font, replacing the logisoso38_tr font with the DSEG14Classic-Bold_54.bdf and/or DEG14C.c versions I have made

#include <SPI.h>

#include <Arduino.h>
#include <U8g2lib.h>
#include <Wire.h>


U8G2_SH1122_256X64_2_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 19, /* data=*/ 18, /* cs=*/ 16, /* dc=*/ 17, /* reset=*/ 15);        // Enable U8G2_16BIT in u8g2.h

void setup(void) {
  u8g2.begin();
  u8g2.firstPage();
  do {
    u8g2.clearBuffer();
    u8g2.setFont(u8g2_font_logisoso38_tr);
    u8g2.drawStr(80, 60, "Hello");  // 0 left, 0 top bottom appx 100
  } while(u8g2.nextPage());
  delay(1000);
}

void loop() {
}

I would appreciate any guidance on this, as when I copy the contents of the .c file into the sketch I get the following errors

F:\Users\LES\Documents\Arduino\208OLED_working_sketch_with_SEG14_font\DEG14C.c:7:7: error: unknown type name 'uint8_t'
 const uint8_t DEG14C[303] U8G2_FONT_SECTION("DEG14C") =
       ^~~~~~~
F:\Users\LES\Documents\Arduino\208OLED_working_sketch_with_SEG14_font\DEG14C.c:7:27: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'U8G2_FONT_SECTION'
 const uint8_t DEG14C[303] U8G2_FONT_SECTION("DEG14C") =
                           ^~~~~~~~~~~~~~~~~

exit status 1

Compilation error: unknown type name 'uint8_t'

Clearly I'm missing at least one callout

Any help appreciated

Les

Hi all, I've resolved this, the bdfconv program was not including "u8g2_font_" in the header of the c. file. I have added this and now the font is visible and the sketch compiles fine

Cheers

Les

1 Like

Deleted due to me finding a capitalisation error

Les

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.