PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1009B

  1. #! /usr/bin/perl
  2. $name = $ARGV[0];
  3. $name or die "Usage ./ttf_to_ili9341.pl <name>\n";
  4. -r "$name.ttf" or die "Can't read file $name.ttf\n";
  5. system "rm font_$name.c\n";
  6. open C, ">font_$name.c";
  7. print C "#include \"font_$name.h\"\n\n";
  8. close C;
  9. foreach $size (8, 9, 10, 11, 12, 13, 14, 16, 18, 20, 24, 28, 32, 40, 48, 60, 72, 96) {
  10. print "converting size $size\n";
  11. system "otf2bdf -p $size $name.ttf | ./bdf_to_ili9341 >> font_$name.c\n";
  12. }
  13. print "writing header file\n";
  14. open C, "grep ILI9341_t3_font_t font_$name.c |";
  15. open H, ">font_$name.h";
  16. print H "#ifndef _ILI9341_t3_font_${name}_\n";
  17. print H "#define _ILI9341_t3_font_${name}_\n\n";
  18. print H "#include \"ILI9341_t3.h\"\n\n";
  19. print H "#ifdef __cplusplus\n";
  20. print H "extern \"C\" {\n";
  21. print H "#endif\n\n";
  22. while (<C>) {
  23. chop;
  24. next unless /^const/;
  25. s/ = \{$//;
  26. print H "extern $_;\n";
  27. #print "$_\n";
  28. }
  29. close C;
  30. print H "\n";
  31. print H "#ifdef __cplusplus\n";
  32. print H "} // extern \"C\"\n";
  33. print H "#endif\n\n";
  34. print H "#endif\n";
  35. close H;