/arduino-persian-reshaper

Simple Reconstruct Persian/Arabic letters for use in the Arduino IDE and OLED/LCD display with a 8x8 font

Primary LanguageC++GNU General Public License v3.0GPL-3.0

you## Arduino Persian Reshaper Simple Reconstruct Persian/Arabic letters to be used in Arduino IDE and OLED/LCD display. This script is compatible to all Arduino family boards such as Arduboy, ESP8266/ESP32, Particle Photon, ....

All displays and libraries that can be set to writepixel(x, y, color) can be used and there is no limit.

Description

Persian/Arabic script is very special with two essential features:

  • It is written from right to left.
  • The characters change shape according to their surrounding characters.

The code attempts to resolve the problem of displaying letters and numbers in Persian/Arabic with a 8x8 font.

Screenshot

See more screenshots here.

Persian Letters on Arduboy

Online simulation on ESP32

Use Wokwi.com for online simulation.

Online simulation on ESP32 with wokwi.com

Prerequisites

First you need to install the Adafruit GFX library (for drawing shapes, lines, ...) of course this is optional, then according to the type of display, install the library you need. Here I used the 128x64 display with SSD1306 chip driver so I installed the Adafruit SSD1306 library.

Download & Usage

Download/Clone repository, change the following lines according to the library you are using:

//This section should be modified according to your display type and library
#define setpixel(x, y, color)           display.writePixel(x, y, color)
#define LCDWidth                        display.width()

//If you use SPI display, change the following lines according to your display type (I used the Arduboy)
#define OLED_DC                         4
#define OLED_CS                         12
#define OLED_RESET                      6
Adafruit_SSD1306 display(OLED_DC, OLED_RESET, OLED_CS);

//If you use i2c display, uncomment this part.
/*
#define OLED_RESET                      4
Adafruit_SSD1306 display(OLED_RESET);
*/

Finally, change the following lines and then upload on the Arduino board:

char txt[] = "فارسی نویسی در آردوینو";
PutCharPE(txt,ALINE_CENTER(txt),8,1,BLACK);

char NUM[] = "0123456789";              //For correct representation, the numbers must be reversed.
PutCharPE(strreverse(NUM),ALINE_CENTER(NUM),30,1,BLACK);

راهنمای استفاده به زبان فارسی

Contact

Copyright (C) 2018 Sadraldin Rastegar and Ramin Sangesari.

Donation

If this project help you reduce time to develop, you can give me a cup of coffee :)