Post by jgrant911 on Sept 12, 2018 8:44:42 GMT -8
I have been trying to use the LOAD_ASSETS() tool to get access to a subset of a font (numbers and the ":" character for a clock display on my GD2). I have been using the procedure and test program recommended at gameduino2.proboards.com/thread/189/custom-font to test but despite trying a number of variations, have been getting the same errors. In researching possible solutions my only leads were possible update/release incompatibilities but I think everything is up to date. Full disclosure: my programming level is only adequate so it could be something simple I have overlooked!
Any help would be appreciated.
I have the following error results:
------------------------------------------------------------------------------------------------------------------------
In file included from C:\Users\Jim\Documents\Arduino\clockfont\clockfont.ino:4:0:
clockfont_assets.h:50: error: 'Bitmap' does not name a type
Bitmap closeness;
^
clockfont_assets.h:53: error: too many initializers for '<anonymous struct>'
};
^
C:\Users\Jim\Documents\Arduino\clockfont\clockfont.ino: In function 'void setup()':
clockfont_assets.h:46: error: 'class GDClass' has no member named 'loadptr'
#define LOAD_ASSETS() (GD.copy(__assets, sizeof(__assets)), GD.loadptr = ASSETS_END)
^
C:\Users\Jim\Documents\Arduino\clockfont\clockfont.ino:9:3: note: in expansion of macro 'LOAD_ASSETS'
LOAD_ASSETS();
^
exit status 1
'Bitmap' does not name a type
----------------------------------------------------------------------------------------------------------------------------------
The errors were form this Test Program:
----------------------------------------------------------------------------------------------------------------------------------
#include <EEPROM.h>
#include <SPI.h>
#include <GD2.h>
#include "clockfont_assets.h"
void setup()
{
GD.begin();
LOAD_ASSETS();
}
void loop()
{
GD.ClearColorRGB(0x103000);
GD.Clear();
GD.cmd_text(240, 136, CLOSENESS_HANDLE, OPT_CENTER, "Hello world in Big font");
GD.cmd_button(160, 200, 160, 40, CLOSENESS_HANDLE, 0, "Press me!");
GD.swap();
}
--------------------------------------------------------------------------------------------------------------
The file generated by gd2assets (clockfont_assets.h:) which is included on a separate Tab of the "clockfont" program:
--------------------------------------------------------------------------------------------------------------
// This file was generated with the command-line:
// gd2asset Closeness.ttf,size=30,firstchar=48,topchar=58
#define CLOSENESS_HANDLE 0
#define CLOSENESS_WIDTH 19
#define CLOSENESS_HEIGHT 22
#define CLOSENESS_CELLS 11
#define ASSETS_END 2568UL
static const PROGMEM uint8_t __assets[532] = {
0, 0, 0, 5, 0, 0, 0, 1, 22, 38, 0, 8, 22, 20, 16, 7, 192, 214, 127, 1,
43, 255, 255, 255, 0, 0, 0, 0, 116, 9, 0, 0, 34, 255, 255, 255, 0, 0,
0, 0, 120, 218, 197, 149, 93, 78, 194, 64, 16, 199, 23, 49, 128, 16,
40, 177, 137, 79, 70, 124, 246, 193, 35, 168, 241, 2, 122, 2, 237, 5,
12, 61, 128, 70, 47, 128, 122, 3, 124, 241, 221, 27, 232, 17, 240, 69,
18, 99, 66, 212, 87, 181, 36, 70, 1, 165, 29, 119, 119, 118, 118, 203,
71, 218, 42, 24, 134, 144, 252, 88, 166, 211, 153, 157, 255, 236, 178,
53, 15, 0, 130, 251, 45, 150, 22, 192, 237, 131, 21, 16, 160, 207, 74,
138, 128, 89, 208, 102, 220, 102, 74, 104, 1, 43, 42, 242, 89, 86,
209, 39, 99, 71, 18, 94, 118, 217, 120, 59, 198, 56, 76, 60, 210, 166,
37, 69, 57, 32, 218, 1, 179, 230, 145, 223, 233, 62, 81, 218, 34, 98,
179, 39, 109, 88, 185, 239, 132, 118, 195, 236, 144, 21, 217, 65, 101,
241, 116, 64, 81, 178, 58, 114, 81, 191, 77, 189, 131, 103, 16, 151,
187, 201, 37, 138, 66, 118, 40, 69, 249, 234, 202, 30, 9, 235, 134,
106, 43, 253, 161, 54, 75, 105, 136, 168, 171, 169, 49, 176, 134, 79,
248, 99, 163, 68, 169, 19, 66, 249, 229, 140, 58, 107, 168, 78, 103,
184, 119, 25, 29, 120, 143, 104, 222, 35, 90, 167, 205, 72, 181, 136,
150, 245, 6, 93, 195, 55, 82, 30, 224, 10, 169, 14, 253, 178, 36, 222,
164, 91, 76, 185, 10, 193, 170, 36, 30, 245, 25, 203, 216, 0, 184,
220, 150, 126, 85, 61, 81, 209, 148, 84, 36, 198, 104, 55, 218, 177,
148, 64, 47, 77, 19, 207, 209, 212, 8, 69, 73, 58, 55, 248, 107, 152,
40, 74, 81, 71, 166, 190, 185, 212, 183, 230, 64, 207, 112, 22, 124,
87, 207, 66, 39, 241, 188, 37, 170, 215, 55, 85, 118, 52, 37, 140, 28,
171, 73, 147, 51, 157, 27, 110, 168, 180, 138, 250, 247, 60, 134, 80,
168, 114, 135, 132, 21, 180, 72, 54, 69, 96, 165, 207, 71, 117, 104,
2, 156, 32, 229, 33, 40, 147, 178, 105, 198, 234, 228, 150, 242, 40,
110, 78, 104, 86, 218, 10, 244, 148, 219, 25, 60, 105, 183, 11, 58,
200, 201, 173, 8, 95, 202, 173, 10, 239, 138, 90, 228, 102, 172, 198,
7, 43, 120, 123, 112, 116, 127, 227, 250, 86, 73, 184, 207, 163, 19,
223, 21, 9, 40, 53, 45, 168, 181, 30, 63, 175, 240, 137, 96, 234, 125,
35, 77, 58, 226, 64, 25, 185, 3, 38, 187, 197, 135, 115, 1, 253, 142,
240, 189, 48, 201, 57, 57, 114, 139, 15, 212, 246, 235, 251, 112, 102,
246, 95, 153, 218, 121, 219, 182, 23, 249, 199, 206, 76, 37, 207, 57,
49, 71, 34, 46, 255, 46, 241, 239, 205, 29, 192, 15, 231, 166, 41,
231, 0
};
#define LOAD_ASSETS() (GD.copy(__assets, sizeof(__assets)), GD.loadptr = ASSETS_END)
static const shape_t CLOSENESS_SHAPE = {0, 19, 22, 0};
struct {
Bitmap closeness;
} bitmaps = {
/* closeness */ {{ 19, 22}, { 9, 11}, 0x0UL, 2, 0}
};
--------------------------------------------------------------------------------------------------------------------
Any help would be appreciated.
I have the following error results:
------------------------------------------------------------------------------------------------------------------------
In file included from C:\Users\Jim\Documents\Arduino\clockfont\clockfont.ino:4:0:
clockfont_assets.h:50: error: 'Bitmap' does not name a type
Bitmap closeness;
^
clockfont_assets.h:53: error: too many initializers for '<anonymous struct>'
};
^
C:\Users\Jim\Documents\Arduino\clockfont\clockfont.ino: In function 'void setup()':
clockfont_assets.h:46: error: 'class GDClass' has no member named 'loadptr'
#define LOAD_ASSETS() (GD.copy(__assets, sizeof(__assets)), GD.loadptr = ASSETS_END)
^
C:\Users\Jim\Documents\Arduino\clockfont\clockfont.ino:9:3: note: in expansion of macro 'LOAD_ASSETS'
LOAD_ASSETS();
^
exit status 1
'Bitmap' does not name a type
----------------------------------------------------------------------------------------------------------------------------------
The errors were form this Test Program:
----------------------------------------------------------------------------------------------------------------------------------
#include <EEPROM.h>
#include <SPI.h>
#include <GD2.h>
#include "clockfont_assets.h"
void setup()
{
GD.begin();
LOAD_ASSETS();
}
void loop()
{
GD.ClearColorRGB(0x103000);
GD.Clear();
GD.cmd_text(240, 136, CLOSENESS_HANDLE, OPT_CENTER, "Hello world in Big font");
GD.cmd_button(160, 200, 160, 40, CLOSENESS_HANDLE, 0, "Press me!");
GD.swap();
}
--------------------------------------------------------------------------------------------------------------
The file generated by gd2assets (clockfont_assets.h:) which is included on a separate Tab of the "clockfont" program:
--------------------------------------------------------------------------------------------------------------
// This file was generated with the command-line:
// gd2asset Closeness.ttf,size=30,firstchar=48,topchar=58
#define CLOSENESS_HANDLE 0
#define CLOSENESS_WIDTH 19
#define CLOSENESS_HEIGHT 22
#define CLOSENESS_CELLS 11
#define ASSETS_END 2568UL
static const PROGMEM uint8_t __assets[532] = {
0, 0, 0, 5, 0, 0, 0, 1, 22, 38, 0, 8, 22, 20, 16, 7, 192, 214, 127, 1,
43, 255, 255, 255, 0, 0, 0, 0, 116, 9, 0, 0, 34, 255, 255, 255, 0, 0,
0, 0, 120, 218, 197, 149, 93, 78, 194, 64, 16, 199, 23, 49, 128, 16,
40, 177, 137, 79, 70, 124, 246, 193, 35, 168, 241, 2, 122, 2, 237, 5,
12, 61, 128, 70, 47, 128, 122, 3, 124, 241, 221, 27, 232, 17, 240, 69,
18, 99, 66, 212, 87, 181, 36, 70, 1, 165, 29, 119, 119, 118, 118, 203,
71, 218, 42, 24, 134, 144, 252, 88, 166, 211, 153, 157, 255, 236, 178,
53, 15, 0, 130, 251, 45, 150, 22, 192, 237, 131, 21, 16, 160, 207, 74,
138, 128, 89, 208, 102, 220, 102, 74, 104, 1, 43, 42, 242, 89, 86,
209, 39, 99, 71, 18, 94, 118, 217, 120, 59, 198, 56, 76, 60, 210, 166,
37, 69, 57, 32, 218, 1, 179, 230, 145, 223, 233, 62, 81, 218, 34, 98,
179, 39, 109, 88, 185, 239, 132, 118, 195, 236, 144, 21, 217, 65, 101,
241, 116, 64, 81, 178, 58, 114, 81, 191, 77, 189, 131, 103, 16, 151,
187, 201, 37, 138, 66, 118, 40, 69, 249, 234, 202, 30, 9, 235, 134,
106, 43, 253, 161, 54, 75, 105, 136, 168, 171, 169, 49, 176, 134, 79,
248, 99, 163, 68, 169, 19, 66, 249, 229, 140, 58, 107, 168, 78, 103,
184, 119, 25, 29, 120, 143, 104, 222, 35, 90, 167, 205, 72, 181, 136,
150, 245, 6, 93, 195, 55, 82, 30, 224, 10, 169, 14, 253, 178, 36, 222,
164, 91, 76, 185, 10, 193, 170, 36, 30, 245, 25, 203, 216, 0, 184,
220, 150, 126, 85, 61, 81, 209, 148, 84, 36, 198, 104, 55, 218, 177,
148, 64, 47, 77, 19, 207, 209, 212, 8, 69, 73, 58, 55, 248, 107, 152,
40, 74, 81, 71, 166, 190, 185, 212, 183, 230, 64, 207, 112, 22, 124,
87, 207, 66, 39, 241, 188, 37, 170, 215, 55, 85, 118, 52, 37, 140, 28,
171, 73, 147, 51, 157, 27, 110, 168, 180, 138, 250, 247, 60, 134, 80,
168, 114, 135, 132, 21, 180, 72, 54, 69, 96, 165, 207, 71, 117, 104,
2, 156, 32, 229, 33, 40, 147, 178, 105, 198, 234, 228, 150, 242, 40,
110, 78, 104, 86, 218, 10, 244, 148, 219, 25, 60, 105, 183, 11, 58,
200, 201, 173, 8, 95, 202, 173, 10, 239, 138, 90, 228, 102, 172, 198,
7, 43, 120, 123, 112, 116, 127, 227, 250, 86, 73, 184, 207, 163, 19,
223, 21, 9, 40, 53, 45, 168, 181, 30, 63, 175, 240, 137, 96, 234, 125,
35, 77, 58, 226, 64, 25, 185, 3, 38, 187, 197, 135, 115, 1, 253, 142,
240, 189, 48, 201, 57, 57, 114, 139, 15, 212, 246, 235, 251, 112, 102,
246, 95, 153, 218, 121, 219, 182, 23, 249, 199, 206, 76, 37, 207, 57,
49, 71, 34, 46, 255, 46, 241, 239, 205, 29, 192, 15, 231, 166, 41,
231, 0
};
#define LOAD_ASSETS() (GD.copy(__assets, sizeof(__assets)), GD.loadptr = ASSETS_END)
static const shape_t CLOSENESS_SHAPE = {0, 19, 22, 0};
struct {
Bitmap closeness;
} bitmaps = {
/* closeness */ {{ 19, 22}, { 9, 11}, 0x0UL, 2, 0}
};
--------------------------------------------------------------------------------------------------------------------