Skip to content

Commit

Permalink
Merge pull request #2378 from madhurpv/master
Browse files Browse the repository at this point in the history
Adding support for more characters of Devanagari Language

Thanks for your input!
  • Loading branch information
olikraus authored Feb 25, 2024
2 parents 4c8fea3 + e3fd8a1 commit ec2559e
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 19 deletions.
37 changes: 30 additions & 7 deletions sys/arduino/u8g2_page_buffer/Devanagari/Devanagari.ino
Original file line number Diff line number Diff line change
Expand Up @@ -418,17 +418,40 @@ u8g2_uint_t u8g2_draw_unifont_devanagari(u8g2_uint_t x, u8g2_uint_t y, const cha
{
/* many more glyphs and corrections are missing */
/* please report to https://github.com/olikraus/u8g2/issues/584 */
case 0x093e: x-= 12; break;
case 0x093f: x-= 19; break;
case 0x0941: x-= 10; y+=3; break; // move down
case 0x0947: x-= 12; break;
case 0x094d: x-= 10; break;
case 0x0901: x-= 14; y-=2; break; // ँँ
case 0x0902: x-= 14; y-=2; break; // move up // ं
case 0x0903: x-= 14; break; //
case 0x093e: x-= 12; break; //
case 0x093f: x-= 16; break; // ि
case 0x0940: x-= 12; break; //
case 0x0941: x-= 15; y+=2; break; // move down // ु
case 0x0942: x-= 12; y+=2; break; // move down // ू
case 0x0943: x-= 16; y+=2; break; // move down // ृ
case 0x0944: x-= 16; y+=2; break; // move down // ॄ
case 0x0945: x-= 14; y-=2; break; // move up // ॅ
case 0x0946: x-= 14; break; //
case 0x0947: x-= 14; break; //
case 0x0948: x-= 14; break; //
case 0x0949: x-= 14; break; //
case 0x094b: x-= 14; break; //
case 0x094c: x-= 14; break; //
case 0x094d: x-= 10; break; //
}
delta = u8g2.drawGlyph(x, y, e);
switch(e)
{
case 0x0941: x-= 3; y -=3; break; // revert the y shift
case 0x094d: x-= 8; break;
case 0x0901: x-= 6; y +=2; break; // revert the y shift
case 0x0902: x-= 6; y +=2; break; // revert the y shift
case 0x0941: x-= 3; y -=2; break; // revert the y shift
case 0x0942: x-= 6; y -=2; break; // revert the y shift
case 0x0943: x-= 4; y -=2; break; // revert the y shift
case 0x0944: x-= 4; y -=2; break; // revert the y shift
case 0x0945: x-= 6; y +=2; break; // revert the y shift
case 0x0946: x-= 2; break;
case 0x0947: x-= 2; break;
case 0x0948: x-= 2; break;
case 0x0949: x-= 2; break;
case 0x094d: x-= 8; break;
}
x += delta;
sum += delta;
Expand Down
35 changes: 29 additions & 6 deletions sys/rt-thread/examples/page_buffer/Devanagari.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,16 +278,39 @@ static u8g2_uint_t u8g2_draw_unifont_devanagari(u8g2_uint_t x, u8g2_uint_t y, co
{
/* many more glyphs and corrections are missing */
/* please report to https://github.com/olikraus/u8g2/issues/584 */
case 0x093e: x-= 12; break;
case 0x093f: x-= 19; break;
case 0x0941: x-= 10; y+=3; break; // move down
case 0x0947: x-= 12; break;
case 0x094d: x-= 10; break;
case 0x0901: x-= 14; y-=2; break; // ँँ
case 0x0902: x-= 14; y-=2; break; // move up // ं
case 0x0903: x-= 14; break; //
case 0x093e: x-= 12; break; //
case 0x093f: x-= 16; break; // ि
case 0x0940: x-= 12; break; //
case 0x0941: x-= 15; y+=2; break; // move down // ु
case 0x0942: x-= 12; y+=2; break; // move down // ू
case 0x0943: x-= 16; y+=2; break; // move down // ृ
case 0x0944: x-= 16; y+=2; break; // move down // ॄ
case 0x0945: x-= 14; y-=2; break; // move up // ॅ
case 0x0946: x-= 14; break; //
case 0x0947: x-= 14; break; //
case 0x0948: x-= 14; break; //
case 0x0949: x-= 14; break; //
case 0x094b: x-= 14; break; //
case 0x094c: x-= 14; break; //
case 0x094d: x-= 10; break; //
}
delta = u8g2.drawGlyph(x, y, e);
switch(e)
{
case 0x0941: x-= 3; y -=3; break; // revert the y shift
case 0x0901: x-= 6; y +=2; break; // revert the y shift
case 0x0902: x-= 6; y +=2; break; // revert the y shift
case 0x0941: x-= 3; y -=2; break; // revert the y shift
case 0x0942: x-= 6; y -=2; break; // revert the y shift
case 0x0943: x-= 4; y -=2; break; // revert the y shift
case 0x0944: x-= 4; y -=2; break; // revert the y shift
case 0x0945: x-= 6; y +=2; break; // revert the y shift
case 0x0946: x-= 2; break;
case 0x0947: x-= 2; break;
case 0x0948: x-= 2; break;
case 0x0949: x-= 2; break;
case 0x094d: x-= 8; break;
}
x += delta;
Expand Down
36 changes: 30 additions & 6 deletions sys/sdl/devanagari/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,40 @@ u8g2_uint_t u8g2_draw_unifont_devanagari(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_

switch(e)
{
case 0x093e: x-= 12; break;
case 0x093f: x-= 19; break;
case 0x0941: x-= 14; break;
case 0x0947: x-= 12; break;
case 0x094d: x-= 10; break;
case 0x0901: x-= 14; y-=2; break; // ँँ
case 0x0902: x-= 14; y-=2; break; // move up // ं
case 0x0903: x-= 14; break; // ः
case 0x093e: x-= 12; break; // ा
case 0x093f: x-= 16; break; // ि
case 0x0940: x-= 12; break; // ी
case 0x0941: x-= 15; y+=2; break; // move down // ु
case 0x0942: x-= 12; y+=2; break; // move down // ू
case 0x0943: x-= 16; y+=2; break; // move down // ृ
case 0x0944: x-= 16; y+=2; break; // move down // ॄ
case 0x0945: x-= 14; y-=2; break; // move up // ॅ
case 0x0946: x-= 14; break; // ॆ
case 0x0947: x-= 14; break; // े
case 0x0948: x-= 14; break; // ै
case 0x0949: x-= 14; break; // ै
case 0x094b: x-= 14; break; // ो
case 0x094c: x-= 14; break; // ौ
case 0x094d: x-= 10; break; // ्
}
delta = u8g2_DrawGlyph(u8g2, x, y, e);
switch(e)
{
case 0x094d: x-= 8; break;
case 0x0901: x-= 6; y +=2; break; // revert the y shift
case 0x0902: x-= 6; y +=2; break; // revert the y shift
case 0x0941: x-= 3; y -=2; break; // revert the y shift
case 0x0942: x-= 6; y -=2; break; // revert the y shift
case 0x0943: x-= 4; y -=2; break; // revert the y shift
case 0x0944: x-= 4; y -=2; break; // revert the y shift
case 0x0945: x-= 6; y +=2; break; // revert the y shift
case 0x0946: x-= 2; break;
case 0x0947: x-= 2; break;
case 0x0948: x-= 2; break;
case 0x0949: x-= 2; break;
case 0x094d: x-= 8; break;
}

x += delta;
Expand Down

0 comments on commit ec2559e

Please sign in to comment.