|
1 | 1 | # ExtendedChars |
2 | | - An extension library for Adafruit GFX that supports more characters |
| 2 | + |
| 3 | +An extension library for Adafruit GFX that supports more characters. |
| 4 | + |
| 5 | +## Description |
| 6 | + |
| 7 | +This library provides functions to handle extended characters like German umlauts for use with the Adafruit GFX library. It includes support for two fonts: Extended_ClassicFont7pt and Extended_FreeSans9pt7b. |
| 8 | + |
| 9 | +## Supported Characters |
| 10 | + |
| 11 | +Currently, the library supports the following German umlauts and special characters: |
| 12 | +- Ä (U+00C4) |
| 13 | +- Ö (U+00D6) |
| 14 | +- Ü (U+00DC) |
| 15 | +- ä (U+00E4) |
| 16 | +- ö (U+00F6) |
| 17 | +- ü (U+00FC) |
| 18 | +- ß (U+00DF) |
| 19 | + |
| 20 | +## Installation |
| 21 | + |
| 22 | +### Arduino |
| 23 | + |
| 24 | +1. Download the library as a ZIP file and extract it. |
| 25 | +2. Move the extracted folder to your Arduino libraries directory (usually `Documents/Arduino/libraries`). |
| 26 | +3. Restart the Arduino IDE. |
| 27 | + |
| 28 | +### PlatformIO |
| 29 | + |
| 30 | +1. Add the following to your `platformio.ini` file: |
| 31 | + ```ini |
| 32 | + lib_deps = |
| 33 | + https://github.com/dpoettler/ExtendedChars.git |
| 34 | + ``` |
| 35 | + |
| 36 | +## Usage |
| 37 | + |
| 38 | +### Example |
| 39 | + |
| 40 | +```cpp |
| 41 | +#include <Adafruit_GFX.h> |
| 42 | +#include <Adafruit_SSD1306.h> |
| 43 | +#include "ExtendedChars.h" |
| 44 | +#include "Extended_ClassicFont7pt.h" |
| 45 | +#include "Extended_FreeSans9pt7b.h" |
| 46 | + |
| 47 | +Adafruit_SSD1306 display(128, 64, &Wire); |
| 48 | + |
| 49 | +void setup() { |
| 50 | + display.begin(SSD1306_SWITCHCAPVCC, 0x3C); |
| 51 | + display.clearDisplay(); |
| 52 | + |
| 53 | + // Set font |
| 54 | + display.setFont(&Extended_ClassicFont7pt); |
| 55 | + |
| 56 | + // Print text with extended characters |
| 57 | + display.setCursor(0, 20); |
| 58 | + display.print(ExtendedChars::extendChars("Hällo Wörld")); |
| 59 | + |
| 60 | + display.display(); |
| 61 | +} |
| 62 | + |
| 63 | +void loop() { |
| 64 | + // Nothing to do here |
| 65 | +} |
| 66 | +``` |
| 67 | +## API |
| 68 | +String ExtendedChars::extendChars(const String &str) |
| 69 | +Converts a UTF-8 string to a format that can be displayed using the Adafruit GFX library with extended characters. |
| 70 | + |
| 71 | +## License |
| 72 | +This library is licensed under the GPL v3 License. |
0 commit comments