Giter Club home page Giter Club logo

Comments (10)

jekader avatar jekader commented on August 22, 2024 1

Thanks for your contribution! The offsets should continue from the main PixelItGlyphs font and then UTF letter assignments can be made in the Utf8ToAscii helper function. You can search the code for ๐Ÿ˜€ to find an example of how the mapping is done for this emoji.

For Russian letters you provided, we'll need to map Unicode symbols U+0410 .. U+044F according to https://en.wikipedia.org/wiki/List_of_Unicode_characters#Cyrillic

By the way, did you create this font yourself or it is taken from some permissive source?

I can take a look later and create the mapping (since it's linear it can be done in a single case statement similar to Latin1 Supplement)

from pixelit.

jekader avatar jekader commented on August 22, 2024 1

Hi, the range for the glyphs in UTF-8 should be D081 (ะ U+0401) to D197 (ั— U+0457)

here's a placeholder for the contiguous range ะ..ั which just prints question marks instead of the glyphs:

	case 0xD090 ... 0xD0BF: // Russian Cyrillic (Decimal 206-253)
		result = 0x3F;
		break;
	case 0xD180 ... 0xD18F: // Russian Cyrillic (Decimal 254-269)
		result = 0x3F;
		break;

What is left is to add the offset (0x90 becomes 0xEE and so on) - I am also working on a patch, will let you know the right math once I have it working. For other non-contiguous symbols we'll have to add them individually or draw the missing ones

from pixelit.

jekader avatar jekader commented on August 22, 2024 1

Some more thoughts after playing around:

  1. the glyph number needs to be changed on the font object when updating the font to enable new letters
  2. setting the max number higher than 0xFF breaks the screen for me
  3. there's already 201 glyphs and the limit is 224 which is just 13 more symbols
  4. the pixelit font is 5px tall but some of the new letters are 7 pixels tall
  5. newly provided Cyrillic letters have a different drawing style than existing Latin matching ones (ABC for instance) - this might need adjustment once we figure out the rendering issue
  6. some offsets are off starting with ะท when previewing via https://tchapi.github.io/Adafruit-GFX-Font-Customiser/

With this, I was able to show some of the chars successfully:
image

So besides the minor bugs in the font itself I thing the issue with glyph limits is the biggest. I don't have much experience with the GFX Library - maybe @foorschtbar can comment on this. The last attribute is uint16_t according to the reference so it should be able to go higher than 256. The font customizer also has no problem displaying all the glyphs.

from pixelit.

jekader avatar jekader commented on August 22, 2024 1

UPD: as a temporary hack, since we're stuck with 1-byte encodings, I've hacked up a patch that replaces latin extended glyphs with your font - it can be found in this branch:
https://github.com/jekader/PixelIt/tree/cyrillic-font

This only covers the contiguous Russian alphabet mapping in Utf8ToAscii at the moment for simplicity. All glyphs work fine (I've trimmed down everything to max 6 pixels high).

Feel free to build this branch and improve on it, should give you the result you need while we figure out a proper solution if one is even possible for embedded devices.

from pixelit.

jekader avatar jekader commented on August 22, 2024 1

I've added extended Cyrillic glyphs to my branch. Looks like า and า‘ were missing from your font so I've created those and added them as well. Now all East-Slavic Cyrillic languages should fully work.

Looking at the patch, seems like having a separate repo which would rebase with each PixelIt release would be a reasonable solution: whoever needs a PixelIt with Cyrillic support can just install the relevant binary. WDYT? Alternatively, having a separate set of _cyrillic image builds right in this repo is an option - also possible with minor refactoring of some of the sources and adding some build flags.

from pixelit.

geo-mesh avatar geo-mesh commented on August 22, 2024

Thanks for your contribution! The offsets should continue from the main PixelItGlyphs font and then UTF letter assignments can be made in the Utf8ToAscii helper function. You can search the code for ๐Ÿ˜€ to find an example of how the mapping is done for this emoji.

For Russian letters you provided, we'll need to map Unicode symbols U+0410 .. U+044F according to https://en.wikipedia.org/wiki/List_of_Unicode_characters#Cyrillic

By the way, did you create this font yourself or it is taken from some permissive source?

I can take a look later and create the mapping (since it's linear it can be done in a single case statement similar to Latin1 Supplement)

I created it myself and wrote the HEX code for it. At the moment, I have changed the encoding to UTF-16 and edited the glyphs settings. Does it look right now? Can you check it out? If not, write about it and I will fix it.

My font can also be changed by me for the convenience of reading it.

from pixelit.

geo-mesh avatar geo-mesh commented on August 22, 2024
const uint8_t PixelItBitmaps[] PROGMEM = {
    .
    .
    0xC0, 0x40, 0x20, 0x40, 0xC0,       // [ 93 | 125 | 0x7D] braceright (0x7D)
    0x60, 0xC0,                         // [ 94 | 126 | 0x7E] asciitilde (0x7E)
                                       // Basic Cyrillic (Decimal 1025-1111)
    0xA0, 0x00, 0xE0, 0x80, 0xC0, 0x80, 0xE0, // [95 | 1025 | 0x401] ะ (0x401)
    0x60, 0x80, 0xC0, 0x80, 0x60,             // [96 | 1028 | 0x404] ะ„ (0x404)
    0x80, 0x80, 0x80, 0x80, 0x80,             // [97 | 1030 | 0x406] ะ† (0x406)
    0xA0, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, // [98 | 1031 | 0x407] ะ‡ (0x407)
    0xE0, 0xA0, 0xE0, 0xA0, 0xA0,             // [99 | 1040 | 0x410] ะ (0x410)

const GFXglyph PixelItGlyphs[] PROGMEM = {
    .
    .
    {411, 8, 5, 4, 0, -5}, // [ 93 | 125 | 0x7D] braceright (0x7D)
    {416, 8, 2, 4, 0, -5}, // [ 94 | 126 | 0x7E] asciitilde (0x7E)
                           // Glyphs setting Basic Cyrillic (Decimal 1025-1111)
    {418, 8, 7, 4, 0, -7}, // [95 | 1025 | 0x401] ะ (0x401)
    {425, 8, 5, 4, 0, -5}, // [96 | 1028 | 0x404] ะ„ (0x404)
    {430, 8, 5, 2, 0, -5}, // [97 | 1030 | 0x406] ะ† (0x406)
    {435, 8, 7, 4, 0, -7}, // [98 | 1031 | 0x407] ะ‡ (0x407)
    {442, 8, 5, 4, 0, -5}, // [99 | 1040 | 0x410] ะ (0x410)

jekader
I tried to test my font and added the first 5 lines of my Cyrillic font code. But my symbols ยซะ, ะ„, ะ†, ะ‡, ะยป are not displayed, instead I get an empty screen. I also set up the "Glyphs" offset according to the continuation of the line code [94]..
Also in the file " Tools.h " via "Utf8ToAscii" I added the following code:

case 1025 ... 1040: // Basic Cyrillic (Decimal 1025-1111)
	result = ascii;
	break;

But all to no avail.

Could you tell me what can be done to make it work? I'm not an expert, but I figured out how the pixel font is encoded in "HEX", what Decimal and ASCII are. And I really want my font to finally display on my pixel clock. I also spend a lot of time to redo the code of my Cyrillic font for the Pixelit project.

Thanks for any information.

from pixelit.

geo-mesh avatar geo-mesh commented on August 22, 2024

jekader
Thank you for your feedback and your work! Sorry for not responding earlier.
At some point, I realized that it was not enough just to add a HEX code for Cyrillic to make it work and my hands dropped.
As I understand it, you created a fork of the project and instead of extended Latin characters, you added Cyrillic for the experiment?
I still do not understand how the function works when entering a character from the keyboard for subsequent transmission to Utf8ToAscii and 1-byte encodings. It is configured in the src/Tools.h file ?

from pixelit.

jekader avatar jekader commented on August 22, 2024

Yes, correct. Tools.h has a switch statement which loops through user input chars in UTF-8 format and converts them to a symbol position in the font which is 0..255

from pixelit.

github-actions avatar github-actions commented on August 22, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

from pixelit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.