Skip to content

font creator and embedded app - #51

Open
dmytrokirtoka wants to merge 2 commits into
Kernel-GL-HRK:Dmytro.Kirtokafrom
dmytrokirtoka:ssd1306_base1
Open

dmytrokirtoka wants to merge 2 commits into
Kernel-GL-HRK:Dmytro.Kirtokafrom
dmytrokirtoka:ssd1306_base1

Conversation

@dmytrokirtoka

@dmytrokirtoka dmytrokirtoka commented Dec 25, 2017

Copy link
Copy Markdown

added font creator program, embedded app and char map file

crfont.c create simple raster font (internal format) from freetype fonts

axis_to_lcd.c grab data from mpu6050 dev and draw it to i2c_ssd1306 lcd dev

use case:
setup truetype2 lib, build crfont,
exec:
<fontcreator truetype/dejavu/DejaVuSansMono.ttf 12x12.fnt ascii.txt>
by now create only 12x12 font

build embedded app axis_to_lcd.c
arm-linux-gnueabihf-gcc axis_to_lcd.c -o accel2lcd

copy to device /root:
accel2lcd - embedded exe
12x12.fnt - embedded my font file

exec on device:
/root/accel2lcd /dev/mpu6050_0 /dev/fb1 /root/12x12.fnt

modules can be loaded on device before.

@AleksandrBulyshchenko

Copy link
Copy Markdown
Collaborator

I believe this PR doesn't require review from our side :)
However it worth to fill some description of the PR and to denote that it depends on #50.

Also I'm not sure about idea of storing binaries (ssd1306/my_app.odp).

 app grab data from mpu6050 dev and draw it to i2c_ssd1306 lcd dev

use case:
 setup truetype2 lib, build crfont,
 exec:
 <fontcreator truetype/dejavu/DejaVuSansMono.ttf 12x12.fnt ascii.txt>
 by now create only 12x12 font

 build embedded app axis_to_lcd.c
   arm-linux-gnueabihf-gcc axis_to_lcd.c -o accel2lcd

 copy to device /root:
   accel2lcd - embedded exe
   12x12.fnt - embedded my font file

  exec on device:
    /root/accel2lcd /dev/mpu6050_0 /dev/fb1 /root/12x12.fnt

  modules can be loaded on device before.

Signed-off-by: dmytro.kirtoka <dimk334@gmail.com>
@dmytrokirtoka

Copy link
Copy Markdown
Author

eliminated comments

@AleksandrBulyshchenko AleksandrBulyshchenko left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Some comments from my side:

  • I believe text rendering functions and all operations with font should be moved out of axis_to_lcd.c
  • It should be unified with crfont.c - at least common header with data types
  • Preferably - build common library with font processing which is used by both - host for bitmap binary generation and target for text rendering.


printf("%s: x: %d, y: %d, text: %s, img: %p\n", __FUNCTION__, x, y, text, img);

for (i = 0, shift_x = 0; i < strlen(text); ++i) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here and above strlen() is called in a loop


static int get_symbol_offset(char c)
{
return (c < '!' || c > 127) ? 0 : c - '!';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You hardcode characters to bitmaps mapping here,
but use free order (defined by ascii.txt) when bitmaps are generated.
This is errors prone - either symbols' table should be embed into generated font file,
or it should be hardcodded for crfont.c as well (in common header).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants