U++ framework
Do not panic. Ask here before giving up.

Home » Developing U++ » U++ Developers corner » Will UPP support full UNICODE (21bits long codepoint)?
Re: Will UPP support full UNICODE (21bits long codepoint)? [message #54570 is a reply to message #54569] Sat, 15 August 2020 11:33 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14291
Registered: November 2005
Ultimate Member
Oblivion wrote on Sat, 15 August 2020 11:12
Quote:
int GraphemeLength(const char *s);
int GraphemeLength(const wchar *s);


That requires width tables.

How about generating the width tables with uniset scripts (used by xterm et al.)?

They can generate width tables for doublewidth, ambiguous width, unknown width and combining chars from the UnicodeData.txt (latest version).
They are quite comprehensive.

I already started using them here (For double width and combining chars, ATM): https://github.com/ismail-yilmaz/upp-components/blob/master/ CtrlLib/Terminal/Cell.cpp

We can put these into a generic GetCharWidth(int c) function, then utilize them in GetGraphemeLength(const wchar *s)?

This might not be the definitve solution, but it is the battle-tested one out in the wild.

Only real downside is that the tables might need updating albeit ifrequently.


Best regards,
Oblivion


Just to make sure we are at the same page: I am not speaking about graphics width here, but a number of bytes (or words) that form a single grapheme ("combined character").

EDIT: Still not clear enough: Number of bytes of the first grapheme at s.

Mirek

[Updated on: Sat, 15 August 2020 12:27]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [Proposition] Simply source package manager for Upp
Next Topic: Uppiverse2
Goto Forum:
  


Current Time: Wed Sep 09 16:15:24 GMT+2 2026

Total time taken to generate the page: 0.01048 seconds