Unicode rendering on fx9860g and mono screenshot

This commit is contained in:
Lephe 2020-07-14 17:35:05 +02:00
parent dc5b60df15
commit 99c1bf0dbf
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
12 changed files with 96 additions and 1 deletions

View File

@ -0,0 +1,3 @@
These are some of the Unicode blocks supported by uf5x7. Please see the
repository at https://gitea.planet-casio.com/Lephenixnoir/uf5x7 for the full
set.

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -32,6 +32,9 @@ void gintctl_gint_timer_callbacks(void);
/* gintctl_gint_bopti(): Test image rendering */
void gintctl_gint_bopti(void);
/* gintctl_gint_topti(): Test text rendering */
void gintctl_gint_topti(void);
#ifdef FXCG50
/* gintctl_gint_dma(): Test the Direct Access Memory Controller */

View File

@ -6,6 +6,7 @@
#define GINTCTL_UTIL
#include <stdarg.h>
#include <stdint.h>
//---
// Platform disambiguation functions
@ -68,4 +69,12 @@ void fkey_menu(int position, char const *text);
#endif /* FXCG50 */
//---
// Screenshot saving
//---
/* screen_mono(): Take a screenshot of the mono VRAM
@path File path (will be overwritten) */
void screen_mono(uint16_t const *filepath);
#endif /* GINTCTL_UTIL */

View File

@ -83,6 +83,7 @@ LDFLAGS_CG += -Wl,-Map=build-cg/map
FONT.hexa.png = charset:print grid.size:3x5 grid.padding:1
FONT.font8x9_bold.png = charset:print grid.size:8x11 grid.padding:1 \
grid.border:0 proportional:true
FONT.uf5x7 = charset:unicode grid.size:5x7 grid.padding:1
IMG.swift.png = profile:p4
IMG.swords.png = profile:p8

46
src/gint/topti.c Normal file
View File

@ -0,0 +1,46 @@
#include <gint/display.h>
#include <gint/keyboard.h>
#include <gintctl/gint.h>
#include <gintctl/util.h>
/* gintctl_gint_topti(): Test text rendering */
void gintctl_gint_topti(void)
{
int key = 0;
/* Text position parameters */
int x = _(1,6), y=_(0,22);
int dy = _(8,15);
char const *strings[] = {
"Text rendering",
"Eurêka! UTF-8!",
#ifdef FX9860G
"∀Δ, ∀f : P(Δ)→Δ,",
"∃(A,B)⊆Δ, f(A)=f(B)",
#else
"∀Δ, ∀f : P(Δ)→Δ, ∃(A,B)⊆Δ, f(A)=f(B)",
#endif
"2 = Λα.λf.λn.f (f n)",
NULL,
};
int total = 0;
while(strings[total]) total++;
while(key != KEY_EXIT)
{
dclear(C_WHITE);
for(int i = 0; strings[i]; i++)
dtext(x, y + i * dy, C_BLACK, strings[i]);
dupdate();
key = getkey().key;
if(key == KEY_LEFT && x >= -DWIDTH) x--;
if(key == KEY_RIGHT && x <= DWIDTH) x++;
if(key == KEY_UP && y >= -DHEIGHT) y--;
if(key == KEY_DOWN && y <= DHEIGHT) y++;
if(key == KEY_F6) screen_mono(u"\\\\fls0\\topti.bin");
}
}

View File

@ -48,7 +48,7 @@ struct menu menu_gint = {
#endif
{ "Real-time clock", NULL },
{ "Image rendering", gintctl_gint_bopti },
{ "Text rendering", NULL },
{ "Text rendering", gintctl_gint_topti },
#ifdef FX9860G
{ "Gray engine", gintctl_gint_gray },
{ "Gray rendering", gintctl_gint_grayrender },
@ -126,6 +126,12 @@ int main(GUNUSED int isappli, GUNUSED int optnum)
/* Start the profiling library */
prof_init(PROFCTX_COUNT);
#ifdef FX9860G
/* Use the Unicode font uf5x7 on fx-9860G */
extern font_t font_uf5x7;
dfont(&font_uf5x7);
#endif
int key = 0;
struct menu *menu = NULL;

View File

@ -1,5 +1,7 @@
#include <gint/display.h>
#include <gint/std/stdio.h>
#include <gint/gint.h>
#include <gint/bfile.h>
#include <gintctl/util.h>
@ -179,3 +181,28 @@ void fkey_menu(int position, char const *text)
}
#endif /* FXCG50 */
//---
// Screenshot saving
//---
static uint16_t const *path;
void switch_screen_mono(void)
{
int size = 1024;
BFile_Remove(path);
BFile_Create(path, BFile_File, &size);
int fd = BFile_Open(path, BFile_WriteOnly);
BFile_Write(fd, gint_vram, 1024);
BFile_Close(fd);
}
/* screen_mono(): Take a screenshot of the mono VRAM */
void screen_mono(uint16_t const *filepath)
{
path = filepath;
gint_switch(switch_screen_mono);
}