Coder Social home page Coder Social logo

utf8 input about truetype_arduino HOT 10 CLOSED

k-omura avatar k-omura commented on May 30, 2024
utf8 input

from truetype_arduino.

Comments (10)

Yardie- avatar Yardie- commented on May 30, 2024 1

I like to try different fonts out so I will let you know what ones do what things as I find them.
Fonts are notoriously variable.
That is why I like that site. There are so many different typesa.
It helps me test lots of different things.

It would be good to at least reject a font rather than crash the code. It seems that is quite tricky.

from truetype_arduino.

Yardie- avatar Yardie- commented on May 30, 2024

I will test it but having looked at your code as you said it's already there in what you have done
maybe this will just work

void truetypeClass::string(uint16_t _x, uint16_t _y, const uint8_t _character[]){
  this->string(_x, _y, (wchar_t*)_character);
}

or just calling the function like
truetype.string(10, 10, L"L'année 1866 fut marquée par un événement bizarre,");

I'll try that.

from truetype_arduino.

Yardie- avatar Yardie- commented on May 30, 2024

Cool the code you sent works nicely with alex brush.

String test = "èàùëïü";
    //Write a string to the framebuffer
    truetype.string(10, 0, test);
    truetype.string(10, 10, L"èàùëïü");
    truetype.string(10, 20, L"L'année");

All works but another font
https://www.1001fonts.com/kg-les-bouquinistes-de-paris-font.html
blows out the heap. with

3360
/FONTFILE.ttf
68400
CORRUPT HEAP: Bad head at 0x3ffb2d24. Expected 0xabba1234 got 0x3ffb6380
abort() was called at PC 0x400832f1 on core 1

ELF file SHA256: 0000000000000000

Backtrace: 0x40085004:0x3ffb1a70 0x40085279:0x3ffb1a90 0x400832f1:0x3ffb1ab0 0x4008341d:0x3ffb1ae0 0x400da493:0x3ffb1b00 0x400d618d:0x3ffb1dc0 0x400d60ac:0x3ffb1e10 0x400893e1:0x3ffb1e40 0x40081546:0x3ffb1e60 0x400831e9:0x3ffb1e80 0x4000bec7:0x3ffb1ea0 0x400d11f9:0x3ffb1ec0 0x400d2366:0x3ffb1ee0 0x400d1121:0x3ffb1f30 0x400d3cfa:0x3ffb1fb0 0x40086289:0x3ffb1fd0

But I can work with this thanks heaps.
I'll let you enjoy the rest of your holiday in peace.

from truetype_arduino.

Yardie- avatar Yardie- commented on May 30, 2024

but
https://www.1001fonts.com/chopin-script-font.html
works fine
I guess you can't be expected to support all the fonts in the world :)

from truetype_arduino.

k-omura avatar k-omura commented on May 30, 2024

That's right
I have confirmed that some font files have bugs.
It's one of the to-do lists.

Thanks for letting me know what the buggy font files have in common!
If the font file isn't available for some reason, I think I should give feedback to the user.

I can only touch my favorite code on holidays, so it's rather welcome!
I want to stay home while fixing the code

from truetype_arduino.

k-omura avatar k-omura commented on May 30, 2024

https://www.1001fonts.com/kg-les-bouquinistes-de-paris-font.html
blows out the heap. with

I checked the above font.
It turns out that the cause is that it does not currently support characters that are a combination of multiple glyphs called "Compound glyphs".
https://developer.apple.com/fonts/TrueType-Reference-Manual/RM01/Chap1.html#compound

Supporting "Compound glyphs" is one of the future issues, but at the moment, in the case of "Compound glyphs", it is left blank to prevent it from crashing.

I recognize that "Compound glyphs" are especially important in European languages.

from truetype_arduino.

Yardie- avatar Yardie- commented on May 30, 2024

Well done that is fantastic
and
the perfect response to the problem.
Yep ok that's a problem stop the code crashing in a nice clean way not doing that part and moving on.
The API can clearly now say one day these types will be supported but not now.
I am sure many of the people who require compound glyphs understand that it is not trivial.
You are getting a deep understanding of how ttf works now.
Well done again.

That is ground many fear to tread.

from truetype_arduino.

Yardie- avatar Yardie- commented on May 30, 2024

You are welcome to close this if you like.

from truetype_arduino.

Yardie- avatar Yardie- commented on May 30, 2024

Actually it maybe worth another look.

http://utf8everywhere.org/
Although (wchar_t*)_character seems to work so far it might be better to somehow use the algorithms in stringToWchar

from truetype_arduino.

k-omura avatar k-omura commented on May 30, 2024

This issue is closed because it supports single-byte characters.
Certainly it may be the "right way" to explicitly convert to utf16...

The "Compound glyphs" mentioned in this issue will be supported in #13.

from truetype_arduino.

Related Issues (12)

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.